https://wiki.spiralframework.info/w/api.php?action=feedcontributions&user=UnderMybrella&feedformat=atomSpiral Framework - User contributions [en-gb]2024-03-28T15:00:06ZUser contributionsMediaWiki 1.38.4https://wiki.spiralframework.info/w/index.php?title=Tutorial:Getting_Started&diff=609Tutorial:Getting Started2023-03-18T01:52:18Z<p>UnderMybrella: </p>
<hr />
<div>{{vaulted|This page has not been updated to work with the latest version of Spiral. Thus, the instructions will only work with the last version that was vaulted.}}<br />
<br />
Spiral being a command-line only program may seem confusing and difficult to truly grasp, but by taking it slowly we'll be able to, hopefully, guide you through being able to understand the basic concepts of how to use Spiral, so you can begin working with the game files yourself.<br />
<br />
==Before We Begin==<br />
Before we get started, we need to cover a few basic concepts with command line usage.<br />
<br />
# When a command lists the parameters it accepts, it may format them like so<br/><code>extract [folder] {regex}</code><br/>In these scenarios, a parameter denoted between square brackets (<code>[]</code>) is required, while a parameter specified between braces or curly brackets (<code>{}</code>) is optional.<br />
# If you ever are supplying a parameter that has spaces in it (Such as <code>Spiral Workspace</code>), you '''must''' supply it between speech marks (<code>""</code>). This will treat it as ''one'' parameter, rather than multiple. For instance: <code>"Spiral Workspace"</code>.<br />
<br />
==Workspace Setup==<br />
There are a few things we'll need before we can even begin to think about modding the game.<br />
<br />
The first is a copy of either [http://store.steampowered.com/app/413410/Danganronpa_Trigger_Happy_Havoc/ ''Danganronpa: Trigger Happy Havoc''] or [http://store.steampowered.com/app/413420/Danganronpa_2_Goodbye_Despair/ ''Danganronpa 2: Goodbye Despair''].<br />
<br />
{{warning|If either game is installed in a Steam Library outside of the default, SPIRAL will be unable to find it by default. See [[#Manual Registration|Manual Registration]]}}<br />
{{warning|If you have obtained WAD files from anything but the latest Steam release, there is '''''no''''' guarantee that anything here will work. '''Regardless of how the files were obtained, SPIRAL only guarantees compatibility with the latest WAD files fresh from Steam.'''}}<br />
<br />
The second thing you'll need is access to a command prompt or terminal of some kind (Referred to as a terminal throughout these guides). For Windows, this will be the [[wikipedia:cmd.exe|Command Prompt]]. For macOS and Mac OSX, this will be the [[wikipedia:Terminal_(macOS)|Terminal]], and on Linux it'll be some variant of a terminal (You should know how to find this).<br />
<br />
Next up on our list of requirements is a copy of Java 8. To test this, open your terminal and type <code>java -version</code>. You should see one of two things.<br />
* Some variation of "Command not found" (On Windows, you'll get <code>'java' is not recognised as an internal or external command</code>, on macOS/OSX/Linux you'll get <code>java: command not found</code>).<br />
** This means you'll need to install Java. You'll likely want [http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html Java 8], however [http://www.oracle.com/technetwork/java/javase/downloads/jre9-downloads-3848532.html Java 9] ''should'' work too.<br />
* <code>java version x</code><br />
** This means you have Java installed in some capacity. If it says '''1.8''' followed by some numbers, or '''9''' followed by some numbers, then good news! You have a recent enough version of Java installed. If it says anything lower than 8, you'll need to install a recent Java version, see above.<br />
<br />
{{warning|SPIRAL is developed with, built with, and tested against Java '''8'''. While Java 9 does not seem to break anything at this time, be warned that it is not unheard of. If this occurs, file a bug report [https://github.com/UnderMybrella/Spiral/issues/new here], and I'll investigate}}<br />
<br />
Finally, we're gonna need SPIRAL itself. Download the latest version [https://spiralframework.info/vault/andromeda.jar here].<br />
<br />
==Initialisation==<br />
After we have our tools installed, it's time to boot up SPIRAL. <br />
<br />
To start things off, open your terminal program. By default, this will be initialised in your home directory (<code>C:\\Users\\<username></code> for Windows, <code>/Users/<username></code> for macOS, and <code>/home/<username></code> on Linux). If this is not where you want SPIRAL to work from, you'll need to navigate to the directory you want with the <code>cd</code> command, which accepts a directory.<br />
<br />
{{note|I would recommend creating a directory for SPIRAL, and putting the JAR file in there. This way, everything's neatly contained, and you don't have to drag and drop the JAR file each time. It also helps if this directory is in your home directory.}}<br />
<br />
Next up, we need to start SPIRAL itself. If the JAR file is in the directory you're currently navigated into, then you can just use the filename for the next part, otherwise you'll have to type the full path in, or drag the file from a file program. It may help to rename the JAR file from it's downloaded name for easier use, as well.<br />
<br />
Our command will be formatted like so: <code>java -jar [SPIRAL JAR file]</code><br />
<br />
For instance, if we have a folder named "Spiral Workspace", and put the JAR file in there and called it "Program.jar", we would run in succession<br />
<code>cd "Spiral Workspace"</code> (Put in apostrophes because it has a space)<br />
<code>java -jar Program.jar</code><br />
<br />
SPIRAL will take a few moments on each startup to check to see if you're running the latest version (With a lot of things, this will be dependent on your system), and then, after a while, you should be greeted by<br />
<code>Initialising SPIRAL</code><br />
<br />
And with that, we're in!<br />
<br />
==Steam Registration==<br />
If you have your Steam library located on your main hard drive in the regular location (For Windows this is <code>C:\\Program Files\\Steam\\steamapps</code> and for macOS this is <code>~/Library/Application Support/Steam/steamapps</code>. SPIRAL does not currently support auto registration on Linux), then you should be able to just run <code>find</code>, and SPIRAL will automatically register any [[WAD]] or [[CPK]] files it finds.<br />
<br />
If SPIRAL does not find the files you need, see the next section - [[#Manual Registration|Manual Registration]].<br />
<br />
==Manual Registration==<br />
Sometimes, SPIRAL won't be able to find the Danganronpa files. This can happen if you have Steam set up with a separate library, used the Steam command line (For situations where the game is not supported on your operating system), or you copied the files over. Regardless, you have two ways of registering these files.<br />
# Register an individual file with <code>register [archive file or directory]</code><br />
# Register files in a folder with <code>locate [directory]</code><br />
<br />
{{warning|Using the <code>locate</code> command is a great way to save time, but if you supply a directory that has too many subfiles it will take a long time to traverse and scan each file!}}<br />
<br />
{{note|You may have noticed that <code>register</code> accepts a directory, despite registering an individual file. This is because [[wikipedia:Danganronpa V3: Killing Harmony|''Danganronpa V3: Killing Harmony'']] on Steam is able to iterate through directories as opposed to individual [[CPK]] files. See: [[Folder Archive]]}}<br />
<br />
==Registered Files==<br />
To see what files you have registered, to make sure you have the right one, you can run <code>registered</code><br />
<br />
[[Category: Tutorials]]</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Danganronpa:_Trigger_Happy_Havoc/Disassembly&diff=608Danganronpa: Trigger Happy Havoc/Disassembly2023-02-15T00:07:45Z<p>UnderMybrella: /* Variables */</p>
<hr />
<div>This is a community page for the disassembly of Trigger Happy Havoc, to assist in community projects.<br />
All addresses are calculated with an image base of 0, in hexadecimal.<br />
<br />
== DR1_us.exe ==<br />
=== Variables ===<br />
<br />
{| class="wikitable"<br />
!colspan="5"|Variables<br />
|-<br />
!Offset<br />
!Name<br />
!Data Type<br />
!Purpose<br />
!Notes<br />
|-<br />
|00359e74<br />
|Direct3DInit<br />
|[[Danganronpa: Trigger Happy Havoc/Disassembly/Direct3DInit|Direct3DInit]]<br />
|Structure containing information for Direct3D initialisation<br />
|Pointer returned by 00120080, checked in 001193a0; seems to actually contain some extra data, will update soon<br />
|}<br />
<br />
=== Functions ===<br />
<br />
{| class="wikitable"<br />
!colspan="7"|Functions<br />
|-<br />
!Offset<br />
!Name<br />
!Calling Type<br />
!Arguments<br />
!Return Type<br />
!Purpose<br />
!Notes<br />
|-<br />
|001193a0<br />
|SetupDirect3DInit<br />
|<br />
|<br />
|int*<br />
|Sets up the Direct3DInit struct if it hasn't been set up.<br />
|-<br />
|00120080<br />
|GetDirect3DInitPtr<br />
|<br />
|<br />
|int*<br />
|Returns a pointer to 00359e74<br />
|Checked in 001193a0<br />
|}<br />
<br />
== Artefacts ==<br />
These are functions and variables related to internal functionality, and aren't likely to be relevant or important, but are noted for the sake of completion and sanity.<br />
<br />
=== Variables ===<br />
<br />
{| class="wikitable"<br />
!colspan="5"|Variables<br />
|-<br />
!Offset<br />
!Name<br />
!Data Type<br />
!Purpose<br />
!Notes<br />
|-<br />
|00299590<br />
|MersenneTwisterIndex<br />
|unsigned int<br />
|Index of the generator for random number generation.<br />
|Initialised to 0x271<br />
|-<br />
|002a2588<br />
|GlobalSecurityCookie<br />
|int<br />
|Used to detect buffer overflows<br />
|Initialised in [https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/security-init-cookie __security_init_cookie]<br />
|-<br />
|0033f690<br />
|MersenneTwisterState<br />
|unsigned int[624]<br />
|State of the generator for random number generation.<br />
|<br />
|}<br />
<br />
=== Functions ===<br />
<br />
{| class="wikitable"<br />
!colspan="7"|Functions<br />
|-<br />
!Offset<br />
!Name<br />
!Calling Type<br />
!Arguments<br />
!Return Type<br />
!Purpose<br />
!Notes<br />
|-<br />
|000bc7f0<br />
|[https://cplusplus.com/reference/random/mersenne_twister_engine/operator()/ RandomMT]<br />
|<br />
|<br />
|unsigned int<br />
|Returns a new random number<br />
|Mersenne Twister<br />
|-<br />
|000bc990<br />
|[https://cplusplus.com/reference/random/mersenne_twister_engine/seed/ SeedMT]<br />
|<br />
|unsigned int seed<br />
|<br />
|(Re)seeds the generator<br />
|Mersenne Twister, default seed is 0x1571<br />
|-<br />
|000fd320<br />
|WrapInNetstring<br />
|__thiscall<br />
|SuffixedNetstring* dest, char* src<br />
|SuffixedNetstring*<br />
|Wraps a char* string in a [[Danganronpa: Trigger Happy Havoc/Disassembly/Netstring|Suffixed Netstring]] struct.<br />
|-<br />
|000fd530<br />
|CopyPrefixedNetstring<br />
|__thiscall<br />
|PrefixedNetstring* dest, PrefixedNetstring* src<br />
|PrefixedNetstring*<br />
|Copies a [[Danganronpa: Trigger Happy Havoc/Disassembly/Netstring|Prefixed Netstring]] struct.<br />
|<br />
|-<br />
|000fd890<br />
|FreePrefixedNetstring<br />
|__fastcall<br />
|PrefixedNetstring* string<br />
|<br />
|<br />
|<br />
|-<br />
|000fd6a0<br />
|CopyToNetstring<br />
|__thiscall<br />
|PrefixedNetstring* dest, char* src, size_t n<br />
|PrefixedNetstring*<br />
|Copies a char* string into a [[Danganronpa: Trigger Happy Havoc/Disassembly/Netstring|Prefixed Netstring]] struct, detecting the length if <syntaxhighlight inline lang="c">n < 0</syntaxhighlight>.<br />
|<br />
|-<br />
|000fda70<br />
|PrefixedNetstringRawSubstring<br />
|__thiscall<br />
|PrefixedNetstring* this, int index<br />
|char*<br />
|Get a substring of the underlying char* pointer<br />
|<br />
|-<br />
|00116660<br />
|GetPrefixedNetstringLength<br />
|__fastcall<br />
|PrefixedString* str<br />
|size_t<br />
|Get the length of a PrefixedString<br />
|-<br />
|00125a10<br />
|AreStringsEqual<br />
|<br />
|char* string1, size_t size1, char* string2, size_t size2<br />
|bool<br />
|Checks if strings are equal<br />
|Calls <syntaxhighlight inline lang="c">_strncmp(string1,string2,size1)</syntaxhighlight><br />
|-<br />
|001c6ff4<br />
|CheckSecurityCookie<br />
|__fastcall<br />
|int cookieValue<br />
|<br />
|Checks the provided cookie value against the Global Security Cookie, and exits if it doesn't match<br />
|<br />
|-<br />
|001c7f10<br />
|[https://cplusplus.com/reference/cstring/memset memset]<br />
|<br />
|void * ptr, int value, size_t num<br />
|void*<br />
|Sets the first num bytes of the block of memory pointed by ptr to the specified value (interpreted as an unsigned char).<br />
|<br />
|}</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Danganronpa:_Trigger_Happy_Havoc/Disassembly&diff=607Danganronpa: Trigger Happy Havoc/Disassembly2023-02-15T00:03:09Z<p>UnderMybrella: /* Functions */</p>
<hr />
<div>This is a community page for the disassembly of Trigger Happy Havoc, to assist in community projects.<br />
All addresses are calculated with an image base of 0, in hexadecimal.<br />
<br />
== DR1_us.exe ==<br />
=== Variables ===<br />
<br />
{| class="wikitable"<br />
!colspan="5"|Variables<br />
|-<br />
!Offset<br />
!Name<br />
!Data Type<br />
!Purpose<br />
!Notes<br />
|-<br />
|00359e74<br />
|Direct3DInit<br />
|[[Danganronpa: Trigger Happy Havoc/Disassembly/Direct3DInit|Direct3DInit]]<br />
|Structure containing information for Direct3D initialisation<br />
|Pointer returned by 00120080, checked in 001193a0; seems to actually contain some extra data, will update soon<br />
|}<br />
<br />
=== Functions ===<br />
<br />
{| class="wikitable"<br />
!colspan="7"|Functions<br />
|-<br />
!Offset<br />
!Name<br />
!Calling Type<br />
!Arguments<br />
!Return Type<br />
!Purpose<br />
!Notes<br />
|-<br />
|001193a0<br />
|SetupDirect3DInit<br />
|<br />
|<br />
|int*<br />
|Sets up the Direct3DInit struct if it hasn't been set up.<br />
|-<br />
|00120080<br />
|GetDirect3DInitPtr<br />
|<br />
|<br />
|int*<br />
|Returns a pointer to 00359e74<br />
|Checked in 001193a0<br />
|}<br />
<br />
== Artefacts ==<br />
These are functions and variables related to internal functionality, and aren't likely to be relevant or important, but are noted for the sake of completion and sanity.<br />
<br />
=== Variables ===<br />
<br />
{| class="wikitable"<br />
!colspan="5"|Variables<br />
|-<br />
!Offset<br />
!Name<br />
!Data Type<br />
!Purpose<br />
!Notes<br />
|-<br />
|002a2588<br />
|GlobalSecurityCookie<br />
|int<br />
|Used to detect buffer overflows<br />
|Initialised in [https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/security-init-cookie __security_init_cookie]<br />
|}<br />
<br />
=== Functions ===<br />
<br />
{| class="wikitable"<br />
!colspan="7"|Functions<br />
|-<br />
!Offset<br />
!Name<br />
!Calling Type<br />
!Arguments<br />
!Return Type<br />
!Purpose<br />
!Notes<br />
|-<br />
|000bc7f0<br />
|[https://cplusplus.com/reference/random/mersenne_twister_engine/operator()/ RandomMT]<br />
|<br />
|<br />
|unsigned int<br />
|Returns a new random number<br />
|Mersenne Twister<br />
|-<br />
|000bc990<br />
|[https://cplusplus.com/reference/random/mersenne_twister_engine/seed/ SeedMT]<br />
|<br />
|unsigned int seed<br />
|<br />
|(Re)seeds the generator<br />
|Mersenne Twister, default seed is 0x1571<br />
|-<br />
|000fd320<br />
|WrapInNetstring<br />
|__thiscall<br />
|SuffixedNetstring* dest, char* src<br />
|SuffixedNetstring*<br />
|Wraps a char* string in a [[Danganronpa: Trigger Happy Havoc/Disassembly/Netstring|Suffixed Netstring]] struct.<br />
|-<br />
|000fd530<br />
|CopyPrefixedNetstring<br />
|__thiscall<br />
|PrefixedNetstring* dest, PrefixedNetstring* src<br />
|PrefixedNetstring*<br />
|Copies a [[Danganronpa: Trigger Happy Havoc/Disassembly/Netstring|Prefixed Netstring]] struct.<br />
|<br />
|-<br />
|000fd890<br />
|FreePrefixedNetstring<br />
|__fastcall<br />
|PrefixedNetstring* string<br />
|<br />
|<br />
|<br />
|-<br />
|000fd6a0<br />
|CopyToNetstring<br />
|__thiscall<br />
|PrefixedNetstring* dest, char* src, size_t n<br />
|PrefixedNetstring*<br />
|Copies a char* string into a [[Danganronpa: Trigger Happy Havoc/Disassembly/Netstring|Prefixed Netstring]] struct, detecting the length if <syntaxhighlight inline lang="c">n < 0</syntaxhighlight>.<br />
|<br />
|-<br />
|000fda70<br />
|PrefixedNetstringRawSubstring<br />
|__thiscall<br />
|PrefixedNetstring* this, int index<br />
|char*<br />
|Get a substring of the underlying char* pointer<br />
|<br />
|-<br />
|00116660<br />
|GetPrefixedNetstringLength<br />
|__fastcall<br />
|PrefixedString* str<br />
|size_t<br />
|Get the length of a PrefixedString<br />
|-<br />
|00125a10<br />
|AreStringsEqual<br />
|<br />
|char* string1, size_t size1, char* string2, size_t size2<br />
|bool<br />
|Checks if strings are equal<br />
|Calls <syntaxhighlight inline lang="c">_strncmp(string1,string2,size1)</syntaxhighlight><br />
|-<br />
|001c6ff4<br />
|CheckSecurityCookie<br />
|__fastcall<br />
|int cookieValue<br />
|<br />
|Checks the provided cookie value against the Global Security Cookie, and exits if it doesn't match<br />
|<br />
|-<br />
|001c7f10<br />
|[https://cplusplus.com/reference/cstring/memset memset]<br />
|<br />
|void * ptr, int value, size_t num<br />
|void*<br />
|Sets the first num bytes of the block of memory pointed by ptr to the specified value (interpreted as an unsigned char).<br />
|<br />
|}</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Message_box/ombox.css&diff=596Module:Message box/ombox.css2022-10-01T05:27:33Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>/* {{pp|small=y}} */<br />
.ombox {<br />
margin: 4px 0;<br />
border-collapse: collapse;<br />
border: 1px solid #a2a9b1; /* Default "notice" gray */<br />
background-color: #f8f9fa;<br />
box-sizing: border-box;<br />
}<br />
<br />
/* For the "small=yes" option. */<br />
.ombox.mbox-small {<br />
font-size: 88%;<br />
line-height: 1.25em;<br />
}<br />
<br />
.ombox-speedy {<br />
border: 2px solid #b32424; /* Red */<br />
background-color: #fee7e6; /* Pink */<br />
}<br />
<br />
.ombox-delete {<br />
border: 2px solid #b32424; /* Red */<br />
}<br />
<br />
.ombox-content {<br />
border: 1px solid #f28500; /* Orange */<br />
}<br />
<br />
.ombox-style {<br />
border: 1px solid #fc3; /* Yellow */<br />
}<br />
<br />
.ombox-move {<br />
border: 1px solid #9932cc; /* Purple */<br />
}<br />
<br />
.ombox-protection {<br />
border: 2px solid #a2a9b1; /* Gray-gold */<br />
}<br />
<br />
.ombox .mbox-text {<br />
border: none;<br />
/* @noflip */<br />
padding: 0.25em 0.9em;<br />
width: 100%;<br />
}<br />
<br />
.ombox .mbox-image {<br />
border: none;<br />
/* @noflip */<br />
padding: 2px 0 2px 0.9em;<br />
text-align: center;<br />
}<br />
<br />
.ombox .mbox-imageright {<br />
border: none;<br />
/* @noflip */<br />
padding: 2px 0.9em 2px 0;<br />
text-align: center;<br />
}<br />
<br />
/* An empty narrow cell */<br />
.ombox .mbox-empty-cell {<br />
border: none;<br />
padding: 0;<br />
width: 1px;<br />
}<br />
<br />
.ombox .mbox-invalid-type {<br />
text-align: center;<br />
}<br />
<br />
@media (min-width: 720px) {<br />
.ombox {<br />
margin: 4px 10%;<br />
}<br />
<br />
.ombox.mbox-small {<br />
/* @noflip */<br />
clear: right;<br />
/* @noflip */<br />
float: right;<br />
/* @noflip */<br />
margin: 4px 0 4px 1em;<br />
width: 238px;<br />
}<br />
}</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Help:Infobox/user_style&diff=594Help:Infobox/user style2022-10-01T05:27:33Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>{{{heading|<br />
==Infoboxes and user style ==<br />
}}}<br />
Users can have [[WP:User style|user CSS]] that hides<!--, moves, or makes collapsible--> any infoboxes in their own browsers.<br />
<br />
To hide all infoboxes, add the following to [[Special:MyPage/common.css]] (for all [[WP:Skin|skins]], or [[Special:MyPage/skin.css]] for just the current skin), on a line by itself:<br />
<syntaxhighlight lang="css">div.mw-parser-output .infobox { display: none; }</syntaxhighlight><br />
<br />
Alternatively, you can add the following code to [[Special:MyPage/common.js|your common.js]] or into a browser user script that is executed by an extension like [[Greasemonkey]]:<br />
<br />
<syntaxhighlight lang="js">$('.infobox').hide();</syntaxhighlight><br />
<br />
Be aware that although{{#if:{{{guideline|}}}||, per [[WP:Manual of Style/Infoboxes]],}} all information in an infobox ideally should also be found in the main body of an article, there isn't perfect compliance with this guideline. For example, the full taxonomic hierarchy in {{tlx|Taxobox}}, and the OMIM and other medical database codes of {{tlx|Infobox disease}} are often not found in the main article content. The infobox is also often the location of the most significant, even only, image in an article.<!--<br />
<br />
Needs Special:Mypage/common.js options for:<br />
* Making infoboxes collapsible<br />
** Making them auto-collapsed<br />
* Moving infoboxes to bottom of page<br />
<br />
--><noinclude><br />
{{Documentation|content=<br />
This documentation snippet is transcluded at [[Help:Infobox]], [[Template:Infobox/doc]], [[WP:Customisation#Hiding specific messages]], [[Help:User style]], [[WP:Manual of Style/Infoboxes]], and other places where this information is relevant.<br />
<br />
As a template, this snippet takes a {{para|heading}} parameter to replace the level-2 <code>==Infoboxes and user style==</code> section heading code, as needed. E.g., for a <code>=== ... ===</code> level-3 heading: <code><nowiki>heading={{=}}{{=}}{{=}}Infoboxes and user style{{=}}{{=}}{{=}}</nowiki></code><br />
}}<br />
</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Infobox/doc&diff=592Template:Infobox/doc2022-10-01T05:27:33Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>{{Documentation subpage}}<br />
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --><br />
{{distinguish|Template:Userbox}}<br />
{{High-use}}<br />
{{Lua|Module:Infobox}}<br />
{{Parameter names example<br />
|name={{PAGENAME}} <!--|child |subbox |decat--> |title |above |subheader |subheader1 |subheader2={{{subheader2}}}<br/>......<br />
|image|caption |image1|caption1 |image2|caption2={{{caption2}}}<br/>......<br />
|header1=<div style="border-top:1px dashed #ccc;">{{{header1}}}<br/>{{nobold|( ''or'' )}}</div><br />
|label2={{{label1}}} |data2={{{data1}}}<br />
|data3=( ''or'' ) |data4=<div style="padding-bottom:0.25em;border-bottom:1px dashed #ccc;">{{{data1}}}</div><br />
|header5={{{header2}}}<br/><div style="padding:0.75em 0 0.5em;">{{nobold|( ''or'' )}}</div><br />
|label6={{{label2}}} |data6={{{data2}}}<br />
|data7=( ''or'' ) |data8=<div style="padding-bottom:0.25em;border-bottom:1px dashed #ccc;">{{{data2}}}</div><br />
|data9=<div style="padding:0.75em 0 0.5em;">( ''etc'' )</div><br />
|below<br />
}}<br />
<br />
This template is intended as a meta template: a template used for constructing other templates. '''Note''': In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. [[Help:Infobox]] contains an introduction about the recommended content and design of infoboxes; [[Wikipedia:Manual of Style/Infoboxes]] contains additional style guidelines. See [[WP:List of infoboxes]] and [[:Category:Infobox templates]] for lists of prepared topic-specific infoboxes.<br />
<br />
== Usage ==<br />
{{tlf|Infobox}} is a meta-template: used to organise an actual <nowiki>{{Infobox sometopic}}</nowiki> template (like {{tl|Infobox building}}). <br />
<br />
For <code><nowiki>[[Template:Infobox sometopic]]</nowiki></code>, template code then looks like this, simplified:<br />
<pre><br />
{{Infobox<br />
| name = {{{name|{{PAGENAME}}}}}<br />
| image = {{{image|}}}<br />
| caption1 = {{{caption|}}}<br />
<br />
| label1 = Former names<br />
| data1 = {{{former_names|}}}<br />
<br />
| header2 = General information<br />
<br />
| label3 = Status<br />
| data3 = {{{status|}}}<br />
... <!-- etc. --><br />
}}<br />
</pre><br />
<br />
== Optional control parameters ==<br />
; name : If this parameter is present, "view/talk/edit" links will be added to the bottom of the infobox pointing to the named page, prefixed by <code>Template:</code> if no namespace is specified. You may use the value <nowiki>{{subst:PAGENAME}}</nowiki>; however, this is rarely what you want because it will send users clicking these links in an infobox to the template code rather than the data in the infobox they probably want to change.<br />
; child : See the [[#Embedding|Embedding]] section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it.<br />
; subbox : See the [[#Subboxes|Subboxes]] section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the '''child''' parameter is also set to "yes".<br />
; 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.<br />
; autoheaders: If this is set to any non-blank value, headers which are not followed by data fields are suppressed. See the "[[#Hiding headers when all its data fields are empty|hiding headers when all its data fields are empty]]" section for more details.<br />
<br />
== Content parameters ==<br />
<br />
=== Title ===<br />
There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended):<br />
<br />
; title : Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For [[Wikipedia:Manual of Style/Accessibility#Tables|accessibility reasons]], this is the most recommended alternative.<br />
; above : Text to put within the uppermost cell of the table.<br />
; subheader(n) : additional title fields which fit below {{{title}}} and {{{above}}}, but before images.<br />
<br />
Examples:<br />
<br />
{{Infobox<br />
| name = Infobox/doc<br />
| title = Text in caption over infobox<br />
| subheader = Subheader of the infobox<br />
| header = (the rest of the infobox goes here)<br />
}}<br />
<pre style="overflow:auto"><br />
{{Infobox<br />
| name = {{subst:PAGENAME}}<br />
| title = Text in caption over infobox<br />
| subheader = Subheader of the infobox<br />
| header = (the rest of the infobox goes here)<br />
}}<br />
</pre>{{clear}}<br />
<br />
{{Infobox<br />
| name = Infobox/doc<br />
| above = Text in uppermost cell of infobox<br />
| subheader = Subheader of the infobox<br />
| subheader2 = Second subheader of the infobox<br />
| header = (the rest of the infobox goes here)<br />
}}<br />
<pre style="overflow:auto"><br />
{{Infobox<br />
| name = {{subst:PAGENAME}}<br />
| above = Text in uppermost cell of infobox<br />
| subheader = Subheader of the infobox<br />
| subheader2 = Second subheader of the infobox<br />
| header = (the rest of the infobox goes here)<br />
}}<br />
</pre>{{clear}}<br />
<br />
=== Illustration images ===<br />
; image(n) : images to display at the top of the template. Use full image syntax, for example <nowiki>[[File:example.png|200px|alt=Example alt text]]</nowiki>. Image is centered by default. See [[WP:ALT]] for more on alt text.<br />
; caption(n) : Text to put underneath the images.<br />
<br />
=== Main data ===<br />
; header(n) : Text to use as a header in row n.<br />
; label(n) : Text to use as a label in row n.<br />
; data(n) : Text to display as data in row n.<br />
<br />
Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a {{para|header''(n)''}} will cause the corresponding {{para|data''(n)''}} (and {{para|rowclass''(n)''}} {{para|label''(n)''}}, see below) to be ignored; the absence of a {{para|data''(n)''}} will cause the corresponding {{para|label''(n)''}} to be ignored. Valid combinations for any single row are:<br />
<br />
* {{para|class''(n)''}} {{para|header''(n)''}}<br />
* {{para|rowclass''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}}<br />
* {{para|rowclass''(n)''}} {{para|label''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}}<br />
<br />
See the rendering of header4, label4, and data4 in the [[#Examples|Examples]] section below.<br />
<br />
==== Number ranges ====<br />
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:<br />
<br />
<pre style="overflow:auto"><br />
| header3 = Section 1<br />
| label5 = Label A<br />
| data5 = Data A<br />
| label7 = Label C<br />
| data7 = Data C<br />
| header10 = Section 2<br />
| label12 = Label D<br />
| data12 = Data D<br />
</pre>{{clear}}<br />
<br />
It is also possible to automatically renumber parameter names by using [[User:Frietjes/infoboxgap.js]] or [[Module:IncrementParams]].<br />
<br />
==== Making data fields optional ====<br />
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:<br />
<br />
<pre style="overflow:auto"><br />
| label5 = Population<br />
| data5 = {{{population|}}}<br />
</pre>{{clear}}<br />
<br />
This way if an article doesn't define the population parameter in its infobox the row won't be displayed.<br />
<br />
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'":<br />
<br />
<pre style="overflow:auto"><br />
| label6 = Mass<br />
| data6 = {{ #if: {{{mass|}}} | {{{mass}}} kg }}<br />
</pre>{{clear}}<br />
<br />
For more on #if, see [[meta:ParserFunctions##if:|here]].<br />
<br />
==== Hiding headers when all its data fields are empty ====<br />
You can also make headers automatically hide when their section is empty (has no data-row showing).<br />
<br />
Consider this situation:<br />
{{Infobox<br />
| title = Example: header with & without data<br />
| headerstyle = background:lightgrey<br />
<br />
| header1 = Header1 with empty section<br />
| label2 = label2 text | data2 =<br />
| label3 = label3 text | data3 =<br />
| label4 = label4 text | data4 =<br />
<br />
| header5 = Header5 with data below<br />
| label6 = label6 text | data6 = Some value<br />
}}<br />
<pre style="overflow:auto"><br />
{{Infobox<br />
| title = Example: header with & without data<br />
| headerstyle = background:lightgrey<br />
<br />
| header1 = Header1 with empty section<br />
| label2 = label2 text | data2 =<br />
| label3 = label3 text | data3 =<br />
| label4 = label4 text | data4 =<br />
<br />
| header5 = Header5 with data below<br />
| label6 = label6 text | data6 = Some value<br />
}}<br />
</pre>{{clear}}<br />
<br />
If you want hide the header when no {{para|data''N''}} values are present, use '''{{para|autoheaders|y}}''':<br />
<br />
{{Infobox<br />
| title = Example: header with & without data<br />
| autoheaders = y<br />
| headerstyle = background:lightgrey<br />
<br />
| header1 = Header1 with empty section<br />
| label2 = label2 text | data2 =<br />
| label3 = label3 text | data3 =<br />
| label4 = label4 text | data4 =<br />
<br />
| header5 = Header5 with data below<br />
| label6 = label6 text | data6 = Some value<br />
}}<br />
<br />
<syntaxhighlight lang="moin" style="overflow:auto"><br />
{{Infobox<br />
| title = Example: header with & without data<br />
| autoheaders = y<br />
| headerstyle = background:lightgrey<br />
<br />
| header1 = Header1 with empty section<br />
| label2 = label2 text | data2 =<br />
| label3 = label3 text | data3 =<br />
| label4 = label4 text | data4 =<br />
<br />
| header5 = Header5 with data below<br />
| label6 = label6 text | data6 = Some value<br />
}}<br />
</syntaxhighlight>{{clear}}<br />
<br />
So, header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next visible content.<br />
<br />
Note: if the data has empty css elements, like {{para|data|2=&lt;span style="background:yellow;">&lt;/span>}}, this will be treated as non-empty (having data).<br />
<br />
If {{para|autoheaders|y}} but there are items that you ''do not'' want to trigger a header, place {{para|headerX|_BLANK_}}. This will serve as an empty header and separate it from the subsequent items.<br />
<br />
{{Infobox<br />
| title = Example: blank header with & without data<br />
| autoheaders = y<br />
| headerstyle = background:lightgrey<br />
<br />
| header1 = Header1 with empty section<br />
| label2 = label2 text | data2 =<br />
| label3 = label3 text | data3 =<br />
| label4 = label4 text | data4 =<br />
<br />
| header5 = _BLANK_<br />
| label6 = label6 text | data6 = Some value, but does not trigger header1 or show header5<br />
}}<br />
<br />
<syntaxhighlight lang="moin" style="overflow:auto"><br />
{{Infobox<br />
| title = Example: header with & without data<br />
| autoheaders = y<br />
| headerstyle = background:lightgrey<br />
<br />
| header1 = Header1 with empty section<br />
| label2 = label2 text | data2 =<br />
| label3 = label3 text | data3 =<br />
| label4 = label4 text | data4 =<br />
<br />
| header5 = _BLANK_<br />
| label6 = label6 text | data6 = Some value, but does not trigger header1 or show header5<br />
}}<br />
</syntaxhighlight>{{clear}}<br />
<br />
=== Footer ===<br />
; below : Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.<br />
<br />
== Presentation parameters ==<br />
<br />
=== Italic titles ===<br />
Titles of articles with infoboxes may be made italic, in line with [[WP:ITALICTITLE]], by passing the <code>italic title</code> parameter.<br />
<br />
* Turn on italic titles by passing {{para|italic title|<nowiki>{{{italic title|}}}</nowiki>}} from the infobox.<br />
* Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing {{para|italic title|<nowiki>{{{italic title|no}}}</nowiki>}}<br />
* Do not make any titles italic by not passing the parameter at all.<br />
<br />
=== CSS styling ===<br />
{{div col}}<br />
; bodystyle : Applies to the infobox table as a whole<br />
; titlestyle : Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox.<br />
; 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.<br />
; 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.<br />
; captionstyle : Applies to the text of the image caption.<br />
; rowstyle(n) : This parameter is inserted into the <code>style</code> attribute for the specified row.<br />
; headerstyle : Applies to all header cells<br />
; subheaderstyle : Applies to all subheader cells<br />
; labelstyle : Applies to all label cells<br />
; datastyle : Applies to all data cells<br />
; belowstyle : Applies only to the below cell<br />
{{div col end}}<br />
<br />
=== HTML classes and microformats ===<br />
{{div col}}<br />
; bodyclass : This parameter is inserted into the <code>class</code> attribute for the infobox as a whole.<br />
; titleclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''title''' caption.<br />
<!-- currently not implemented in Lua module<br />
; aboverowclass : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''above''' cell is on.<br />
--><br />
; aboveclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''above''' cell.<br />
; subheaderrowclass(n) : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''subheader''' is on.<br />
; subheaderclass(n) : This parameter is inserted into the <code>class</code> attribute for the infobox's '''subheader'''.<br />
; imagerowclass(n) : These parameters are inserted into the <code>class</code> attribute for the complete table row their respective '''image''' is on.<br />
; imageclass : This parameter is inserted into the <code>class</code> attribute for the '''image'''.<br />
; rowclass(n) : This parameter is inserted into the <code>class</code> attribute for the specified row including the '''label''' and '''data''' cells.<br />
; 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.<br />
<!-- currently not implemented in Lua module<br />
; belowrowclass : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''below''' cell is on.<br />
--><br />
; belowclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''below''' cell.<br />
{{div col end}}<br />
<br />
This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others being used for microformats.<br />
<br />
To flag an infobox as containing [[hCard]] information, for example, add the following parameter:<br />
<br />
<pre style="overflow:auto"><br />
| bodyclass = vcard<br />
</pre>{{clear}}<br />
<br />
And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:<br />
<br />
<pre style="overflow:auto"><br />
| class1 = fn<br />
| class2 = org<br />
| class3 = tel<br />
</pre>{{clear}}<br />
<br />
...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.<br />
<br />
See [[Wikipedia:WikiProject Microformats]] for more information on adding microformat information to Wikipedia, and [[microformat]] for more information on microformats in general.<br />
<br />
== Examples ==<br />
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 :<br />
<br />
{{Infobox<br />
|name = Infobox/doc<br />
|bodystyle = <br />
<br />
|titlestyle = <br />
|abovestyle = background:#cfc;<br />
|subheaderstyle =<br />
|title = Test Infobox<br />
|above = Above text<br />
|subheader = Subheader above image<br />
|subheader2 = Second subheader<br />
<br />
|imagestyle = <br />
|captionstyle = <br />
|image = [[File:Example-serious.jpg|200px|alt=Example alt text]]<br />
|caption = Caption displayed below File:Example-serious.jpg<br />
<br />
|headerstyle = background:#ccf;<br />
|labelstyle = background:#ddf;<br />
|datastyle = <br />
<br />
|header1 = Header defined alone<br />
| label1 = <br />
| data1 = <br />
|header2 = <br />
| label2 = Label defined alone does not display (needs data, or is suppressed)<br />
| data2 = <br />
|header3 =<br />
| label3 = <br />
| data3 = Data defined alone<br />
|header4 = All three defined (header, label, data, all with same number)<br />
| label4 = does not display (same number as a header)<br />
| data4 = does not display (same number as a header)<br />
|header5 =<br />
| label5 = Label and data defined (label)<br />
| data5 = Label and data defined (data)<br />
<br />
|belowstyle = background:#ddf;<br />
|below = Below text<br />
}}<br />
<syntaxhighlight lang="Sass" style="overflow:auto" highlight="15"><br />
{{Infobox<br />
|name = {{subst:PAGENAME}}<br />
|bodystyle = <br />
<br />
|titlestyle = <br />
|abovestyle = background:#cfc;<br />
|subheaderstyle =<br />
|title = Test Infobox<br />
|above = Above text<br />
|subheader = Subheader above image<br />
|subheader2 = Second subheader<br />
<br />
|imagestyle = <br />
|captionstyle = <br />
| image = [[File:Example-serious.jpg|200px|alt=Example alt text]]<br />
|caption = Caption displayed below Example-serious.jpg<br />
<br />
|headerstyle = background:#ccf;<br />
|labelstyle = background:#ddf;<br />
|datastyle = <br />
<br />
|header1 = Header defined alone<br />
| label1 = <br />
| data1 = <br />
|header2 = <br />
| label2 = Label defined alone does not display (needs data, or is suppressed)<br />
| data2 = <br />
|header3 =<br />
| label3 = <br />
| data3 = Data defined alone<br />
|header4 = All three defined (header, label, data, all with same number)<br />
| label4 = does not display (same number as a header)<br />
| data4 = does not display (same number as a header)<br />
|header5 =<br />
| label5 = Label and data defined (label)<br />
| data5 = Label and data defined (data)<br />
<br />
|belowstyle = background:#ddf;<br />
|below = Below text<br />
}}<br />
</syntaxhighlight>{{clear}}<br />
<br />
For this example, the {{para|bodystyle}} and {{para|labelstyle}} parameters are used to adjust the infobox width and define a default width for the column of labels:<br />
<br />
{{Infobox<br />
|name = Infobox/doc<br />
|bodystyle = width:20em<br />
<br />
|titlestyle = <br />
|title = Test Infobox<br />
<br />
|headerstyle = <br />
|labelstyle = width:33%<br />
|datastyle = <br />
<br />
|header1 = <br />
| label1 = Label 1<br />
| data1 = Data 1<br />
|header2 = <br />
| label2 = Label 2<br />
| data2 = Data 2<br />
|header3 = <br />
| label3 = Label 3<br />
| data3 = Data 3<br />
|header4 = Header 4<br />
| label4 = <br />
| data4 = <br />
|header5 = <br />
| label5 = Label 5<br />
| data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<br />
<br />
|belowstyle = <br />
|below = Below text<br />
}}<br />
<syntaxhighlight lang="sass" highlight="3,9" style="overflow: auto"><br />
{{Infobox<br />
|name = {{subst:PAGENAME}}<br />
|bodystyle = width:20em<br />
<br />
|titlestyle = <br />
|title = Test Infobox<br />
<br />
|headerstyle = <br />
|labelstyle = width:33%<br />
|datastyle = <br />
<br />
|header1 = <br />
| label1 = Label 1<br />
| data1 = Data 1<br />
|header2 = <br />
| label2 = Label 2<br />
| data2 = Data 2<br />
|header3 = <br />
| label3 = Label 3<br />
| data3 = Data 3<br />
|header4 = Header 4<br />
| label4 = <br />
| data4 = <br />
|header5 = <br />
| label5 = Label 5<br />
| data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<br />
<br />
|belowstyle = <br />
|below = Below text<br />
}}<br />
</syntaxhighlight>{{clear}}<br />
<br />
== Embedding ==<br />
<!--Linked from [[Template:Subinfobox bodystyle/doc]]--><br />
One infobox template can be embedded into another using the {{para|child}} parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of <code><nowiki>{{infobox}}</nowiki></code>.<br />
<br />
{{Infobox<br />
| title = Top level title<br />
| data1 = {{Infobox | decat = yes | child = yes<br />
| title = First subsection<br />
| label1= Label 1.1<br />
| data1 = Data 1.1<br />
}}<br />
| data2 = {{Infobox | decat = yes | child = yes<br />
|title = Second subsection<br />
| label1= Label 2.1<br />
| data1 = Data 2.1<br />
}}<br />
| belowstyle = <br />
| below = Below text<br />
}}<br />
<pre style="overflow:auto"><br />
{{Infobox<br />
| title = Top level title<br />
| data1 = {{Infobox | decat = yes | child = yes<br />
| title = First subsection<br />
| label1= Label 1.1<br />
| data1 = Data 1.1<br />
}}<br />
| data2 = {{Infobox | decat = yes | child = yes<br />
|title = Second subsection<br />
| label1= Label 2.1<br />
| data1 = Data 2.1<br />
}}<br />
| belowstyle = <br />
| below = Below text<br />
}}<br />
</pre>{{clear}}<br />
<br />
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<br />
<br />
{{Infobox<br />
| title = Top level title<br />
| header1 = {{Infobox | decat = yes | child = yes<br />
| title = First subsection<br />
| label1= Label 1.1<br />
| data1 = Data 1.1<br />
}}<br />
| header2 = {{Infobox | decat = yes | child = yes<br />
| title = Second subsection<br />
| label1= Label 2.1<br />
| data1 = Data 2.1<br />
}}<br />
| belowstyle = <br />
| below = Below text<br />
}}<br />
<pre style="overflow:auto"><br />
{{Infobox<br />
| title = Top level title<br />
| header1 = {{Infobox | decat = yes | child = yes<br />
| title = First subsection<br />
| label1= Label 1.1<br />
| data1 = Data 1.1<br />
}}<br />
| header2 = {{Infobox | decat = yes | child = yes<br />
| title = Second subsection<br />
| label1= Label 2.1<br />
| data1 = Data 2.1<br />
}}<br />
| belowstyle = <br />
| below = Below text<br />
}}<br />
</pre>{{clear}}<br />
<br />
or,<br />
<br />
{{Infobox<br />
| title = Top level title<br />
| header1 = First subsection<br />
{{Infobox | decat = yes | child = yes<br />
| label1 = Label 1.1<br />
| data1 = Data 1.1<br />
}}<br />
| header2 = Second subsection<br />
{{Infobox | decat = yes | child = yes<br />
| label1 = Label 2.1<br />
| data1 = Data 2.1<br />
}}<br />
| belowstyle = <br />
| below = Below text<br />
}}<br />
<pre style="overflow:auto"><br />
{{Infobox<br />
| title = Top level title<br />
| header1 = First subsection<br />
{{Infobox | decat = yes | child = yes<br />
| label1 = Label 1.1<br />
| data1 = Data 1.1<br />
}}<br />
| header2 = Second subsection<br />
{{Infobox | decat = yes | child = yes<br />
| label1 = Label 2.1<br />
| data1 = Data 2.1<br />
}}<br />
| belowstyle = <br />
| below = Below text<br />
}}<br />
</pre>{{clear}}<br />
<br />
Note that omitting the {{para|title}} parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation. The garbage output can be suppressed using {{para|rowstyleN|display: none}}, replacing N with the data/header number.<br />
<br />
[[Wikipedia:WikiProject Infoboxes/embed]] includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes.<br />
<br />
== Subboxes ==<br />
An alternative method for embedding is to use {{para|subbox|yes}}, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.<br />
<br />
{{Infobox<br />
| headerstyle = background-color:#eee;<br />
| labelstyle = background-color:#eee;<br />
| header1 = Main 1<br />
| header2 = Main 2<br />
| data3 = {{Infobox | subbox = yes<br />
| headerstyle = background-color:#ccc;<br />
| labelstyle = background-color:#ddd;<br />
| header1 = Sub 3-1<br />
| header2 = Sub 3-2<br />
| label3 = Label 3-3 | data3 = Data 3-3<br />
}}<br />
| data4 = {{Infobox | subbox = yes<br />
| labelstyle = background-color:#ccc;<br />
| label1 = Label 4-1 | data1 = Data 4-1<br />
}}<br />
| label5 = Label 5 | data5 = Data 5<br />
| header6 = Main 6<br />
}}<br />
<syntaxhighlight lang="sass" style="overflow:auto"><br />
{{Infobox<br />
| headerstyle = background-color:#eee;<br />
| labelstyle = background-color:#eee;<br />
| header1 = Main 1<br />
| header2 = Main 2<br />
| data3 = {{Infobox | subbox = yes<br />
| headerstyle = background-color:#ccc;<br />
| labelstyle = background-color:#ddd;<br />
| header1 = Sub 3-1<br />
| header2 = Sub 3-2<br />
| label3 = Label 3-3 | data3 = Data 3-3<br />
}}<br />
| data4 = {{Infobox | subbox = yes<br />
| labelstyle = background-color:#ccc;<br />
| label1 = Label 4-1 | data1 = Data 4-1<br />
}}<br />
| label5 = Label 5 | data5 = Data 5<br />
| header6 = Main 6<br />
}}<br />
</syntaxhighlight>{{clear}}<br />
<br />
Similar embedding techniques may be used within content parameters of some other templates generating tables (such as [[:Template:Sidebar|Sidebar]]) :<br />
<br />
{{Sidebar<br />
| navbar = off<br />
| headingstyle = background-color:#eee;<br />
| heading1 = Heading 1<br />
| heading2 = Heading 2<br />
| content3 = {{Infobox | subbox = yes<br />
| headerstyle = background-color:#ccc;<br />
| labelstyle = background-color:#ddd;<br />
| header1 = Sub 3-1<br />
| header2 = Sub 3-2<br />
| label3 = Label 3-3 | data3 = Data 3-3<br />
}}<br />
| content4 = {{Infobox | subbox = yes<br />
| labelstyle = background-color:#ccc;<br />
| label1 = Label 4-1 | data1 = Data 4-1<br />
}}<br />
| heading5 = Heading 5<br />
}}<br />
<syntaxhighlight lang="sass" style="overflow:auto"><br />
{{Sidebar<br />
| navbar = off<br />
| headingstyle = background-color:#eee;<br />
| heading1 = Heading 1<br />
| heading2 = Heading 2<br />
| content3 = {{Infobox | subbox = yes<br />
| headerstyle = background-color:#ccc;<br />
| labelstyle = background-color:#ddd;<br />
| header1 = Sub 3-1<br />
| header2 = Sub 3-2<br />
| label3 = Label 3-3 | data3 = Data 3-3<br />
}}<br />
| content4 = {{Infobox | subbox = yes<br />
| labelstyle = background-color:#ccc;<br />
| label1 = Label 4-1 | data1 = Data 4-1<br />
}}<br />
| heading5 = Heading 5<br />
}}<br />
</syntaxhighlight>{{clear}}<br />
<br />
Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.<br />
<br />
== Controlling line-breaking in embedded bulletless lists ==<br />
Template {{tlx|nbsp}} may be used with {{tlx|wbr}} and {{tlx|nowrap}} to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in {{tlx|Infobox film}}), to prevent wrapped long entries from being confused with multiple entries. See [[Template:Wbr/doc#Controlling line-breaking in infoboxes]] for details.<br />
<br />
== Full blank syntax ==<br />
(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.)<br />
<br />
<pre style="overflow:auto"><br />
{{Infobox<br />
| name = {{subst:PAGENAME}}<br />
| child = {{{child|}}}<br />
| subbox = {{{subbox|}}}<br />
| italic title = {{{italic title|no}}}<br />
| templatestyles = <br />
| child templatestyles = <br />
| grandchild templatestyles = <br />
| bodystyle = <br />
<br />
| titlestyle = <br />
| abovestyle = <br />
| subheaderstyle = <br />
| title = <br />
| above = <br />
| subheader = <br />
<br />
| imagestyle = <br />
| captionstyle = <br />
| image = <br />
| caption = <br />
| image2 = <br />
| caption2 = <br />
<br />
| headerstyle = <br />
| labelstyle = <br />
| datastyle = <br />
| header1 = <br />
| label1 = <br />
| data1 = <br />
| header2 = <br />
| label2 = <br />
| data2 = <br />
| header3 = <br />
| label3 = <br />
| data3 = <br />
| header4 = <br />
| label4 = <br />
| data4 = <br />
| header5 = <br />
| label5 = <br />
| data5 = <br />
| header6 = <br />
| label6 = <br />
| data6 = <br />
| header7 = <br />
| label7 = <br />
| data7 = <br />
| header8 = <br />
| label8 = <br />
| data8 = <br />
| header9 = <br />
| label9 = <br />
| data9 = <br />
| header10 = <br />
| label10 = <br />
| data10 = <br />
| header11 = <br />
| label11 = <br />
| data11 = <br />
| header12 = <br />
| label12 = <br />
| data12 = <br />
| header13 = <br />
| label13 = <br />
| data13 = <br />
| header14 = <br />
| label14 = <br />
| data14 = <br />
| header15 = <br />
| label15 = <br />
| data15 = <br />
| header16 = <br />
| label16 = <br />
| data16 = <br />
| header17 = <br />
| label17 = <br />
| data17 = <br />
| header18 = <br />
| label18 = <br />
| data18 = <br />
| header19 = <br />
| label19 = <br />
| data19 = <br />
| header20 = <br />
| label20 = <br />
| data20 = <br />
<br />
| belowstyle = <br />
| below = <br />
}}<br />
</pre>{{clear}}<br />
{{Help:Infobox/user style}}<br />
<br />
== Porting to other MediaWikis ==<br />
The infobox template requires the [[:mw:Extension:Scribunto|Scribunto]] extension. [[Wikipedia:WikiProject Transwiki|WikiProject Transwiki]] has a version of this template that has been modified to work on other MediaWikis.<br />
<br />
== TemplateData ==<br />
{{TemplateData header}}<br />
<templatedata><br />
{<br />
"description": "This template is intended as a meta template, a template used for constructing other templates. In general, it is not meant for use directly in an article but can be used on a one-off basis if required.",<br />
"format": "{{_\n| ________________ = _\n}}\n",<br />
"params": {<br />
"title": {<br />
"label": "Title",<br />
"description": "Title displayed above the infobox",<br />
"type": "string",<br />
"suggested": true<br />
},<br />
"image": {<br />
"label": "Image",<br />
"description": "Image illustrating the topic. Use full image syntax.",<br />
"type": "content",<br />
"suggested": true,<br />
"example": "[[File:example.png|200px|alt=Example alt text]]"<br />
},<br />
"caption": {<br />
"label": "Caption",<br />
"description": "caption for the image",<br />
"type": "content",<br />
"suggested": true<br />
}<br />
},<br />
"paramOrder": [<br />
"title",<br />
"image",<br />
"caption"<br />
]<br />
}<br />
</templatedata><br />
<br />
<br />
==Tracking categories==<br />
* {{Category link with count|Articles with missing Wikidata information}}<br />
* {{Category link with count|Articles using infobox templates with no data rows}}<br />
* {{Category link with count|Pages using embedded infobox templates with the title parameter}}<br />
<br />
==See also==<br />
* [[Module:Infobox]], the [[WP:LUA|Lua]] module on which this template is based<br />
* [[Module:Check for unknown parameters]]<br />
* {{tl|Infobox3cols}}<br />
* {{tl|Navbox}} and {{tl|Sidebar}}<br />
* [[Wikipedia:List of infoboxes|List of infoboxes]]<br />
* [[:Module:InfoboxImage]]<br />
<br />
<includeonly>{{Sandbox other||<br />
[[Category:Infobox templates| ]]<br />
[[Category:Wikipedia metatemplates|Infobox]]<br />
[[Category:Templates generating microformats]]<br />
[[Category:Templates that add a tracking category]]<br />
[[Category:Templates based on the Infobox Lua module]]<br />
}}</includeonly></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Transclusion_count/data/I&diff=590Module:Transclusion count/data/I2022-10-01T05:27:29Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>return {<br />
["IAAF_name"] = 2200,<br />
["IAST"] = 5800,<br />
["IBDB_name"] = 9000,<br />
["ICD10"] = 4600,<br />
["ICD9"] = 4400,<br />
["ICS"] = 2800,<br />
["IDN"] = 3200,<br />
["IMDb_episode"] = 9100,<br />
["IMDb_episodes"] = 2100,<br />
["IMDb_name"] = 148000,<br />
["IMDb_title"] = 183000,<br />
["IMO_Number"] = 4000,<br />
["IMSLP"] = 7900,<br />
["IND"] = 7600,<br />
["INR"] = 5900,<br />
["INRConvert"] = 5200,<br />
["INRConvert/CurrentRate"] = 5200,<br />
["INRConvert/USD"] = 5200,<br />
["INRConvert/out"] = 5200,<br />
["IOC_profile"] = 6100,<br />
["IP"] = 2500,<br />
["IPA"] = 134000,<br />
["IPA-all"] = 3300,<br />
["IPA-de"] = 7500,<br />
["IPA-es"] = 7600,<br />
["IPA-fr"] = 41000,<br />
["IPA-it"] = 5600,<br />
["IPA-nl"] = 3400,<br />
["IPA-pl"] = 3800,<br />
["IPA-pt"] = 3500,<br />
["IPA-ru"] = 2500,<br />
["IPA-sh"] = 2700,<br />
["IPA-sl"] = 6800,<br />
["IPA-th"] = 2900,<br />
["IPA_audio_link"] = 18000,<br />
["IPA_link"] = 3000,<br />
["IPAc-cmn"] = 2600,<br />
["IPAc-en"] = 45000,<br />
["IPAc-pl"] = 52000,<br />
["IPC_athlete"] = 2600,<br />
["IPSummary"] = 77000,<br />
["IP_summary"] = 77000,<br />
["IPsock"] = 13000,<br />
["IPtalk"] = 23000,<br />
["IPuser"] = 7000,<br />
["IPvandal"] = 11000,<br />
["IRC"] = 7600,<br />
["IRI"] = 2100,<br />
["IRL"] = 5400,<br />
["IRN"] = 3400,<br />
["ISBN"] = 457000,<br />
["ISBNT"] = 37000,<br />
["ISL"] = 2100,<br />
["ISO_15924/script-example-character"] = 2700,<br />
["ISO_15924/wp-article"] = 2700,<br />
["ISO_15924/wp-article/format"] = 2700,<br />
["ISO_15924/wp-article/label"] = 2600,<br />
["ISO_3166_code"] = 425000,<br />
["ISO_3166_name"] = 16000,<br />
["ISO_639_name"] = 6700,<br />
["ISP"] = 5900,<br />
["ISR"] = 4600,<br />
["ISSN"] = 11000,<br />
["ISSN_link"] = 29000,<br />
["ISTAT"] = 8100,<br />
["ISU_figure_skater"] = 2400,<br />
["ITA"] = 17000,<br />
["ITF"] = 5700,<br />
["ITF_profile"] = 8600,<br />
["ITIS"] = 4200,<br />
["ITN_talk"] = 9100,<br />
["ITN_talk/date"] = 9100,<br />
["IUCN_banner"] = 15000,<br />
["I_sup"] = 4400,<br />
["Iaaf_name"] = 7400,<br />
["Ice_hockey"] = 20000,<br />
["Ice_hockey_stats"] = 15000,<br />
["Icehockeystats"] = 11000,<br />
["Icon"] = 550000,<br />
["If"] = 254000,<br />
["If_all"] = 5700,<br />
["If_between"] = 3700,<br />
["If_both"] = 9670000,<br />
["If_empty"] = 2870000,<br />
["If_first_display_both"] = 60000,<br />
["If_in_page"] = 7300,<br />
["If_last_display_both"] = 27000,<br />
["If_preview"] = 56000,<br />
["If_then_show"] = 237000,<br />
["Ifempty"] = 3900,<br />
["Iferror_then_show"] = 2900,<br />
["Ifexist_not_redirect"] = 1070000,<br />
["Ifnotempty"] = 13000,<br />
["Ifnumber"] = 29000,<br />
["Ifsubst"] = 83000,<br />
["Ih"] = 7500,<br />
["Ill"] = 99000,<br />
["Illm"] = 6800,<br />
["Image_frame"] = 3500,<br />
["Image_label"] = 4500,<br />
["Image_label_begin"] = 3800,<br />
["Image_label_end"] = 3400,<br />
["Image_label_small"] = 2600,<br />
["Image_needed"] = 4500,<br />
["Image_other"] = 287000,<br />
["Image_requested"] = 168000,<br />
["Image_requested/Category_helper"] = 161000,<br />
["Imbox"] = 902000,<br />
["Imdb_name"] = 5300,<br />
["Imdb_title"] = 4500,<br />
["Import_style"] = 11000,<br />
["Import_style/inputbox.css"] = 11000,<br />
["Importance"] = 5470000,<br />
["Importance/colour"] = 5480000,<br />
["Importance_mask"] = 8650000,<br />
["Improve_categories"] = 6100,<br />
["In_class"] = 5200,<br />
["In_lang"] = 343000,<br />
["In_progress"] = 2800,<br />
["In_string"] = 64000,<br />
["In_title"] = 17000,<br />
["Inactive_WikiProject_banner"] = 199000,<br />
["Inactive_userpage_blanked"] = 4700,<br />
["Include-USGov"] = 30000,<br />
["Incomplete_list"] = 22000,<br />
["Increase"] = 39000,<br />
["Incumbent_pope"] = 4300,<br />
["Indent"] = 3900,<br />
["IndexFungorum"] = 2200,<br />
["Indian_English"] = 3900,<br />
["Indian_Rupee"] = 9700,<br />
["Indian_railway_code"] = 3100,<br />
["Inflation"] = 17000,<br />
["Inflation-fn"] = 5200,<br />
["Inflation-year"] = 4200,<br />
["Inflation/IN/startyear"] = 5200,<br />
["Inflation/UK"] = 4000,<br />
["Inflation/UK/dataset"] = 4000,<br />
["Inflation/UK/startyear"] = 4000,<br />
["Inflation/US"] = 11000,<br />
["Inflation/US/dataset"] = 11000,<br />
["Inflation/US/startyear"] = 11000,<br />
["Inflation/fn"] = 5800,<br />
["Inflation/year"] = 22000,<br />
["Info"] = 7100,<br />
["Infobox"] = 3500000,<br />
["Infobox/Columns"] = 2100,<br />
["Infobox/mobileviewfix.css"] = 18000,<br />
["Infobox3cols"] = 291000,<br />
["Infobox_AFL_biography"] = 14000,<br />
["Infobox_Aircraft_Begin"] = 5600,<br />
["Infobox_Aircraft_Type"] = 5000,<br />
["Infobox_Athletics_Championships"] = 2500,<br />
["Infobox_Australian_place"] = 15000,<br />
["Infobox_CFL_biography"] = 2300,<br />
["Infobox_COA_wide"] = 3000,<br />
["Infobox_Canada_electoral_district"] = 2400,<br />
["Infobox_Canadian_Football_League_biography"] = 5900,<br />
["Infobox_Canadian_Football_League_biography/position"] = 5900,<br />
["Infobox_Chinese"] = 18000,<br />
["Infobox_Chinese/Footer"] = 8800,<br />
["Infobox_Chinese/Header"] = 8800,<br />
["Infobox_Chinese/Korean"] = 15000,<br />
["Infobox_Christian_leader"] = 17000,<br />
["Infobox_Election"] = 2500,<br />
["Infobox_French_commune"] = 37000,<br />
["Infobox_GAA_player"] = 3200,<br />
["Infobox_Gaelic_Athletic_Association_player"] = 4800,<br />
["Infobox_German_location"] = 13000,<br />
["Infobox_German_place"] = 14000,<br />
["Infobox_Greece_place"] = 2800,<br />
["Infobox_Greek_Dimos"] = 2800,<br />
["Infobox_Hindu_temple"] = 2300,<br />
["Infobox_Indian_state_legislative_assembly_constituency"] = 3600,<br />
["Infobox_Italian_comune"] = 8100,<br />
["Infobox_Korean_name"] = 15000,<br />
["Infobox_Korean_name/categories"] = 14000,<br />
["Infobox_MLB_yearly"] = 3000,<br />
["Infobox_NCAA_team_season"] = 19000,<br />
["Infobox_NFL_biography"] = 27000,<br />
["Infobox_NFL_player"] = 8400,<br />
["Infobox_NFL_season"] = 2600,<br />
["Infobox_NFL_team_season"] = 3800,<br />
["Infobox_NRHP"] = 72000,<br />
["Infobox_NRHP/conv"] = 18000,<br />
["Infobox_NRHP/locmapin2region"] = 66000,<br />
["Infobox_Officeholder"] = 6000,<br />
["Infobox_Olympic_event"] = 7200,<br />
["Infobox_Olympic_event/games_text"] = 7200,<br />
["Infobox_Paralympic_event"] = 2500,<br />
["Infobox_Paralympic_event/games_text"] = 2500,<br />
["Infobox_Person"] = 2000,<br />
["Infobox_Politician"] = 2700,<br />
["Infobox_Romanian_subdivision"] = 3100,<br />
["Infobox_Russian_district"] = 2000,<br />
["Infobox_Russian_inhabited_locality"] = 4300,<br />
["Infobox_SCOTUS_case"] = 3600,<br />
["Infobox_Site_of_Special_Scientific_Interest"] = 2000,<br />
["Infobox_Swiss_town"] = 2800,<br />
["Infobox_Switzerland_municipality"] = 2900,<br />
["Infobox_U.S._county"] = 3000,<br />
["Infobox_U.S._county/district"] = 3000,<br />
["Infobox_UK_legislation"] = 2200,<br />
["Infobox_UK_place"] = 25000,<br />
["Infobox_UK_place/NoDialCode"] = 7700,<br />
["Infobox_UK_place/NoPostCode"] = 2800,<br />
["Infobox_UK_place/area"] = 2300,<br />
["Infobox_UK_place/dist"] = 2400,<br />
["Infobox_UK_place/local"] = 25000,<br />
["Infobox_UK_place/styles.css"] = 25000,<br />
["Infobox_UN_resolution"] = 2200,<br />
["Infobox_US_Supreme_Court_case"] = 3800,<br />
["Infobox_US_Supreme_Court_case/courts"] = 3700,<br />
["Infobox_Wikipedia_user"] = 9000,<br />
["Infobox_YouTube_personality"] = 2300,<br />
["Infobox_academic"] = 12000,<br />
["Infobox_aircraft_begin"] = 14000,<br />
["Infobox_aircraft_occurrence"] = 2200,<br />
["Infobox_aircraft_type"] = 13000,<br />
["Infobox_airline"] = 4500,<br />
["Infobox_airport"] = 15000,<br />
["Infobox_airport/datatable"] = 15000,<br />
["Infobox_album"] = 159000,<br />
["Infobox_album/color"] = 185000,<br />
["Infobox_album/link"] = 159000,<br />
["Infobox_anatomy"] = 4400,<br />
["Infobox_ancient_site"] = 5000,<br />
["Infobox_animanga/Footer"] = 6500,<br />
["Infobox_animanga/Header"] = 6500,<br />
["Infobox_animanga/Print"] = 5200,<br />
["Infobox_animanga/Video"] = 4500,<br />
["Infobox_architect"] = 3400,<br />
["Infobox_artist"] = 27000,<br />
["Infobox_artist_discography"] = 5800,<br />
["Infobox_artwork"] = 10000,<br />
["Infobox_athlete"] = 3200,<br />
["Infobox_automobile"] = 8100,<br />
["Infobox_award"] = 12000,<br />
["Infobox_badminton_player"] = 3100,<br />
["Infobox_baseball_biography"] = 28000,<br />
["Infobox_baseball_biography/style"] = 28000,<br />
["Infobox_baseball_biography/styles.css"] = 28000,<br />
["Infobox_basketball_biography"] = 20000,<br />
["Infobox_basketball_biography/style"] = 20000,<br />
["Infobox_basketball_club"] = 3000,<br />
["Infobox_beauty_pageant"] = 2200,<br />
["Infobox_bilateral_relations"] = 4200,<br />
["Infobox_body_of_water"] = 17000,<br />
["Infobox_book"] = 50000,<br />
["Infobox_boxer"] = 5500,<br />
["Infobox_bridge"] = 5800,<br />
["Infobox_building"] = 26000,<br />
["Infobox_character"] = 7700,<br />
["Infobox_chess_biography"] = 3400,<br />
["Infobox_chess_player"] = 2900,<br />
["Infobox_church"] = 14000,<br />
["Infobox_church/denomination"] = 14000,<br />
["Infobox_church/font_color"] = 14000,<br />
["Infobox_civil_conflict"] = 2100,<br />
["Infobox_civilian_attack"] = 4800,<br />
["Infobox_college_coach"] = 11000,<br />
["Infobox_college_sports_team_season"] = 37000,<br />
["Infobox_college_sports_team_season/link"] = 37000,<br />
["Infobox_college_sports_team_season/name"] = 37000,<br />
["Infobox_college_sports_team_season/succession"] = 37000,<br />
["Infobox_college_sports_team_season/team"] = 37000,<br />
["Infobox_comic_book_title"] = 2900,<br />
["Infobox_comics_character"] = 3600,<br />
["Infobox_comics_creator"] = 3400,<br />
["Infobox_company"] = 81000,<br />
["Infobox_concert"] = 3200,<br />
["Infobox_constituency"] = 4900,<br />
["Infobox_country"] = 6000,<br />
["Infobox_country/formernext"] = 5800,<br />
["Infobox_country/imagetable"] = 4900,<br />
["Infobox_country/multirow"] = 7900,<br />
["Infobox_country/status_text"] = 2600,<br />
["Infobox_country/styles.css"] = 6000,<br />
["Infobox_country_at_games"] = 14000,<br />
["Infobox_country_at_games/core"] = 14000,<br />
["Infobox_country_at_games/see_also"] = 11000,<br />
["Infobox_court_case"] = 4500,<br />
["Infobox_court_case/images"] = 2300,<br />
["Infobox_cricket_tournament"] = 2100,<br />
["Infobox_cricketer"] = 32000,<br />
["Infobox_cricketer/career"] = 32000,<br />
["Infobox_cricketer/national_side"] = 7600,<br />
["Infobox_criminal"] = 5700,<br />
["Infobox_curler"] = 2500,<br />
["Infobox_cycling_race_report"] = 4300,<br />
["Infobox_cyclist"] = 16000,<br />
["Infobox_dam"] = 5500,<br />
["Infobox_designation_list"] = 18000,<br />
["Infobox_designation_list/entry"] = 16000,<br />
["Infobox_dim"] = 6500,<br />
["Infobox_dim/core"] = 6500,<br />
["Infobox_diocese"] = 3800,<br />
["Infobox_drug"] = 9100,<br />
["Infobox_drug/chemical_formula"] = 9100,<br />
["Infobox_drug/data_page_link"] = 9100,<br />
["Infobox_drug/formatATC"] = 9000,<br />
["Infobox_drug/formatCASnumber"] = 9100,<br />
["Infobox_drug/formatChEBI"] = 9100,<br />
["Infobox_drug/formatChEMBL"] = 9100,<br />
["Infobox_drug/formatChemDBNIAID"] = 9100,<br />
["Infobox_drug/formatChemSpider"] = 9100,<br />
["Infobox_drug/formatCompTox"] = 9100,<br />
["Infobox_drug/formatDrugBank"] = 9100,<br />
["Infobox_drug/formatIUPHARBPS"] = 9100,<br />
["Infobox_drug/formatJmol"] = 9100,<br />
["Infobox_drug/formatKEGG"] = 9100,<br />
["Infobox_drug/formatPDBligand"] = 8500,<br />
["Infobox_drug/formatPubChemCID"] = 9100,<br />
["Infobox_drug/formatPubChemSID"] = 9100,<br />
["Infobox_drug/formatUNII"] = 9100,<br />
["Infobox_drug/legal_status"] = 9200,<br />
["Infobox_drug/licence"] = 9200,<br />
["Infobox_drug/maintenance_categories"] = 9100,<br />
["Infobox_drug/pregnancy_category"] = 9200,<br />
["Infobox_drug/title"] = 9100,<br />
["Infobox_election"] = 26000,<br />
["Infobox_election/row"] = 26000,<br />
["Infobox_election/shortname"] = 25000,<br />
["Infobox_enzyme"] = 5100,<br />
["Infobox_ethnic_group"] = 6900,<br />
["Infobox_event"] = 4700,<br />
["Infobox_figure_skater"] = 4100,<br />
["Infobox_film"] = 151000,<br />
["Infobox_film/short_description"] = 147000,<br />
["Infobox_film_awards"] = 2400,<br />
["Infobox_film_awards/link"] = 2400,<br />
["Infobox_film_awards/style"] = 2400,<br />
["Infobox_food"] = 6600,<br />
["Infobox_football_biography"] = 201000,<br />
["Infobox_football_club"] = 26000,<br />
["Infobox_football_club_season"] = 19000,<br />
["Infobox_football_league"] = 2500,<br />
["Infobox_football_league_season"] = 18000,<br />
["Infobox_football_match"] = 5500,<br />
["Infobox_football_tournament_season"] = 7000,<br />
["Infobox_former_subdivision"] = 3300,<br />
["Infobox_former_subdivision/styles.css"] = 3300,<br />
["Infobox_galaxy"] = 2000,<br />
["Infobox_game"] = 2300,<br />
["Infobox_game_score"] = 3300,<br />
["Infobox_gene"] = 13000,<br />
["Infobox_given_name"] = 3900,<br />
["Infobox_golfer"] = 4300,<br />
["Infobox_golfer/highest_ranking"] = 4300,<br />
["Infobox_government_agency"] = 9800,<br />
["Infobox_government_cabinet"] = 2300,<br />
["Infobox_gridiron_football_person"] = 2800,<br />
["Infobox_gridiron_football_person/position"] = 5900,<br />
["Infobox_gymnast"] = 3200,<br />
["Infobox_handball_biography"] = 4700,<br />
["Infobox_historic_site"] = 11000,<br />
["Infobox_horseraces"] = 2500,<br />
["Infobox_hospital"] = 6100,<br />
["Infobox_hospital/care_system"] = 6100,<br />
["Infobox_hospital/lists"] = 6100,<br />
["Infobox_ice_hockey_biography"] = 19000,<br />
["Infobox_ice_hockey_player"] = 19000,<br />
["Infobox_ice_hockey_team"] = 2800,<br />
["Infobox_ice_hockey_team_season"] = 2000,<br />
["Infobox_information_appliance"] = 2200,<br />
["Infobox_international_football_competition"] = 5400,<br />
["Infobox_islands"] = 8400,<br />
["Infobox_islands/area"] = 8800,<br />
["Infobox_islands/density"] = 8800,<br />
["Infobox_islands/length"] = 8400,<br />
["Infobox_islands/styles.css"] = 8400,<br />
["Infobox_journal"] = 9500,<br />
["Infobox_journal/Abbreviation_search"] = 9400,<br />
["Infobox_journal/Bluebook_check"] = 9200,<br />
["Infobox_journal/Former_check"] = 9200,<br />
["Infobox_journal/ISO_4_check"] = 9200,<br />
["Infobox_journal/ISSN-eISSN"] = 9300,<br />
["Infobox_journal/Indexing_search"] = 9300,<br />
["Infobox_journal/MathSciNet_check"] = 9200,<br />
["Infobox_journal/NLM_check"] = 9200,<br />
["Infobox_journal/frequency"] = 8400,<br />
["Infobox_judge"] = 2200,<br />
["Infobox_lake"] = 4500,<br />
["Infobox_language"] = 9400,<br />
["Infobox_language/family-color"] = 11000,<br />
["Infobox_language/genetic"] = 6500,<br />
["Infobox_language/linguistlist"] = 9400,<br />
["Infobox_language/ref"] = 6900,<br />
["Infobox_legislature"] = 3500,<br />
["Infobox_library"] = 2000,<br />
["Infobox_lighthouse"] = 2600,<br />
["Infobox_lighthouse/light"] = 2600,<br />
["Infobox_locomotive"] = 4800,<br />
["Infobox_magazine"] = 7300,<br />
["Infobox_manner_of_address"] = 3200,<br />
["Infobox_mapframe"] = 76000,<br />
["Infobox_martial_artist"] = 5500,<br />
["Infobox_martial_artist/record"] = 5500,<br />
["Infobox_medal_templates"] = 410000,<br />
["Infobox_medical_condition"] = 9800,<br />
["Infobox_medical_condition_(new)"] = 8200,<br />
["Infobox_military_conflict"] = 20000,<br />
["Infobox_military_installation"] = 9300,<br />
["Infobox_military_person"] = 43000,<br />
["Infobox_military_unit"] = 25000,<br />
["Infobox_mine"] = 2100,<br />
["Infobox_model"] = 2300,<br />
["Infobox_mountain"] = 27000,<br />
["Infobox_multi-sport_competition_event"] = 2000,<br />
["Infobox_museum"] = 9700,<br />
["Infobox_musical_artist"] = 118000,<br />
["Infobox_musical_artist/color"] = 119000,<br />
["Infobox_musical_artist/hCard_class"] = 304000,<br />
["Infobox_musical_composition"] = 2700,<br />
["Infobox_name"] = 7200,<br />
["Infobox_name_module"] = 11000,<br />
["Infobox_newspaper"] = 9300,<br />
["Infobox_nobility"] = 2400,<br />
["Infobox_noble"] = 6800,<br />
["Infobox_officeholder"] = 200000,<br />
["Infobox_officeholder/office"] = 205000,<br />
["Infobox_official_post"] = 7400,<br />
["Infobox_organization"] = 34000,<br />
["Infobox_pageant_titleholder"] = 2800,<br />
["Infobox_park"] = 7000,<br />
["Infobox_person"] = 445000,<br />
["Infobox_person/Wikidata"] = 4600,<br />
["Infobox_person/height"] = 111000,<br />
["Infobox_person/length"] = 6900,<br />
["Infobox_person/weight"] = 75000,<br />
["Infobox_philosopher"] = 3200,<br />
["Infobox_planet"] = 4600,<br />
["Infobox_play"] = 3600,<br />
["Infobox_political_party"] = 13000,<br />
["Infobox_power_station"] = 2900,<br />
["Infobox_prepared_food"] = 3400,<br />
["Infobox_professional_wrestler"] = 4100,<br />
["Infobox_professional_wrestling_event"] = 2500,<br />
["Infobox_protected_area"] = 14000,<br />
["Infobox_protein_family"] = 2100,<br />
["Infobox_publisher"] = 2300,<br />
["Infobox_racehorse"] = 5400,<br />
["Infobox_racing_driver"] = 3400,<br />
["Infobox_radio_station"] = 22000,<br />
["Infobox_rail"] = 2800,<br />
["Infobox_rail_line"] = 6900,<br />
["Infobox_rail_line/tracking"] = 6900,<br />
["Infobox_rail_service"] = 2800,<br />
["Infobox_rail_service/doc"] = 2800,<br />
["Infobox_reality_competition_season"] = 3100,<br />
["Infobox_record_label"] = 4000,<br />
["Infobox_recurring_event"] = 6100,<br />
["Infobox_religious_biography"] = 4800,<br />
["Infobox_religious_building"] = 11000,<br />
["Infobox_religious_building/color"] = 16000,<br />
["Infobox_restaurant"] = 2100,<br />
["Infobox_river"] = 29000,<br />
["Infobox_river/calcunit"] = 29000,<br />
["Infobox_river/discharge"] = 29000,<br />
["Infobox_river/row-style"] = 29000,<br />
["Infobox_river/source"] = 29000,<br />
["Infobox_road"] = 24000,<br />
["Infobox_road/meta/mask/category"] = 24000,<br />
["Infobox_road/meta/mask/country"] = 24000,<br />
["Infobox_road/styles.css"] = 25000,<br />
["Infobox_road_small"] = 2200,<br />
["Infobox_rockunit"] = 6400,<br />
["Infobox_royalty"] = 20000,<br />
["Infobox_royalty/short_description"] = 13000,<br />
["Infobox_rugby_biography"] = 15000,<br />
["Infobox_rugby_biography/correct_date"] = 15000,<br />
["Infobox_rugby_biography/depcheck"] = 6700,<br />
["Infobox_rugby_league_biography"] = 9600,<br />
["Infobox_rugby_league_biography/PLAYER"] = 9500,<br />
["Infobox_rugby_team"] = 2600,<br />
["Infobox_sailboat_specifications"] = 2000,<br />
["Infobox_saint"] = 4800,<br />
["Infobox_school"] = 38000,<br />
["Infobox_school/short_description"] = 38000,<br />
["Infobox_school_district"] = 5600,<br />
["Infobox_school_district/styles.css"] = 5600,<br />
["Infobox_scientist"] = 45000,<br />
["Infobox_service_record"] = 2600,<br />
["Infobox_settlement"] = 547000,<br />
["Infobox_settlement/areadisp"] = 229000,<br />
["Infobox_settlement/columns"] = 91000,<br />
["Infobox_settlement/columns/styles.css"] = 91000,<br />
["Infobox_settlement/densdisp"] = 416000,<br />
["Infobox_settlement/impus"] = 80000,<br />
["Infobox_settlement/lengthdisp"] = 166000,<br />
["Infobox_settlement/link"] = 91000,<br />
["Infobox_settlement/metric"] = 204000,<br />
["Infobox_settlement/pref"] = 284000,<br />
["Infobox_settlement/styles.css"] = 547000,<br />
["Infobox_ship_begin"] = 40000,<br />
["Infobox_ship_career"] = 36000,<br />
["Infobox_ship_characteristics"] = 40000,<br />
["Infobox_ship_class_overview"] = 4000,<br />
["Infobox_ship_image"] = 39000,<br />
["Infobox_shopping_mall"] = 3400,<br />
["Infobox_short_story"] = 2200,<br />
["Infobox_skier"] = 2500,<br />
["Infobox_soap_character"] = 2900,<br />
["Infobox_software"] = 14000,<br />
["Infobox_software/simple"] = 14000,<br />
["Infobox_song"] = 73000,<br />
["Infobox_song/color"] = 73000,<br />
["Infobox_song/link"] = 73000,<br />
["Infobox_spaceflight"] = 3500,<br />
["Infobox_spaceflight/styles.css"] = 3500,<br />
["Infobox_sports_competition_event"] = 14000,<br />
["Infobox_sports_competition_event/medalrow"] = 9700,<br />
["Infobox_sports_league"] = 4800,<br />
["Infobox_sports_season"] = 4800,<br />
["Infobox_sports_team"] = 2300,<br />
["Infobox_sportsperson"] = 104000,<br />
["Infobox_stadium"] = 3800,<br />
["Infobox_station"] = 54000,<br />
["Infobox_station/doc"] = 54000,<br />
["Infobox_station/services"] = 54000,<br />
["Infobox_station/styles.css"] = 54000,<br />
["Infobox_street"] = 3200,<br />
["Infobox_swimmer"] = 9300,<br />
["Infobox_television"] = 54000,<br />
["Infobox_television_channel"] = 6200,<br />
["Infobox_television_episode"] = 11000,<br />
["Infobox_television_episode/styles.css"] = 11000,<br />
["Infobox_television_season"] = 8900,<br />
["Infobox_television_station"] = 3700,<br />
["Infobox_tennis_biography"] = 9600,<br />
["Infobox_tennis_event"] = 2200,<br />
["Infobox_tennis_tournament_event"] = 17000,<br />
["Infobox_tennis_tournament_year"] = 8600,<br />
["Infobox_tennis_tournament_year/color"] = 26000,<br />
["Infobox_tennis_tournament_year/footer"] = 26000,<br />
["Infobox_train"] = 2200,<br />
["Infobox_tropical_cyclone"] = 2200,<br />
["Infobox_union"] = 2200,<br />
["Infobox_university"] = 26000,<br />
["Infobox_user"] = 2600,<br />
["Infobox_venue"] = 17000,<br />
["Infobox_video_game"] = 27000,<br />
["Infobox_volleyball_biography"] = 5100,<br />
["Infobox_weapon"] = 7100,<br />
["Infobox_website"] = 7600,<br />
["Infobox_writer"] = 36000,<br />
["Information"] = 108000,<br />
["Information/styles.css"] = 108000,<br />
["Inprogress"] = 2100,<br />
["Input_link"] = 32000,<br />
["Instagram"] = 9100,<br />
["Interlanguage_link"] = 135000,<br />
["Interlanguage_link_multi"] = 20000,<br />
["Internet_Archive_author"] = 18000,<br />
["Internet_Archive_film"] = 2400,<br />
["Intitle"] = 11000,<br />
["Invalid_SVG"] = 3800,<br />
["Invalid_SVG/styles.css"] = 3800,<br />
["Ipsock"] = 11000,<br />
["Iptalk"] = 21000,<br />
["IranCensus2006"] = 54000,<br />
["IranNCSGN"] = 3200,<br />
["Iran_Census_2006"] = 54000,<br />
["Irc"] = 2100,<br />
["Irish_place_name"] = 2500,<br />
["IsValidPageName"] = 128000,<br />
["Is_country_in_Central_America"] = 13000,<br />
["Is_country_in_the_Caribbean"] = 13000,<br />
["Is_interwiki_link"] = 6000,<br />
["Is_italic_taxon"] = 433000,<br />
["Is_redirect"] = 24000,<br />
["Isbn"] = 6200,<br />
["Isfdb_name"] = 3900,<br />
["Isfdb_title"] = 4400,<br />
["Isnumeric"] = 196000,<br />
["Iso2continent"] = 29000,<br />
["Iso2country"] = 22000,<br />
["Iso2country/article"] = 22000,<br />
["Iso2country/data"] = 22000,<br />
["Iso2nationality"] = 161000,<br />
["Issubst"] = 76000,<br />
["Isu_name"] = 2300,<br />
["Italic_dab2"] = 5000,<br />
["Italic_title"] = 757000,<br />
["Italic_title_prefixed"] = 8600,<br />
["Italics_colon"] = 3200,<br />
["Italictitle"] = 4500,<br />
["Ivm"] = 5800,<br />
["Ivm/styles.css"] = 5800,<br />
["Ivmbox"] = 119000,<br />
["Ivory_messagebox"] = 130000,<br />
["Module:I18n/complex_date"] = 60000,<br />
["Module:IP"] = 110000,<br />
["Module:IPA_symbol"] = 4200,<br />
["Module:IPA_symbol/data"] = 4200,<br />
["Module:IPAc-en"] = 45000,<br />
["Module:IPAc-en/data"] = 45000,<br />
["Module:IPAc-en/phonemes"] = 45000,<br />
["Module:IPAc-en/pronunciation"] = 45000,<br />
["Module:IPAddress"] = 131000,<br />
["Module:ISO_3166"] = 912000,<br />
["Module:ISO_3166/data/AT"] = 2500,<br />
["Module:ISO_3166/data/BA"] = 3400,<br />
["Module:ISO_3166/data/CA"] = 2600,<br />
["Module:ISO_3166/data/DE"] = 14000,<br />
["Module:ISO_3166/data/ES"] = 3500,<br />
["Module:ISO_3166/data/FR"] = 38000,<br />
["Module:ISO_3166/data/GB"] = 6300,<br />
["Module:ISO_3166/data/GR"] = 3000,<br />
["Module:ISO_3166/data/IN"] = 28000,<br />
["Module:ISO_3166/data/National"] = 912000,<br />
["Module:ISO_3166/data/RS"] = 3200,<br />
["Module:ISO_3166/data/RU"] = 24000,<br />
["Module:ISO_3166/data/TR"] = 2400,<br />
["Module:ISO_3166/data/US"] = 83000,<br />
["Module:ISO_639_name"] = 14000,<br />
["Module:ISOdate"] = 60000,<br />
["Module:Icon"] = 550000,<br />
["Module:Icon/data"] = 550000,<br />
["Module:If_empty"] = 2870000,<br />
["Module:If_in_page"] = 7300,<br />
["Module:If_preview"] = 453000,<br />
["Module:If_preview/configuration"] = 453000,<br />
["Module:If_preview/styles.css"] = 453000,<br />
["Module:Import_style"] = 11000,<br />
["Module:In_lang"] = 343000,<br />
["Module:Indent"] = 3900,<br />
["Module:Infobox"] = 3930000,<br />
["Module:Infobox/dates"] = 63000,<br />
["Module:Infobox/styles.css"] = 4180000,<br />
["Module:Infobox3cols"] = 291000,<br />
["Module:InfoboxImage"] = 4220000,<br />
["Module:Infobox_body_of_water_tracking"] = 17000,<br />
["Module:Infobox_cyclist_tracking"] = 16000,<br />
["Module:Infobox_gene"] = 13000,<br />
["Module:Infobox_mapframe"] = 366000,<br />
["Module:Infobox_military_conflict"] = 20000,<br />
["Module:Infobox_military_conflict/styles.css"] = 20000,<br />
["Module:Infobox_multi-lingual_name"] = 18000,<br />
["Module:Infobox_multi-lingual_name/data"] = 18000,<br />
["Module:Infobox_power_station"] = 2900,<br />
["Module:Infobox_road"] = 25000,<br />
["Module:Infobox_road/browselinks"] = 25000,<br />
["Module:Infobox_road/errors"] = 24000,<br />
["Module:Infobox_road/length"] = 25000,<br />
["Module:Infobox_road/locations"] = 24000,<br />
["Module:Infobox_road/map"] = 25000,<br />
["Module:Infobox_road/route"] = 25000,<br />
["Module:Infobox_road/sections"] = 24000,<br />
["Module:Infobox_television"] = 54000,<br />
["Module:Infobox_television_disambiguation_check"] = 61000,<br />
["Module:Infobox_television_episode"] = 11000,<br />
["Module:Infobox_television_season_disambiguation_check"] = 8500,<br />
["Module:Infobox_television_season_name"] = 8900,<br />
["Module:Internet_Archive"] = 18000,<br />
["Module:IrelandByCountyCatNav"] = 2500,<br />
["Module:Is_infobox_in_lead"] = 370000,<br />
["Module:Is_instance"] = 8000,<br />
["Module:Italic_title"] = 1080000,<br />
["Module:Italic_title2"] = 5000,<br />
}</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Category_link_with_count&diff=588Template:Category link with count2022-10-01T05:27:29Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>[[:Category:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}|<!--<br />
-->{{#if:{{{name|}}}|{{{name}}}|Category:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}}}<!--<br />
-->]]&nbsp;({{PAGESINCATEGORY:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}|{{{2|all}}}}})<noinclude><br />
{{Documentation}}<br />
</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Parameter_names_example&diff=586Template:Parameter names example2022-10-01T05:27:28Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div><includeonly>{{#invoke:Parameter names example|main}}</includeonly><noinclude><br />
{{Documentation}}<br />
</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Lua&diff=584Template:Lua2022-10-01T05:27:28Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div><includeonly>{{#invoke:Lua banner|main}}</includeonly><noinclude><br />
{{Lua|Module:Lua banner}}<br />
{{documentation}}<br />
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. --><br />
</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Parameter_names_example&diff=582Module:Parameter names example2022-10-01T05:27:28Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>-- This module implements {{parameter names example}}.<br />
<br />
local p = {}<br />
<br />
local function makeParam(s)<br />
local lb = '&#123;'<br />
local rb = '&#125;'<br />
return lb:rep(3) .. s .. rb:rep(3)<br />
end<br />
<br />
local function italicize(s)<br />
return "''" .. s .. "''"<br />
end<br />
<br />
local function plain(s)<br />
return s<br />
end<br />
<br />
function p._main(args, frame)<br />
-- Find how we want to format the arguments to the template.<br />
local formatFunc<br />
if args._display == 'italics' or args._display == 'italic' then<br />
formatFunc = italicize<br />
elseif args._display == 'plain' then<br />
formatFunc = plain<br />
else<br />
formatFunc = makeParam<br />
end<br />
<br />
-- Build the table of template arguments.<br />
local targs = {}<br />
for k, v in pairs(args) do<br />
if type(k) == 'number' then<br />
targs[v] = formatFunc(v)<br />
elseif not k:find('^_') then<br />
targs[k] = v<br />
end<br />
end<br />
targs['nocat'] = 'yes';<br />
targs['categories'] = 'no';<br />
targs['demo'] = 'yes';<br />
<br />
-- Find the template name.<br />
local template<br />
if args._template then<br />
template = args._template<br />
else<br />
local currentTitle = mw.title.getCurrentTitle()<br />
if currentTitle.prefixedText:find('/sandbox$') then<br />
template = currentTitle.prefixedText<br />
else<br />
template = currentTitle.basePageTitle.prefixedText<br />
end<br />
end<br />
<br />
-- Call the template with the arguments.<br />
frame = frame or mw.getCurrentFrame()<br />
local success, result = pcall(<br />
frame.expandTemplate,<br />
frame,<br />
{title = template, args = targs}<br />
)<br />
if success then<br />
return result<br />
else<br />
return ''<br />
end<br />
end<br />
<br />
function p.main(frame)<br />
local args = require('Module:Arguments').getArgs(frame, {<br />
wrappers = 'Template:Parameter names example'<br />
})<br />
return p._main(args, frame)<br />
end<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Lua_banner&diff=580Module:Lua banner2022-10-01T05:27:28Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>-- This module implements the {{lua}} template.<br />
local yesno = require('Module:Yesno')<br />
local mList = require('Module:List')<br />
local mTableTools = require('Module:TableTools')<br />
local mMessageBox = require('Module:Message box')<br />
<br />
local p = {}<br />
<br />
function p.main(frame)<br />
local origArgs = frame:getParent().args<br />
local args = {}<br />
for k, v in pairs(origArgs) do<br />
v = v:match('^%s*(.-)%s*$')<br />
if v ~= '' then<br />
args[k] = v<br />
end<br />
end<br />
return p._main(args)<br />
end<br />
<br />
function p._main(args)<br />
local modules = mTableTools.compressSparseArray(args)<br />
local box = p.renderBox(modules)<br />
local trackingCategories = p.renderTrackingCategories(args, modules)<br />
return box .. trackingCategories<br />
end<br />
<br />
function p.renderBox(modules)<br />
local boxArgs = {}<br />
if #modules < 1 then<br />
boxArgs.text = '<strong class="error">Error: no modules specified</strong>'<br />
else<br />
local moduleLinks = {}<br />
for i, module in ipairs(modules) do<br />
moduleLinks[i] = string.format('[[:%s]]', module)<br />
local maybeSandbox = mw.title.new(module .. '/sandbox')<br />
if maybeSandbox.exists then<br />
moduleLinks[i] = moduleLinks[i] .. string.format(' ([[:%s|sandbox]])', maybeSandbox.fullText)<br />
end<br />
end<br />
local moduleList = mList.makeList('bulleted', moduleLinks)<br />
local title = mw.title.getCurrentTitle()<br />
if title.subpageText == "doc" then<br />
title = title.basePageTitle<br />
end<br />
if title.contentModel == "Scribunto" then<br />
boxArgs.text = 'This module depends on the following other modules:' .. moduleList<br />
else<br />
boxArgs.text = 'This template uses [[Wikipedia:Lua|Lua]]:\n' .. moduleList<br />
end<br />
end<br />
boxArgs.type = 'notice'<br />
boxArgs.small = true<br />
boxArgs.image = '[[File:Lua-Logo.svg|30px|alt=|link=]]'<br />
return mMessageBox.main('mbox', boxArgs)<br />
end<br />
<br />
function p.renderTrackingCategories(args, modules, titleObj)<br />
if yesno(args.nocat) then<br />
return ''<br />
end<br />
<br />
local cats = {}<br />
<br />
-- Error category<br />
if #modules < 1 then<br />
cats[#cats + 1] = 'Lua templates with errors'<br />
end<br />
<br />
-- Lua templates category<br />
titleObj = titleObj or mw.title.getCurrentTitle()<br />
local subpageBlacklist = {<br />
doc = true,<br />
sandbox = true,<br />
sandbox2 = true,<br />
testcases = true<br />
}<br />
if not subpageBlacklist[titleObj.subpageText] then<br />
local protCatName<br />
if titleObj.namespace == 10 then<br />
local category = args.category<br />
if not category then<br />
local categories = {<br />
['Module:String'] = 'Templates based on the String Lua module',<br />
['Module:Math'] = 'Templates based on the Math Lua module',<br />
['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module',<br />
['Module:Citation'] = 'Templates based on the Citation/CS1 Lua module'<br />
}<br />
categories['Module:Citation/CS1'] = categories['Module:Citation']<br />
category = modules[1] and categories[modules[1]]<br />
category = category or 'Lua-based templates'<br />
end <br />
cats[#cats + 1] = category<br />
protCatName = "Templates using under-protected Lua modules"<br />
elseif titleObj.namespace == 828 then<br />
protCatName = "Modules depending on under-protected modules"<br />
end<br />
if not args.noprotcat and protCatName then<br />
local protLevels = {<br />
autoconfirmed = 1,<br />
extendedconfirmed = 2,<br />
templateeditor = 3,<br />
sysop = 4<br />
}<br />
local currentProt<br />
if titleObj.id ~= 0 then<br />
-- id is 0 (page does not exist) if am previewing before creating a template.<br />
currentProt = titleObj.protectionLevels["edit"][1]<br />
end<br />
if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end<br />
for i, module in ipairs(modules) do<br />
if module ~= "WP:libraryUtil" then<br />
local moduleProt = mw.title.new(module).protectionLevels["edit"][1]<br />
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end<br />
if moduleProt < currentProt then<br />
cats[#cats + 1] = protCatName<br />
break<br />
end<br />
end<br />
end<br />
end<br />
end<br />
for i, cat in ipairs(cats) do<br />
cats[i] = string.format('[[Category:%s]]', cat)<br />
end<br />
return table.concat(cats)<br />
end<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Transclusion_count&diff=578Module:Transclusion count2022-10-01T05:27:28Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>local p = {}<br />
<br />
function p.fetch(frame)<br />
local template = nil<br />
local return_value = nil<br />
<br />
-- Use demo parameter if it exists, otherswise use current template name<br />
local namespace = mw.title.getCurrentTitle().namespace<br />
if frame.args["demo"] and frame.args["demo"] ~= "" then<br />
template = frame.args["demo"]<br />
elseif namespace == 10 then -- Template namespace<br />
template = mw.title.getCurrentTitle().text<br />
elseif namespace == 828 then -- Module namespace<br />
template = (mw.site.namespaces[828].name .. ":" .. mw.title.getCurrentTitle().text)<br />
end<br />
<br />
-- If in template or module namespace, look up count in /data<br />
if template ~= nil then<br />
namespace = mw.title.new(template, "Template").namespace<br />
if namespace == 10 or namespace == 828 then<br />
template = mw.ustring.gsub(template, "/doc$", "") -- strip /doc from end<br />
local index = mw.ustring.sub(mw.title.new(template).text,1,1)<br />
local status, data = pcall(function () <br />
return(mw.loadData('Module:Transclusion_count/data/' .. (mw.ustring.find(index, "%a") and index or "other"))) <br />
end)<br />
if status then<br />
return_value = tonumber(data[mw.ustring.gsub(template, " ", "_")])<br />
end<br />
end<br />
end<br />
<br />
-- If database value doesn't exist, use value passed to template<br />
if return_value == nil and frame.args[1] ~= nil then<br />
local arg1=mw.ustring.match(frame.args[1], '[%d,]+')<br />
if arg1 and arg1 ~= '' then<br />
return_value = tonumber(frame:callParserFunction('formatnum', arg1, 'R'))<br />
end<br />
end<br />
<br />
return return_value <br />
end<br />
<br />
-- Tabulate this data for [[Wikipedia:Database reports/Templates transcluded on the most pages]]<br />
function p.tabulate(frame)<br />
local list = {}<br />
for i = 65, 91 do<br />
local data = mw.loadData('Module:Transclusion count/data/' .. ((i == 91) and 'other' or string.char(i)))<br />
for name, count in pairs(data) do<br />
table.insert(list, {mw.title.new(name, "Template").fullText, count}) <br />
end<br />
end<br />
table.sort(list, function(a, b)<br />
return (a[2] == b[2]) and (a[1] < b[1]) or (a[2] > b[2])<br />
end)<br />
local lang = mw.getContentLanguage();<br />
for i = 1, #list do<br />
list[i] = ('|-\n| %d || [[%s]] || %s\n'):format(i, list[i][1]:gsub('_', ' '), lang:formatNum(list[i][2]))<br />
end<br />
return table.concat(list)<br />
end<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:High-use&diff=576Module:High-use2022-10-01T05:27:28Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>local p = {}<br />
<br />
-- _fetch looks at the "demo" argument.<br />
local _fetch = require('Module:Transclusion_count').fetch<br />
local yesno = require('Module:Yesno')<br />
<br />
function p.num(frame, count)<br />
if count == nil then<br />
if yesno(frame.args['fetch']) == false then<br />
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end<br />
else<br />
count = _fetch(frame)<br />
end<br />
end<br />
<br />
-- Build output string<br />
local return_value = ""<br />
if count == nil then<br />
if frame.args[1] == "risk" then<br />
return_value = "a very large number of"<br />
else<br />
return_value = "many"<br />
end<br />
else<br />
-- Use 2 significant figures for smaller numbers and 3 for larger ones<br />
local sigfig = 2<br />
if count >= 100000 then<br />
sigfig = 3<br />
end<br />
<br />
-- Prepare to round to appropriate number of sigfigs<br />
local f = math.floor(math.log10(count)) - sigfig + 1<br />
<br />
-- Round and insert "approximately" or "+" when appropriate<br />
if (frame.args[2] == "yes") or (mw.ustring.sub(frame.args[1],-1) == "+") then<br />
-- Round down<br />
return_value = string.format("%s+", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) ) * (10^(f))) )<br />
else<br />
-- Round to nearest<br />
return_value = string.format("approximately&#x20;%s", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) + 0.5) * (10^(f))) )<br />
end<br />
<br />
-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes<br />
if count and count > 250000 and not yesno (frame:getParent().args['no-percent']) then<br />
local percent = math.floor( ( (count/frame:callParserFunction('NUMBEROFPAGES', 'R') ) * 100) + 0.5)<br />
if percent >= 1 then<br />
return_value = string.format("%s&#x20;pages, or roughly %s%% of all", return_value, percent)<br />
end<br />
end <br />
end<br />
<br />
return return_value<br />
end<br />
-- Actions if there is a large (greater than or equal to 100,000) transclusion count<br />
function p.risk(frame)<br />
local return_value = ""<br />
if frame.args[1] == "risk" then<br />
return_value = "risk"<br />
else<br />
local count = _fetch(frame)<br />
if count and count >= 100000 then return_value = "risk" end<br />
end<br />
return return_value<br />
end<br />
<br />
function p.text(frame, count)<br />
-- Only show the information about how this template gets updated if someone<br />
-- is actually editing the page and maybe trying to update the count.<br />
local bot_text = (frame:preprocess("{{REVISIONID}}") == "") and "\n\n----\n'''Preview message''': Transclusion count updated automatically ([[Template:High-use/doc#Technical details|see documentation]])." or ''<br />
<br />
if count == nil then<br />
if yesno(frame.args['fetch']) == false then<br />
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end<br />
else<br />
count = _fetch(frame)<br />
end<br />
end<br />
local title = mw.title.getCurrentTitle()<br />
if title.subpageText == "doc" or title.subpageText == "sandbox" then<br />
title = title.basePageTitle<br />
end<br />
<br />
local systemMessages = frame.args['system']<br />
if frame.args['system'] == '' then<br />
systemMessages = nil<br />
end<br />
<br />
-- This retrieves the project URL automatically to simplify localiation.<br />
local templateCount = ('on [https://linkcount.toolforge.org/index.php?project=%s&page=%s %s pages]'):format(<br />
mw.title.getCurrentTitle():fullUrl():gsub('//(.-)/.*', '%1'),<br />
mw.uri.encode(title.fullText), p.num(frame, count))<br />
local used_on_text = "'''This " .. (mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template") .. ' is used ';<br />
if systemMessages then<br />
used_on_text = used_on_text .. systemMessages ..<br />
((count and count > 2000) and ("''', and " .. templateCount) or ("'''"))<br />
else<br />
used_on_text = used_on_text .. templateCount .. "'''"<br />
end<br />
<br />
<br />
local sandbox_text = ("%s's [[%s/sandbox|/sandbox]] or [[%s/testcases|/testcases]] subpages, or in your own [[%s]]. "):format(<br />
(mw.title.getCurrentTitle().namespace == 828 and "module" or "template"),<br />
title.fullText, title.fullText,<br />
mw.title.getCurrentTitle().namespace == 828 and "Module:Sandbox|module sandbox" or "Wikipedia:User pages#SUB|user subpage"<br />
)<br />
<br />
local infoArg = frame.args["info"] ~= "" and frame.args["info"]<br />
if (systemMessages or frame.args[1] == "risk" or (count and count >= 100000) ) then<br />
local info = systemMessages and '.<br/>Changes to it can cause immediate changes to the Wikipedia user interface.' or '.'<br />
if infoArg then<br />
info = info .. "<br />" .. infoArg<br />
end<br />
sandbox_text = info .. '<br /> To avoid major disruption' ..<br />
(count and count >= 100000 and ' and server load' or '') ..<br />
', any changes should be tested in the ' .. sandbox_text ..<br />
'The tested changes can be added to this page in a single edit. '<br />
else<br />
sandbox_text = (infoArg and ('.<br />' .. infoArg .. ' C') or ' and c') ..<br />
'hanges may be widely noticed. Test changes in the ' .. sandbox_text<br />
end<br />
<br />
<br />
local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes '<br />
if frame.args["2"] and frame.args["2"] ~= "" and frame.args["2"] ~= "yes" then<br />
discussion_text = string.format("%sat [[%s]]", discussion_text, frame.args["2"])<br />
else<br />
discussion_text = string.format("%son the [[%s|talk page]]", discussion_text, title.talkPageTitle.fullText )<br />
end<br />
<br />
return used_on_text .. sandbox_text .. discussion_text .. " before implementing them." .. bot_text<br />
end<br />
<br />
function p.main(frame)<br />
local count = nil<br />
if yesno(frame.args['fetch']) == false then<br />
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end<br />
else<br />
count = _fetch(frame)<br />
end<br />
local image = "[[File:Ambox warning yellow.svg|40px|alt=Warning|link=]]"<br />
local type_param = "style"<br />
local epilogue = ''<br />
if frame.args['system'] and frame.args['system'] ~= '' then<br />
image = "[[File:Ambox important.svg|40px|alt=Warning|link=]]"<br />
type_param = "content"<br />
local nocat = frame:getParent().args['nocat'] or frame.args['nocat']<br />
local categorise = (nocat == '' or not yesno(nocat))<br />
if categorise then<br />
epilogue = frame:preprocess('{{Sandbox other||{{#switch:{{#invoke:Effective protection level|{{#switch:{{NAMESPACE}}|File=upload|#default=edit}}|{{FULLPAGENAME}}}}|sysop|templateeditor|interfaceadmin=|#default=[[Category:Pages used in system messages needing protection]]}}}}')<br />
end<br />
elseif (frame.args[1] == "risk" or (count and count >= 100000)) then<br />
image = "[[File:Ambox warning orange.svg|40px|alt=Warning|link=]]"<br />
type_param = "content"<br />
end<br />
<br />
if frame.args["form"] == "editnotice" then<br />
return frame:expandTemplate{<br />
title = 'editnotice',<br />
args = {<br />
["image"] = image,<br />
["text"] = p.text(frame, count),<br />
["expiry"] = (frame.args["expiry"] or "")<br />
}<br />
} .. epilogue<br />
else<br />
return require('Module:Message box').main('ombox', {<br />
type = type_param,<br />
image = image,<br />
text = p.text(frame, count),<br />
expiry = (frame.args["expiry"] or "")<br />
}) .. epilogue<br />
end<br />
end<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Template_parameter_usage&diff=574Template:Template parameter usage2022-10-01T05:27:28Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>{{#switch:{{{label|}}}<br />
|=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{#ifeq:{{yesno-no|{{{lc}}}}}|no|C|c}}lick here] to see a monthly parameter usage report for {{#if:{{{1|}}}|[[Template:{{ROOTPAGENAME:{{{1|}}}}}]]|this template}}{{#ifeq:{{yesno-no|{{{based}}}}}|yes|&#32;based on {{#if:{{{1|}}}|its|this}} TemplateData}}.<br />
|None|none=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{#ifeq:{{yesno-no|{{{lc}}}}}|no|P|p}}arameter usage report]{{#ifeq:{{yesno-no|{{{based}}}}}|yes|&#32;based on {{#if:{{{1|}}}|its|this}} TemplateData}}<br />
|for|For=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{#ifeq:{{yesno-no|{{{lc}}}}}|no|P|p}}arameter usage report] for {{#if:{{{1|}}}|[[Template:{{ROOTPAGENAME:{{{1|}}}}}]]|[[Template:{{ROOTPAGENAME}}]]}}{{#ifeq:{{yesno-no|{{{based}}}}}|yes|&#32;based on {{#if:{{{1|}}}|its|this}} TemplateData}}.<br />
|#default=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{{label|}}}]{{#ifeq:{{yesno-no|{{{based}}}}}|yes|&#32;based on {{#if:{{{1|}}}|its|this}} TemplateData}}<br />
}}<noinclude><br />
{{documentation}}<br />
</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:TemplateData_header&diff=572Template:TemplateData header2022-10-01T05:27:28Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div><div class="templatedata-header">{{#if:{{{noheader|}}}|<!--<br />
noheader:<br />
-->{{Template parameter usage|based=y}}|<!--<br />
+header:<br />
-->This is the {{#if:{{{nolink|}}}|<!--<br />
+header, nolink TD<br />
-->TemplateData|<!--<br />
+header, +link [[TD]]; DEFAULT:<br />
-->[[Wikipedia:TemplateData|TemplateData]]}}<!--<br />
e.o. #if:nolink; DEFAULT:<br />
--> for this template used by [[mw:Extension:TemplateWizard|TemplateWizard]], [[Wikipedia:VisualEditor|VisualEditor]] and other tools. {{Template parameter usage|based=y}}<!--<br />
e.o. #if:noheader<br />
-->}}<br />
<br />
'''TemplateData for {{{1|{{BASEPAGENAME}}}}}'''<br />
</div><includeonly><!--<br />
<br />
check parameters<br />
-->{{#invoke:Check for unknown parameters|check<br />
|unknown={{template other|1=[[Category:Pages using TemplateData header with unknown parameters|_VALUE_]]}}<br />
|template=Template:TemplateData header<br />
|1 |nolink |noheader<br />
|preview=<div class="error" style="font-weight:normal">Unknown parameter '_VALUE_' in [[Template:TemplateData header]].</div><br />
}}<!--<br />
-->{{template other|{{sandbox other||<br />
[[Category:Templates using TemplateData]]<br />
<br />
}}}}</includeonly><!--<br />
<br />
--><noinclude>{{Documentation}}</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:High-use&diff=570Template:High-use2022-10-01T05:27:28Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>{{#invoke:High-use|main|1={{{1|}}}|2={{{2|}}}|info={{{info|}}}|demo={{{demo|}}}|form={{{form|}}}|expiry={{{expiry|}}}|system={{{system|}}}}}<noinclude><br />
{{Documentation}}<br />
<!-- Add categories to the /doc subpage; interwiki links go to Wikidata, thank you! --><br />
</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Tlf&diff=568Template:Tlf2022-10-01T05:27:28Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>#REDIRECT [[Template:Template link with link off]]<br />
<br />
{{Redirect category shell|<br />
{{R from move}}<br />
}}</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Template_link_with_link_off&diff=566Template:Template link with link off2022-10-01T05:27:28Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div><includeonly>{{#Invoke:Template link general|main|nowrap=yes|nolink=yes}}</includeonly><noinclude><br />
{{Documentation|1=Template:Tlg/doc<br />
|content = {{tlg/doc|tlf}}<br />
}}<br />
<!-- Add categories to the /doc subpage, not here! --><br />
</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Documentation_subpage&diff=564Template:Documentation subpage2022-10-01T05:27:27Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div><includeonly><!--<br />
-->{{#ifeq:{{lc:{{SUBPAGENAME}}}} |{{{override|doc}}}<br />
| <!--(this template has been transcluded on a /doc or /{{{override}}} page)--><br />
</includeonly><!--<br />
<br />
-->{{#ifeq:{{{doc-notice|show}}} |show<br />
| {{Mbox<br />
| type = notice<br />
| style = margin-bottom:1.0em;<br />
| image = [[File:Edit-copy green.svg|40px|alt=|link=]]<br />
| text =<br />
{{strong|This is a [[Wikipedia:Template documentation|documentation]] [[Wikipedia:Subpages|subpage]]}} for {{terminate sentence|{{{1|[[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]}}}}}<br />It contains usage information, [[Wikipedia:Categorization|categories]] and other content that is not part of the original {{#if:{{{text2|}}} |{{{text2}}} |{{#if:{{{text1|}}} |{{{text1}}} |{{#ifeq:{{SUBJECTSPACE}} |{{ns:User}} |{{lc:{{SUBJECTSPACE}}}} template page |{{#if:{{SUBJECTSPACE}} |{{lc:{{SUBJECTSPACE}}}} page|article}}}}}}}}. <br />
}}<br />
}}<!--<br />
<br />
-->{{DEFAULTSORT:{{{defaultsort|{{PAGENAME}}}}}}}<!--<br />
<br />
-->{{#if:{{{inhibit|}}} |<!--(don't categorize)--><br />
| <includeonly><!--<br />
-->{{#ifexist:{{NAMESPACE}}:{{BASEPAGENAME}}<br />
| [[Category:{{#switch:{{SUBJECTSPACE}} |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]<br />
| [[Category:Documentation subpages without corresponding pages]]<br />
}}<!--<br />
--></includeonly><br />
}}<!--<br />
<br />
(completing initial #ifeq: at start of template:)<br />
--><includeonly><br />
| <!--(this template has not been transcluded on a /doc or /{{{override}}} page)--><br />
}}<!--<br />
--></includeonly><noinclude>{{Documentation}}</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Sandbox_other&diff=562Template:Sandbox other2022-10-01T05:27:27Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>{{#if:{{#ifeq:{{#invoke:String|sublength|s={{SUBPAGENAME}}|i=0|len=7}}|sandbox|1}}{{#ifeq:{{SUBPAGENAME}}|doc|1}}{{#invoke:String|match|{{PAGENAME}}|/sandbox/styles.css$|plain=false|nomatch=}}|{{{1|}}}|{{{2|}}}}}<!--<br />
--><noinclude>{{documentation}}</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Documentation/styles.css&diff=560Module:Documentation/styles.css2022-10-01T05:27:27Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>/* {{pp|small=yes}} */<br />
.documentation,<br />
.documentation-metadata {<br />
border: 1px solid #a2a9b1;<br />
background-color: #ecfcf4;<br />
clear: both;<br />
}<br />
<br />
.documentation {<br />
margin: 1em 0 0 0;<br />
padding: 1em;<br />
}<br />
<br />
.documentation-metadata {<br />
margin: 0.2em 0; /* same margin left-right as .documentation */<br />
font-style: italic;<br />
padding: 0.4em 1em; /* same padding left-right as .documentation */<br />
}<br />
<br />
.documentation-startbox {<br />
padding-bottom: 3px;<br />
border-bottom: 1px solid #aaa;<br />
margin-bottom: 1ex;<br />
}<br />
<br />
.documentation-heading {<br />
font-weight: bold;<br />
font-size: 125%;<br />
}<br />
<br />
.documentation-clear { /* Don't want things to stick out where they shouldn't. */<br />
clear: both;<br />
}<br />
<br />
.documentation-toolbar {<br />
font-style: normal;<br />
font-size: 85%;<br />
}</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Documentation/config&diff=558Module:Documentation/config2022-10-01T05:27:27Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>----------------------------------------------------------------------------------------------------<br />
--<br />
-- Configuration for Module:Documentation<br />
--<br />
-- Here you can set the values of the parameters and messages used in Module:Documentation to<br />
-- localise it to your wiki and your language. Unless specified otherwise, values given here<br />
-- should be string values.<br />
----------------------------------------------------------------------------------------------------<br />
<br />
local cfg = {} -- Do not edit this line.<br />
<br />
----------------------------------------------------------------------------------------------------<br />
-- Protection template configuration<br />
----------------------------------------------------------------------------------------------------<br />
<br />
-- cfg['protection-reason-edit']<br />
-- The protection reason for edit-protected templates to pass to<br />
-- [[Module:Protection banner]].<br />
cfg['protection-reason-edit'] = 'template'<br />
<br />
--[[<br />
----------------------------------------------------------------------------------------------------<br />
-- Sandbox notice configuration<br />
--<br />
-- On sandbox pages the module can display a template notifying users that the current page is a<br />
-- sandbox, and the location of test cases pages, etc. The module decides whether the page is a<br />
-- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the<br />
-- messages that the notices contains.<br />
----------------------------------------------------------------------------------------------------<br />
--]]<br />
<br />
-- cfg['sandbox-notice-image']<br />
-- The image displayed in the sandbox notice.<br />
cfg['sandbox-notice-image'] = '[[File:Sandbox.svg|50px|alt=|link=]]'<br />
<br />
--[[<br />
-- cfg['sandbox-notice-pagetype-template']<br />
-- cfg['sandbox-notice-pagetype-module']<br />
-- cfg['sandbox-notice-pagetype-other']<br />
-- The page type of the sandbox page. The message that is displayed depends on the current subject<br />
-- namespace. This message is used in either cfg['sandbox-notice-blurb'] or<br />
-- cfg['sandbox-notice-diff-blurb'].<br />
--]]<br />
cfg['sandbox-notice-pagetype-template'] = '[[Wikipedia:Template test cases|template sandbox]] page'<br />
cfg['sandbox-notice-pagetype-module'] = '[[Wikipedia:Template test cases|module sandbox]] page'<br />
cfg['sandbox-notice-pagetype-other'] = 'sandbox page'<br />
<br />
--[[<br />
-- cfg['sandbox-notice-blurb']<br />
-- cfg['sandbox-notice-diff-blurb']<br />
-- cfg['sandbox-notice-diff-display']<br />
-- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence<br />
-- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page<br />
-- type, which is either cfg['sandbox-notice-pagetype-template'],<br />
-- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what<br />
-- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between<br />
-- the sandbox and the main template. The display value of the diff link is set by <br />
-- cfg['sandbox-notice-compare-link-display'].<br />
--]]<br />
cfg['sandbox-notice-blurb'] = 'This is the $1 for $2.'<br />
cfg['sandbox-notice-diff-blurb'] = 'This is the $1 for $2 ($3).'<br />
cfg['sandbox-notice-compare-link-display'] = 'diff'<br />
<br />
--[[<br />
-- cfg['sandbox-notice-testcases-blurb']<br />
-- cfg['sandbox-notice-testcases-link-display']<br />
-- cfg['sandbox-notice-testcases-run-blurb']<br />
-- cfg['sandbox-notice-testcases-run-link-display']<br />
-- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page<br />
-- corresponding to this sandbox that they can edit. $1 is a link to the test cases page.<br />
-- cfg['sandbox-notice-testcases-link-display'] is the display value for that link.<br />
-- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page<br />
-- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test<br />
-- cases page, and $2 is a link to the page to run it.<br />
-- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test<br />
-- cases.<br />
--]]<br />
cfg['sandbox-notice-testcases-blurb'] = 'See also the companion subpage for $1.'<br />
cfg['sandbox-notice-testcases-link-display'] = 'test cases'<br />
cfg['sandbox-notice-testcases-run-blurb'] = 'See also the companion subpage for $1 ($2).'<br />
cfg['sandbox-notice-testcases-run-link-display'] = 'run'<br />
<br />
-- cfg['sandbox-category']<br />
-- A category to add to all template sandboxes.<br />
cfg['sandbox-category'] = 'Template sandboxes'<br />
<br />
----------------------------------------------------------------------------------------------------<br />
-- Start box configuration<br />
----------------------------------------------------------------------------------------------------<br />
<br />
-- cfg['documentation-icon-wikitext']<br />
-- The wikitext for the icon shown at the top of the template.<br />
cfg['documentation-icon-wikitext'] = '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'<br />
<br />
-- cfg['template-namespace-heading']<br />
-- The heading shown in the template namespace.<br />
cfg['template-namespace-heading'] = 'Template documentation'<br />
<br />
-- cfg['module-namespace-heading']<br />
-- The heading shown in the module namespace.<br />
cfg['module-namespace-heading'] = 'Module documentation'<br />
<br />
-- cfg['file-namespace-heading']<br />
-- The heading shown in the file namespace.<br />
cfg['file-namespace-heading'] = 'Summary'<br />
<br />
-- cfg['other-namespaces-heading']<br />
-- The heading shown in other namespaces.<br />
cfg['other-namespaces-heading'] = 'Documentation'<br />
<br />
-- cfg['view-link-display']<br />
-- The text to display for "view" links.<br />
cfg['view-link-display'] = 'view'<br />
<br />
-- cfg['edit-link-display']<br />
-- The text to display for "edit" links.<br />
cfg['edit-link-display'] = 'edit'<br />
<br />
-- cfg['history-link-display']<br />
-- The text to display for "history" links.<br />
cfg['history-link-display'] = 'history'<br />
<br />
-- cfg['purge-link-display']<br />
-- The text to display for "purge" links.<br />
cfg['purge-link-display'] = 'purge'<br />
<br />
-- cfg['create-link-display']<br />
-- The text to display for "create" links.<br />
cfg['create-link-display'] = 'create'<br />
<br />
----------------------------------------------------------------------------------------------------<br />
-- Link box (end box) configuration<br />
----------------------------------------------------------------------------------------------------<br />
<br />
-- cfg['transcluded-from-blurb']<br />
-- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page.<br />
cfg['transcluded-from-blurb'] = 'The above [[Wikipedia:Template documentation|documentation]] is [[Help:Transclusion|transcluded]] from $1.'<br />
<br />
--[[<br />
-- cfg['create-module-doc-blurb']<br />
-- Notice displayed in the module namespace when the documentation subpage does not exist.<br />
-- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the<br />
-- display cfg['create-link-display'].<br />
--]]<br />
cfg['create-module-doc-blurb'] = 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'<br />
<br />
----------------------------------------------------------------------------------------------------<br />
-- Experiment blurb configuration<br />
----------------------------------------------------------------------------------------------------<br />
<br />
--[[<br />
-- cfg['experiment-blurb-template']<br />
-- cfg['experiment-blurb-module']<br />
-- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages.<br />
-- It is only shown in the template and module namespaces. With the default English settings, it<br />
-- might look like this:<br />
--<br />
-- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.<br />
--<br />
-- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links.<br />
--<br />
-- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending<br />
-- on what namespace we are in.<br />
-- <br />
-- Parameters:<br />
--<br />
-- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format:<br />
--<br />
-- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display'])<br />
-- <br />
-- If the sandbox doesn't exist, it is in the format:<br />
--<br />
-- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display'])<br />
-- <br />
-- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload']<br />
-- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display']<br />
-- loads a default edit summary of cfg['mirror-edit-summary'].<br />
--<br />
-- $2 is a link to the test cases page. If the test cases page exists, it is in the following format:<br />
--<br />
-- cfg['testcases-link-display'] (cfg['testcases-edit-link-display'] | cfg['testcases-run-link-display'])<br />
--<br />
-- If the test cases page doesn't exist, it is in the format:<br />
-- <br />
-- cfg['testcases-link-display'] (cfg['testcases-create-link-display'])<br />
--<br />
-- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the<br />
-- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current<br />
-- namespace.<br />
--]]<br />
cfg['experiment-blurb-template'] = "Editors can experiment in this template's $1 and $2 pages."<br />
cfg['experiment-blurb-module'] = "Editors can experiment in this module's $1 and $2 pages."<br />
<br />
----------------------------------------------------------------------------------------------------<br />
-- Sandbox link configuration<br />
----------------------------------------------------------------------------------------------------<br />
<br />
-- cfg['sandbox-subpage']<br />
-- The name of the template subpage typically used for sandboxes.<br />
cfg['sandbox-subpage'] = 'sandbox'<br />
<br />
-- cfg['template-sandbox-preload']<br />
-- Preload file for template sandbox pages.<br />
cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox'<br />
<br />
-- cfg['module-sandbox-preload']<br />
-- Preload file for Lua module sandbox pages.<br />
cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox'<br />
<br />
-- cfg['sandbox-link-display']<br />
-- The text to display for "sandbox" links.<br />
cfg['sandbox-link-display'] = 'sandbox'<br />
<br />
-- cfg['sandbox-edit-link-display']<br />
-- The text to display for sandbox "edit" links.<br />
cfg['sandbox-edit-link-display'] = 'edit'<br />
<br />
-- cfg['sandbox-create-link-display']<br />
-- The text to display for sandbox "create" links.<br />
cfg['sandbox-create-link-display'] = 'create'<br />
<br />
-- cfg['compare-link-display']<br />
-- The text to display for "compare" links.<br />
cfg['compare-link-display'] = 'diff'<br />
<br />
-- cfg['mirror-edit-summary']<br />
-- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the<br />
-- template page.<br />
cfg['mirror-edit-summary'] = 'Create sandbox version of $1'<br />
<br />
-- cfg['mirror-link-display']<br />
-- The text to display for "mirror" links.<br />
cfg['mirror-link-display'] = 'mirror'<br />
<br />
-- cfg['mirror-link-preload']<br />
-- The page to preload when a user clicks the "mirror" link.<br />
cfg['mirror-link-preload'] = 'Template:Documentation/mirror'<br />
<br />
----------------------------------------------------------------------------------------------------<br />
-- Test cases link configuration<br />
----------------------------------------------------------------------------------------------------<br />
<br />
-- cfg['testcases-subpage']<br />
-- The name of the template subpage typically used for test cases.<br />
cfg['testcases-subpage'] = 'testcases'<br />
<br />
-- cfg['template-testcases-preload']<br />
-- Preload file for template test cases pages.<br />
cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'<br />
<br />
-- cfg['module-testcases-preload']<br />
-- Preload file for Lua module test cases pages.<br />
cfg['module-testcases-preload'] = 'Template:Documentation/preload-module-testcases'<br />
<br />
-- cfg['testcases-link-display']<br />
-- The text to display for "testcases" links.<br />
cfg['testcases-link-display'] = 'testcases'<br />
<br />
-- cfg['testcases-edit-link-display']<br />
-- The text to display for test cases "edit" links.<br />
cfg['testcases-edit-link-display'] = 'edit'<br />
<br />
-- cfg['testcases-run-link-display']<br />
-- The text to display for test cases "run" links.<br />
cfg['testcases-run-link-display'] = 'run'<br />
<br />
-- cfg['testcases-create-link-display']<br />
-- The text to display for test cases "create" links.<br />
cfg['testcases-create-link-display'] = 'create'<br />
<br />
----------------------------------------------------------------------------------------------------<br />
-- Add categories blurb configuration<br />
----------------------------------------------------------------------------------------------------<br />
<br />
--[[<br />
-- cfg['add-categories-blurb']<br />
-- Text to direct users to add categories to the /doc subpage. Not used if the "content" or<br />
-- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a<br />
-- link to the /doc subpage with a display value of cfg['doc-link-display'].<br />
--]]<br />
cfg['add-categories-blurb'] = 'Add categories to the $1 subpage.'<br />
<br />
-- cfg['doc-link-display']<br />
-- The text to display when linking to the /doc subpage.<br />
cfg['doc-link-display'] = '/doc'<br />
<br />
----------------------------------------------------------------------------------------------------<br />
-- Subpages link configuration<br />
----------------------------------------------------------------------------------------------------<br />
<br />
--[[<br />
-- cfg['subpages-blurb']<br />
-- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a<br />
-- display value of cfg['subpages-link-display']. In the English version this blurb is simply<br />
-- the link followed by a period, and the link display provides the actual text.<br />
--]]<br />
cfg['subpages-blurb'] = '$1.'<br />
<br />
--[[<br />
-- cfg['subpages-link-display']<br />
-- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'],<br />
-- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in<br />
-- the template namespace, the module namespace, or another namespace.<br />
--]]<br />
cfg['subpages-link-display'] = 'Subpages of this $1'<br />
<br />
-- cfg['template-pagetype']<br />
-- The pagetype to display for template pages.<br />
cfg['template-pagetype'] = 'template'<br />
<br />
-- cfg['module-pagetype']<br />
-- The pagetype to display for Lua module pages.<br />
cfg['module-pagetype'] = 'module'<br />
<br />
-- cfg['default-pagetype']<br />
-- The pagetype to display for pages other than templates or Lua modules.<br />
cfg['default-pagetype'] = 'page'<br />
<br />
----------------------------------------------------------------------------------------------------<br />
-- Doc link configuration<br />
----------------------------------------------------------------------------------------------------<br />
<br />
-- cfg['doc-subpage']<br />
-- The name of the subpage typically used for documentation pages.<br />
cfg['doc-subpage'] = 'doc'<br />
<br />
-- cfg['docpage-preload']<br />
-- Preload file for template documentation pages in all namespaces.<br />
cfg['docpage-preload'] = 'Template:Documentation/preload'<br />
<br />
-- cfg['module-preload']<br />
-- Preload file for Lua module documentation pages.<br />
cfg['module-preload'] = 'Template:Documentation/preload-module-doc'<br />
<br />
----------------------------------------------------------------------------------------------------<br />
-- HTML and CSS configuration<br />
----------------------------------------------------------------------------------------------------<br />
<br />
-- cfg['templatestyles']<br />
-- The name of the TemplateStyles page where CSS is kept.<br />
-- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed.<br />
cfg['templatestyles'] = 'Module:Documentation/styles.css'<br />
<br />
-- cfg['container']<br />
-- Class which can be used to set flex or grid CSS on the<br />
-- two child divs documentation and documentation-metadata<br />
cfg['container'] = 'documentation-container'<br />
<br />
-- cfg['main-div-classes']<br />
-- Classes added to the main HTML "div" tag.<br />
cfg['main-div-classes'] = 'documentation'<br />
<br />
-- cfg['main-div-heading-class']<br />
-- Class for the main heading for templates and modules and assoc. talk spaces<br />
cfg['main-div-heading-class'] = 'documentation-heading'<br />
<br />
-- cfg['start-box-class']<br />
-- Class for the start box<br />
cfg['start-box-class'] = 'documentation-startbox'<br />
<br />
-- cfg['start-box-link-classes']<br />
-- Classes used for the [view][edit][history] or [create] links in the start box.<br />
-- mw-editsection-like is per [[Wikipedia:Village pump (technical)/Archive 117]]<br />
cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'<br />
<br />
-- cfg['end-box-class']<br />
-- Class for the end box.<br />
cfg['end-box-class'] = 'documentation-metadata'<br />
<br />
-- cfg['end-box-plainlinks']<br />
-- Plainlinks<br />
cfg['end-box-plainlinks'] = 'plainlinks'<br />
<br />
-- cfg['toolbar-class']<br />
-- Class added for toolbar links.<br />
cfg['toolbar-class'] = 'documentation-toolbar'<br />
<br />
-- cfg['clear']<br />
-- Just used to clear things.<br />
cfg['clear'] = 'documentation-clear'<br />
<br />
<br />
----------------------------------------------------------------------------------------------------<br />
-- Tracking category configuration<br />
----------------------------------------------------------------------------------------------------<br />
<br />
-- cfg['display-strange-usage-category']<br />
-- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage<br />
-- or a /testcases subpage. This should be a boolean value (either true or false).<br />
cfg['display-strange-usage-category'] = true<br />
<br />
-- cfg['strange-usage-category']<br />
-- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a<br />
-- /doc subpage or a /testcases subpage.<br />
cfg['strange-usage-category'] = 'Wikipedia pages with strange ((documentation)) usage'<br />
<br />
--[[<br />
----------------------------------------------------------------------------------------------------<br />
-- End configuration<br />
--<br />
-- Don't edit anything below this line.<br />
----------------------------------------------------------------------------------------------------<br />
--]]<br />
<br />
return cfg</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Documentation&diff=556Module:Documentation2022-10-01T05:27:27Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>-- This module implements {{documentation}}.<br />
<br />
-- Get required modules.<br />
local getArgs = require('Module:Arguments').getArgs<br />
<br />
-- Get the config table.<br />
local cfg = mw.loadData('Module:Documentation/config')<br />
<br />
local p = {}<br />
<br />
-- Often-used functions.<br />
local ugsub = mw.ustring.gsub<br />
<br />
----------------------------------------------------------------------------<br />
-- Helper functions<br />
--<br />
-- These are defined as local functions, but are made available in the p<br />
-- table for testing purposes.<br />
----------------------------------------------------------------------------<br />
<br />
local function message(cfgKey, valArray, expectType)<br />
--[[<br />
-- Gets a message from the cfg table and formats it if appropriate.<br />
-- The function raises an error if the value from the cfg table is not<br />
-- of the type expectType. The default type for expectType is 'string'.<br />
-- If the table valArray is present, strings such as $1, $2 etc. in the<br />
-- message are substituted with values from the table keys [1], [2] etc.<br />
-- For example, if the message "foo-message" had the value 'Foo $2 bar $1.',<br />
-- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz."<br />
--]]<br />
local msg = cfg[cfgKey]<br />
expectType = expectType or 'string'<br />
if type(msg) ~= expectType then<br />
error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2)<br />
end<br />
if not valArray then<br />
return msg<br />
end<br />
<br />
local function getMessageVal(match)<br />
match = tonumber(match)<br />
return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. cfgKey, 4)<br />
end<br />
<br />
return ugsub(msg, '$([1-9][0-9]*)', getMessageVal)<br />
end<br />
<br />
p.message = message<br />
<br />
local function makeWikilink(page, display)<br />
if display then<br />
return mw.ustring.format('[[%s|%s]]', page, display)<br />
else<br />
return mw.ustring.format('[[%s]]', page)<br />
end<br />
end<br />
<br />
p.makeWikilink = makeWikilink<br />
<br />
local function makeCategoryLink(cat, sort)<br />
local catns = mw.site.namespaces[14].name<br />
return makeWikilink(catns .. ':' .. cat, sort)<br />
end<br />
<br />
p.makeCategoryLink = makeCategoryLink<br />
<br />
local function makeUrlLink(url, display)<br />
return mw.ustring.format('[%s %s]', url, display)<br />
end<br />
<br />
p.makeUrlLink = makeUrlLink<br />
<br />
local function makeToolbar(...)<br />
local ret = {}<br />
local lim = select('#', ...)<br />
if lim < 1 then<br />
return nil<br />
end<br />
for i = 1, lim do<br />
ret[#ret + 1] = select(i, ...)<br />
end<br />
-- 'documentation-toolbar'<br />
return '<span class="' .. message('toolbar-class') .. '">('<br />
.. table.concat(ret, ' &#124; ') .. ')</span>'<br />
end <br />
<br />
p.makeToolbar = makeToolbar<br />
<br />
----------------------------------------------------------------------------<br />
-- Argument processing<br />
----------------------------------------------------------------------------<br />
<br />
local function makeInvokeFunc(funcName)<br />
return function (frame)<br />
local args = getArgs(frame, {<br />
valueFunc = function (key, value)<br />
if type(value) == 'string' then<br />
value = value:match('^%s*(.-)%s*$') -- Remove whitespace.<br />
if key == 'heading' or value ~= '' then<br />
return value<br />
else<br />
return nil<br />
end<br />
else<br />
return value<br />
end<br />
end<br />
})<br />
return p[funcName](args)<br />
end<br />
end<br />
<br />
----------------------------------------------------------------------------<br />
-- Entry points<br />
----------------------------------------------------------------------------<br />
<br />
function p.nonexistent(frame)<br />
if mw.title.getCurrentTitle().subpageText == 'testcases' then<br />
return frame:expandTemplate{title = 'module test cases notice'}<br />
else<br />
return p.main(frame)<br />
end<br />
end<br />
<br />
p.main = makeInvokeFunc('_main')<br />
<br />
function p._main(args)<br />
--[[<br />
-- This function defines logic flow for the module.<br />
-- @args - table of arguments passed by the user<br />
--]]<br />
local env = p.getEnvironment(args)<br />
local root = mw.html.create()<br />
root<br />
:wikitext(p._getModuleWikitext(args, env))<br />
:wikitext(p.protectionTemplate(env))<br />
:wikitext(p.sandboxNotice(args, env))<br />
:tag('div')<br />
-- 'documentation-container'<br />
:addClass(message('container'))<br />
:attr('role', 'complementary')<br />
:attr('aria-labelledby', args.heading ~= '' and 'documentation-heading' or nil)<br />
:attr('aria-label', args.heading == '' and 'Documentation' or nil)<br />
:newline()<br />
:tag('div')<br />
-- 'documentation'<br />
:addClass(message('main-div-classes'))<br />
:newline()<br />
:wikitext(p._startBox(args, env))<br />
:wikitext(p._content(args, env))<br />
:tag('div')<br />
-- 'documentation-clear'<br />
:addClass(message('clear'))<br />
:done()<br />
:newline()<br />
:done()<br />
:wikitext(p._endBox(args, env))<br />
:done()<br />
:wikitext(p.addTrackingCategories(env))<br />
-- 'Module:Documentation/styles.css'<br />
return mw.getCurrentFrame():extensionTag (<br />
'templatestyles', '', {src=cfg['templatestyles']<br />
}) .. tostring(root)<br />
end<br />
<br />
----------------------------------------------------------------------------<br />
-- Environment settings<br />
----------------------------------------------------------------------------<br />
<br />
function p.getEnvironment(args)<br />
--[[<br />
-- Returns a table with information about the environment, including title<br />
-- objects and other namespace- or path-related data.<br />
-- @args - table of arguments passed by the user<br />
--<br />
-- Title objects include:<br />
-- env.title - the page we are making documentation for (usually the current title)<br />
-- env.templateTitle - the template (or module, file, etc.)<br />
-- env.docTitle - the /doc subpage.<br />
-- env.sandboxTitle - the /sandbox subpage.<br />
-- env.testcasesTitle - the /testcases subpage.<br />
--<br />
-- Data includes:<br />
-- env.protectionLevels - the protection levels table of the title object.<br />
-- env.subjectSpace - the number of the title's subject namespace.<br />
-- env.docSpace - the number of the namespace the title puts its documentation in.<br />
-- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace.<br />
-- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template.<br />
-- <br />
-- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value<br />
-- returned will be nil.<br />
--]]<br />
<br />
local env, envFuncs = {}, {}<br />
<br />
-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value<br />
-- returned by that function is memoized in the env table so that we don't call any of the functions<br />
-- more than once. (Nils won't be memoized.)<br />
setmetatable(env, {<br />
__index = function (t, key)<br />
local envFunc = envFuncs[key]<br />
if envFunc then<br />
local success, val = pcall(envFunc)<br />
if success then<br />
env[key] = val -- Memoise the value.<br />
return val<br />
end<br />
end<br />
return nil<br />
end<br />
}) <br />
<br />
function envFuncs.title()<br />
-- The title object for the current page, or a test page passed with args.page.<br />
local title<br />
local titleArg = args.page<br />
if titleArg then<br />
title = mw.title.new(titleArg)<br />
else<br />
title = mw.title.getCurrentTitle()<br />
end<br />
return title<br />
end<br />
<br />
function envFuncs.templateTitle()<br />
--[[<br />
-- The template (or module, etc.) title object.<br />
-- Messages:<br />
-- 'sandbox-subpage' --> 'sandbox'<br />
-- 'testcases-subpage' --> 'testcases'<br />
--]]<br />
local subjectSpace = env.subjectSpace<br />
local title = env.title<br />
local subpage = title.subpageText<br />
if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then<br />
return mw.title.makeTitle(subjectSpace, title.baseText)<br />
else<br />
return mw.title.makeTitle(subjectSpace, title.text)<br />
end<br />
end<br />
<br />
function envFuncs.docTitle()<br />
--[[<br />
-- Title object of the /doc subpage.<br />
-- Messages:<br />
-- 'doc-subpage' --> 'doc'<br />
--]]<br />
local title = env.title<br />
local docname = args[1] -- User-specified doc page.<br />
local docpage<br />
if docname then<br />
docpage = docname<br />
else<br />
docpage = env.docpageBase .. '/' .. message('doc-subpage')<br />
end<br />
return mw.title.new(docpage)<br />
end<br />
<br />
function envFuncs.sandboxTitle()<br />
--[[<br />
-- Title object for the /sandbox subpage.<br />
-- Messages:<br />
-- 'sandbox-subpage' --> 'sandbox'<br />
--]]<br />
return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage'))<br />
end<br />
<br />
function envFuncs.testcasesTitle()<br />
--[[<br />
-- Title object for the /testcases subpage.<br />
-- Messages:<br />
-- 'testcases-subpage' --> 'testcases'<br />
--]]<br />
return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage'))<br />
end<br />
<br />
function envFuncs.protectionLevels()<br />
-- The protection levels table of the title object.<br />
return env.title.protectionLevels<br />
end<br />
<br />
function envFuncs.subjectSpace()<br />
-- The subject namespace number.<br />
return mw.site.namespaces[env.title.namespace].subject.id<br />
end<br />
<br />
function envFuncs.docSpace()<br />
-- The documentation namespace number. For most namespaces this is the<br />
-- same as the subject namespace. However, pages in the Article, File,<br />
-- MediaWiki or Category namespaces must have their /doc, /sandbox and<br />
-- /testcases pages in talk space.<br />
local subjectSpace = env.subjectSpace<br />
if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then<br />
return subjectSpace + 1<br />
else<br />
return subjectSpace<br />
end<br />
end<br />
<br />
function envFuncs.docpageBase()<br />
-- The base page of the /doc, /sandbox, and /testcases subpages.<br />
-- For some namespaces this is the talk page, rather than the template page.<br />
local templateTitle = env.templateTitle<br />
local docSpace = env.docSpace<br />
local docSpaceText = mw.site.namespaces[docSpace].name<br />
-- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon.<br />
return docSpaceText .. ':' .. templateTitle.text<br />
end<br />
<br />
function envFuncs.compareUrl()<br />
-- Diff link between the sandbox and the main template using [[Special:ComparePages]].<br />
local templateTitle = env.templateTitle<br />
local sandboxTitle = env.sandboxTitle<br />
if templateTitle.exists and sandboxTitle.exists then<br />
local compareUrl = mw.uri.fullUrl(<br />
'Special:ComparePages',<br />
{ page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}<br />
)<br />
return tostring(compareUrl)<br />
else<br />
return nil<br />
end<br />
end <br />
<br />
return env<br />
end <br />
<br />
----------------------------------------------------------------------------<br />
-- Auxiliary templates<br />
----------------------------------------------------------------------------<br />
<br />
p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')<br />
<br />
function p._getModuleWikitext(args, env)<br />
local currentTitle = mw.title.getCurrentTitle()<br />
if currentTitle.contentModel ~= 'Scribunto' then return end<br />
pcall(require, currentTitle.prefixedText) -- if it fails, we don't care<br />
local moduleWikitext = package.loaded["Module:Module wikitext"]<br />
if moduleWikitext then<br />
return moduleWikitext.main()<br />
end<br />
end<br />
<br />
function p.sandboxNotice(args, env)<br />
--[=[<br />
-- Generates a sandbox notice for display above sandbox pages.<br />
-- @args - a table of arguments passed by the user<br />
-- @env - environment table containing title objects, etc., generated with p.getEnvironment<br />
-- <br />
-- Messages:<br />
-- 'sandbox-notice-image' --> '[[File:Sandbox.svg|50px|alt=|link=]]'<br />
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'<br />
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'<br />
-- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page'<br />
-- 'sandbox-notice-pagetype-module' --> '[[Wikipedia:Template test cases|module sandbox]] page'<br />
-- 'sandbox-notice-pagetype-other' --> 'sandbox page'<br />
-- 'sandbox-notice-compare-link-display' --> 'diff'<br />
-- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.'<br />
-- 'sandbox-notice-testcases-link-display' --> 'test cases'<br />
-- 'sandbox-category' --> 'Template sandboxes'<br />
--]=]<br />
local title = env.title<br />
local sandboxTitle = env.sandboxTitle<br />
local templateTitle = env.templateTitle<br />
local subjectSpace = env.subjectSpace<br />
if not (subjectSpace and title and sandboxTitle and templateTitle<br />
and mw.title.equals(title, sandboxTitle)) then<br />
return nil<br />
end<br />
-- Build the table of arguments to pass to {{ombox}}. We need just two fields, "image" and "text".<br />
local omargs = {}<br />
omargs.image = message('sandbox-notice-image')<br />
-- Get the text. We start with the opening blurb, which is something like<br />
-- "This is the template sandbox for [[Template:Foo]] (diff)."<br />
local text = ''<br />
local pagetype<br />
if subjectSpace == 10 then<br />
pagetype = message('sandbox-notice-pagetype-template')<br />
elseif subjectSpace == 828 then<br />
pagetype = message('sandbox-notice-pagetype-module')<br />
else<br />
pagetype = message('sandbox-notice-pagetype-other')<br />
end<br />
local templateLink = makeWikilink(templateTitle.prefixedText)<br />
local compareUrl = env.compareUrl<br />
if compareUrl then<br />
local compareDisplay = message('sandbox-notice-compare-link-display')<br />
local compareLink = makeUrlLink(compareUrl, compareDisplay)<br />
text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink})<br />
else<br />
text = text .. message('sandbox-notice-blurb', {pagetype, templateLink})<br />
end<br />
-- Get the test cases page blurb if the page exists. This is something like<br />
-- "See also the companion subpage for [[Template:Foo/testcases|test cases]]."<br />
local testcasesTitle = env.testcasesTitle<br />
if testcasesTitle and testcasesTitle.exists then<br />
if testcasesTitle.contentModel == "Scribunto" then<br />
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')<br />
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')<br />
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)<br />
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)<br />
text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink})<br />
else<br />
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')<br />
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)<br />
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})<br />
end<br />
end<br />
-- Add the sandbox to the sandbox category.<br />
omargs.text = text .. makeCategoryLink(message('sandbox-category'))<br />
<br />
-- 'documentation-clear'<br />
return '<div class="' .. message('clear') .. '"></div>'<br />
.. require('Module:Message box').main('ombox', omargs)<br />
end<br />
<br />
function p.protectionTemplate(env)<br />
-- Generates the padlock icon in the top right.<br />
-- @env - environment table containing title objects, etc., generated with p.getEnvironment<br />
-- Messages:<br />
-- 'protection-template' --> 'pp-template'<br />
-- 'protection-template-args' --> {docusage = 'yes'}<br />
local protectionLevels = env.protectionLevels<br />
if not protectionLevels then<br />
return nil<br />
end<br />
local editProt = protectionLevels.edit and protectionLevels.edit[1]<br />
local moveProt = protectionLevels.move and protectionLevels.move[1]<br />
if editProt then<br />
-- The page is edit-protected.<br />
return require('Module:Protection banner')._main{<br />
message('protection-reason-edit'), small = true<br />
}<br />
elseif moveProt and moveProt ~= 'autoconfirmed' then<br />
-- The page is move-protected but not edit-protected. Exclude move<br />
-- protection with the level "autoconfirmed", as this is equivalent to<br />
-- no move protection at all.<br />
return require('Module:Protection banner')._main{<br />
action = 'move', small = true<br />
}<br />
else<br />
return nil<br />
end<br />
end<br />
<br />
----------------------------------------------------------------------------<br />
-- Start box<br />
----------------------------------------------------------------------------<br />
<br />
p.startBox = makeInvokeFunc('_startBox')<br />
<br />
function p._startBox(args, env)<br />
--[[<br />
-- This function generates the start box.<br />
-- @args - a table of arguments passed by the user<br />
-- @env - environment table containing title objects, etc., generated with p.getEnvironment<br />
-- <br />
-- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make<br />
-- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox<br />
-- which generate the box HTML.<br />
--]]<br />
env = env or p.getEnvironment(args)<br />
local links<br />
local content = args.content<br />
if not content or args[1] then<br />
-- No need to include the links if the documentation is on the template page itself.<br />
local linksData = p.makeStartBoxLinksData(args, env)<br />
if linksData then<br />
links = p.renderStartBoxLinks(linksData)<br />
end<br />
end<br />
-- Generate the start box html.<br />
local data = p.makeStartBoxData(args, env, links)<br />
if data then<br />
return p.renderStartBox(data)<br />
else<br />
-- User specified no heading.<br />
return nil<br />
end<br />
end<br />
<br />
function p.makeStartBoxLinksData(args, env)<br />
--[[<br />
-- Does initial processing of data to make the [view] [edit] [history] [purge] links.<br />
-- @args - a table of arguments passed by the user<br />
-- @env - environment table containing title objects, etc., generated with p.getEnvironment<br />
-- <br />
-- Messages:<br />
-- 'view-link-display' --> 'view'<br />
-- 'edit-link-display' --> 'edit'<br />
-- 'history-link-display' --> 'history'<br />
-- 'purge-link-display' --> 'purge'<br />
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'<br />
-- 'docpage-preload' --> 'Template:Documentation/preload'<br />
-- 'create-link-display' --> 'create'<br />
--]]<br />
local subjectSpace = env.subjectSpace<br />
local title = env.title<br />
local docTitle = env.docTitle<br />
if not title or not docTitle then<br />
return nil<br />
end<br />
if docTitle.isRedirect then <br />
docTitle = docTitle.redirectTarget<br />
end<br />
<br />
local data = {}<br />
data.title = title<br />
data.docTitle = docTitle<br />
-- View, display, edit, and purge links if /doc exists.<br />
data.viewLinkDisplay = message('view-link-display')<br />
data.editLinkDisplay = message('edit-link-display')<br />
data.historyLinkDisplay = message('history-link-display')<br />
data.purgeLinkDisplay = message('purge-link-display')<br />
-- Create link if /doc doesn't exist.<br />
local preload = args.preload<br />
if not preload then<br />
if subjectSpace == 828 then -- Module namespace<br />
preload = message('module-preload')<br />
else<br />
preload = message('docpage-preload')<br />
end<br />
end<br />
data.preload = preload<br />
data.createLinkDisplay = message('create-link-display')<br />
return data<br />
end<br />
<br />
function p.renderStartBoxLinks(data)<br />
--[[<br />
-- Generates the [view][edit][history][purge] or [create][purge] links from the data table.<br />
-- @data - a table of data generated by p.makeStartBoxLinksData<br />
--]]<br />
<br />
local function escapeBrackets(s)<br />
-- Escapes square brackets with HTML entities.<br />
s = s:gsub('%[', '&#91;') -- Replace square brackets with HTML entities.<br />
s = s:gsub('%]', '&#93;')<br />
return s<br />
end<br />
<br />
local ret<br />
local docTitle = data.docTitle<br />
local title = data.title<br />
local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay)<br />
if docTitle.exists then<br />
local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)<br />
local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, data.editLinkDisplay)<br />
local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, data.historyLinkDisplay)<br />
ret = '[%s] [%s] [%s] [%s]'<br />
ret = escapeBrackets(ret)<br />
ret = mw.ustring.format(ret, viewLink, editLink, historyLink, purgeLink)<br />
else<br />
local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)<br />
ret = '[%s] [%s]'<br />
ret = escapeBrackets(ret)<br />
ret = mw.ustring.format(ret, createLink, purgeLink)<br />
end<br />
return ret<br />
end<br />
<br />
function p.makeStartBoxData(args, env, links)<br />
--[=[<br />
-- Does initial processing of data to pass to the start-box render function, p.renderStartBox.<br />
-- @args - a table of arguments passed by the user<br />
-- @env - environment table containing title objects, etc., generated with p.getEnvironment<br />
-- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error.<br />
--<br />
-- Messages:<br />
-- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'<br />
-- 'template-namespace-heading' --> 'Template documentation'<br />
-- 'module-namespace-heading' --> 'Module documentation'<br />
-- 'file-namespace-heading' --> 'Summary'<br />
-- 'other-namespaces-heading' --> 'Documentation'<br />
-- 'testcases-create-link-display' --> 'create'<br />
--]=]<br />
local subjectSpace = env.subjectSpace<br />
if not subjectSpace then<br />
-- Default to an "other namespaces" namespace, so that we get at least some output<br />
-- if an error occurs.<br />
subjectSpace = 2<br />
end<br />
local data = {}<br />
<br />
-- Heading<br />
local heading = args.heading -- Blank values are not removed.<br />
if heading == '' then<br />
-- Don't display the start box if the heading arg is defined but blank.<br />
return nil<br />
end<br />
if heading then<br />
data.heading = heading<br />
elseif subjectSpace == 10 then -- Template namespace<br />
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading')<br />
elseif subjectSpace == 828 then -- Module namespace<br />
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading')<br />
elseif subjectSpace == 6 then -- File namespace<br />
data.heading = message('file-namespace-heading')<br />
else<br />
data.heading = message('other-namespaces-heading')<br />
end<br />
<br />
-- Heading CSS<br />
local headingStyle = args['heading-style']<br />
if headingStyle then<br />
data.headingStyleText = headingStyle<br />
else<br />
-- 'documentation-heading'<br />
data.headingClass = message('main-div-heading-class')<br />
end<br />
<br />
-- Data for the [view][edit][history][purge] or [create] links.<br />
if links then<br />
-- 'mw-editsection-like plainlinks'<br />
data.linksClass = message('start-box-link-classes')<br />
data.links = links<br />
end<br />
<br />
return data<br />
end<br />
<br />
function p.renderStartBox(data)<br />
-- Renders the start box html.<br />
-- @data - a table of data generated by p.makeStartBoxData.<br />
local sbox = mw.html.create('div')<br />
sbox<br />
-- 'documentation-startbox'<br />
:addClass(message('start-box-class'))<br />
:newline()<br />
:tag('span')<br />
:addClass(data.headingClass)<br />
:attr('id', 'documentation-heading')<br />
:cssText(data.headingStyleText)<br />
:wikitext(data.heading)<br />
local links = data.links<br />
if links then<br />
sbox:tag('span')<br />
:addClass(data.linksClass)<br />
:attr('id', data.linksId)<br />
:wikitext(links)<br />
end<br />
return tostring(sbox)<br />
end<br />
<br />
----------------------------------------------------------------------------<br />
-- Documentation content<br />
----------------------------------------------------------------------------<br />
<br />
p.content = makeInvokeFunc('_content')<br />
<br />
function p._content(args, env)<br />
-- Displays the documentation contents<br />
-- @args - a table of arguments passed by the user<br />
-- @env - environment table containing title objects, etc., generated with p.getEnvironment<br />
env = env or p.getEnvironment(args)<br />
local docTitle = env.docTitle<br />
local content = args.content<br />
if not content and docTitle and docTitle.exists then<br />
content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}<br />
end<br />
-- The line breaks below are necessary so that "=== Headings ===" at the start and end<br />
-- of docs are interpreted correctly.<br />
return '\n' .. (content or '') .. '\n' <br />
end<br />
<br />
p.contentTitle = makeInvokeFunc('_contentTitle')<br />
<br />
function p._contentTitle(args, env)<br />
env = env or p.getEnvironment(args)<br />
local docTitle = env.docTitle<br />
if not args.content and docTitle and docTitle.exists then<br />
return docTitle.prefixedText<br />
else<br />
return ''<br />
end<br />
end<br />
<br />
----------------------------------------------------------------------------<br />
-- End box<br />
----------------------------------------------------------------------------<br />
<br />
p.endBox = makeInvokeFunc('_endBox')<br />
<br />
function p._endBox(args, env)<br />
--[=[<br />
-- This function generates the end box (also known as the link box).<br />
-- @args - a table of arguments passed by the user<br />
-- @env - environment table containing title objects, etc., generated with p.getEnvironment<br />
-- <br />
--]=]<br />
<br />
-- Get environment data.<br />
env = env or p.getEnvironment(args)<br />
local subjectSpace = env.subjectSpace<br />
local docTitle = env.docTitle<br />
if not subjectSpace or not docTitle then<br />
return nil<br />
end<br />
<br />
-- Check whether we should output the end box at all. Add the end<br />
-- box by default if the documentation exists or if we are in the<br />
-- user, module or template namespaces.<br />
local linkBox = args['link box']<br />
if linkBox == 'off'<br />
or not (<br />
docTitle.exists<br />
or subjectSpace == 2<br />
or subjectSpace == 828<br />
or subjectSpace == 10<br />
)<br />
then<br />
return nil<br />
end<br />
<br />
-- Assemble the link box.<br />
local text = ''<br />
if linkBox then<br />
text = text .. linkBox<br />
else<br />
text = text .. (p.makeDocPageBlurb(args, env) or '') -- "This documentation is transcluded from [[Foo]]." <br />
if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then<br />
-- We are in the user, template or module namespaces.<br />
-- Add sandbox and testcases links.<br />
-- "Editors can experiment in this template's sandbox and testcases pages."<br />
text = text .. (p.makeExperimentBlurb(args, env) or '') .. '<br />'<br />
if not args.content and not args[1] then<br />
-- "Please add categories to the /doc subpage."<br />
-- Don't show this message with inline docs or with an explicitly specified doc page,<br />
-- as then it is unclear where to add the categories.<br />
text = text .. (p.makeCategoriesBlurb(args, env) or '')<br />
end<br />
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"<br />
end<br />
end<br />
<br />
local box = mw.html.create('div')<br />
-- 'documentation-metadata'<br />
box:attr('role', 'note')<br />
:addClass(message('end-box-class'))<br />
-- 'plainlinks'<br />
:addClass(message('end-box-plainlinks'))<br />
:wikitext(text)<br />
:done()<br />
<br />
return '\n' .. tostring(box)<br />
end<br />
<br />
function p.makeDocPageBlurb(args, env)<br />
--[=[<br />
-- Makes the blurb "This documentation is transcluded from [[Template:Foo]] (edit, history)".<br />
-- @args - a table of arguments passed by the user<br />
-- @env - environment table containing title objects, etc., generated with p.getEnvironment<br />
-- <br />
-- Messages:<br />
-- 'edit-link-display' --> 'edit'<br />
-- 'history-link-display' --> 'history'<br />
-- 'transcluded-from-blurb' --> <br />
-- 'The above [[Wikipedia:Template documentation|documentation]] <br />
-- is [[Help:Transclusion|transcluded]] from $1.'<br />
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'<br />
-- 'create-link-display' --> 'create'<br />
-- 'create-module-doc-blurb' --><br />
-- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'<br />
--]=]<br />
local docTitle = env.docTitle<br />
if not docTitle then<br />
return nil<br />
end<br />
local ret<br />
if docTitle.exists then<br />
-- /doc exists; link to it.<br />
local docLink = makeWikilink(docTitle.prefixedText)<br />
local editUrl = docTitle:fullUrl{action = 'edit'}<br />
local editDisplay = message('edit-link-display')<br />
local editLink = makeUrlLink(editUrl, editDisplay)<br />
local historyUrl = docTitle:fullUrl{action = 'history'}<br />
local historyDisplay = message('history-link-display')<br />
local historyLink = makeUrlLink(historyUrl, historyDisplay)<br />
ret = message('transcluded-from-blurb', {docLink})<br />
.. ' '<br />
.. makeToolbar(editLink, historyLink)<br />
.. '<br />'<br />
elseif env.subjectSpace == 828 then<br />
-- /doc does not exist; ask to create it.<br />
local createUrl = docTitle:fullUrl{action = 'edit', preload = message('module-preload')}<br />
local createDisplay = message('create-link-display')<br />
local createLink = makeUrlLink(createUrl, createDisplay)<br />
ret = message('create-module-doc-blurb', {createLink})<br />
.. '<br />'<br />
end<br />
return ret<br />
end<br />
<br />
function p.makeExperimentBlurb(args, env)<br />
--[[<br />
-- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages."<br />
-- @args - a table of arguments passed by the user<br />
-- @env - environment table containing title objects, etc., generated with p.getEnvironment<br />
-- <br />
-- Messages:<br />
-- 'sandbox-link-display' --> 'sandbox'<br />
-- 'sandbox-edit-link-display' --> 'edit'<br />
-- 'compare-link-display' --> 'diff'<br />
-- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox'<br />
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'<br />
-- 'sandbox-create-link-display' --> 'create'<br />
-- 'mirror-edit-summary' --> 'Create sandbox version of $1'<br />
-- 'mirror-link-display' --> 'mirror'<br />
-- 'mirror-link-preload' --> 'Template:Documentation/mirror'<br />
-- 'sandbox-link-display' --> 'sandbox'<br />
-- 'testcases-link-display' --> 'testcases'<br />
-- 'testcases-edit-link-display'--> 'edit'<br />
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'<br />
-- 'testcases-create-link-display' --> 'create'<br />
-- 'testcases-link-display' --> 'testcases'<br />
-- 'testcases-edit-link-display' --> 'edit'<br />
-- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases'<br />
-- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases'<br />
-- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.'<br />
-- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.'<br />
--]]<br />
local subjectSpace = env.subjectSpace<br />
local templateTitle = env.templateTitle<br />
local sandboxTitle = env.sandboxTitle<br />
local testcasesTitle = env.testcasesTitle<br />
local templatePage = templateTitle.prefixedText<br />
if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then<br />
return nil<br />
end<br />
-- Make links.<br />
local sandboxLinks, testcasesLinks<br />
if sandboxTitle.exists then<br />
local sandboxPage = sandboxTitle.prefixedText<br />
local sandboxDisplay = message('sandbox-link-display')<br />
local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)<br />
local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'}<br />
local sandboxEditDisplay = message('sandbox-edit-link-display')<br />
local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay)<br />
local compareUrl = env.compareUrl<br />
local compareLink<br />
if compareUrl then<br />
local compareDisplay = message('compare-link-display')<br />
compareLink = makeUrlLink(compareUrl, compareDisplay)<br />
end<br />
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)<br />
else<br />
local sandboxPreload<br />
if subjectSpace == 828 then<br />
sandboxPreload = message('module-sandbox-preload')<br />
else<br />
sandboxPreload = message('template-sandbox-preload')<br />
end<br />
local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload}<br />
local sandboxCreateDisplay = message('sandbox-create-link-display')<br />
local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)<br />
local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)})<br />
local mirrorPreload = message('mirror-link-preload')<br />
local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary}<br />
if subjectSpace == 828 then<br />
mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary}<br />
end<br />
local mirrorDisplay = message('mirror-link-display')<br />
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay)<br />
sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink)<br />
end<br />
if testcasesTitle.exists then<br />
local testcasesPage = testcasesTitle.prefixedText<br />
local testcasesDisplay = message('testcases-link-display')<br />
local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay)<br />
local testcasesEditUrl = testcasesTitle:fullUrl{action = 'edit'}<br />
local testcasesEditDisplay = message('testcases-edit-link-display')<br />
local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay)<br />
-- for Modules, add testcases run link if exists<br />
if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then<br />
local testcasesRunLinkDisplay = message('testcases-run-link-display')<br />
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)<br />
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink)<br />
else<br />
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink)<br />
end<br />
else<br />
local testcasesPreload<br />
if subjectSpace == 828 then<br />
testcasesPreload = message('module-testcases-preload')<br />
else<br />
testcasesPreload = message('template-testcases-preload')<br />
end<br />
local testcasesCreateUrl = testcasesTitle:fullUrl{action = 'edit', preload = testcasesPreload}<br />
local testcasesCreateDisplay = message('testcases-create-link-display')<br />
local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay)<br />
testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink)<br />
end<br />
local messageName<br />
if subjectSpace == 828 then<br />
messageName = 'experiment-blurb-module'<br />
else<br />
messageName = 'experiment-blurb-template'<br />
end<br />
return message(messageName, {sandboxLinks, testcasesLinks})<br />
end<br />
<br />
function p.makeCategoriesBlurb(args, env)<br />
--[[<br />
-- Generates the text "Please add categories to the /doc subpage."<br />
-- @args - a table of arguments passed by the user<br />
-- @env - environment table containing title objects, etc., generated with p.getEnvironment<br />
-- Messages:<br />
-- 'doc-link-display' --> '/doc'<br />
-- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.'<br />
--]]<br />
local docTitle = env.docTitle<br />
if not docTitle then<br />
return nil<br />
end<br />
local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display'))<br />
return message('add-categories-blurb', {docPathLink})<br />
end<br />
<br />
function p.makeSubpagesBlurb(args, env)<br />
--[[<br />
-- Generates the "Subpages of this template" link.<br />
-- @args - a table of arguments passed by the user<br />
-- @env - environment table containing title objects, etc., generated with p.getEnvironment<br />
<br />
-- Messages:<br />
-- 'template-pagetype' --> 'template'<br />
-- 'module-pagetype' --> 'module'<br />
-- 'default-pagetype' --> 'page'<br />
-- 'subpages-link-display' --> 'Subpages of this $1'<br />
--]]<br />
local subjectSpace = env.subjectSpace<br />
local templateTitle = env.templateTitle<br />
if not subjectSpace or not templateTitle then<br />
return nil<br />
end<br />
local pagetype<br />
if subjectSpace == 10 then<br />
pagetype = message('template-pagetype')<br />
elseif subjectSpace == 828 then<br />
pagetype = message('module-pagetype')<br />
else<br />
pagetype = message('default-pagetype')<br />
end<br />
local subpagesLink = makeWikilink(<br />
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',<br />
message('subpages-link-display', {pagetype})<br />
)<br />
return message('subpages-blurb', {subpagesLink})<br />
end<br />
<br />
----------------------------------------------------------------------------<br />
-- Tracking categories<br />
----------------------------------------------------------------------------<br />
<br />
function p.addTrackingCategories(env)<br />
--[[<br />
-- Check if {{documentation}} is transcluded on a /doc or /testcases page.<br />
-- @env - environment table containing title objects, etc., generated with p.getEnvironment<br />
<br />
-- Messages:<br />
-- 'display-strange-usage-category' --> true<br />
-- 'doc-subpage' --> 'doc'<br />
-- 'testcases-subpage' --> 'testcases'<br />
-- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage'<br />
-- <br />
-- /testcases pages in the module namespace are not categorised, as they may have<br />
-- {{documentation}} transcluded automatically.<br />
--]]<br />
local title = env.title<br />
local subjectSpace = env.subjectSpace<br />
if not title or not subjectSpace then<br />
return nil<br />
end<br />
local subpage = title.subpageText<br />
local ret = ''<br />
if message('display-strange-usage-category', nil, 'boolean')<br />
and (<br />
subpage == message('doc-subpage')<br />
or subjectSpace ~= 828 and subpage == message('testcases-subpage')<br />
)<br />
then<br />
ret = ret .. makeCategoryLink(message('strange-usage-category'))<br />
end<br />
return ret<br />
end<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Documentation&diff=554Template:Documentation2022-10-01T05:27:27Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}<noinclude><br />
<!-- Add categories to the /doc subpage --><br />
</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Para&diff=552Template:Para2022-10-01T05:27:27Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div><code class="tpl-para" style="word-break:break-word;{{SAFESUBST:<noinclude />#if:{{{plain|}}}|border: none; background-color: inherit;}} {{SAFESUBST:<noinclude />#if:{{{plain|}}}{{{mxt|}}}{{{green|}}}{{{!mxt|}}}{{{red|}}}|color: {{SAFESUBST:<noinclude />#if:{{{mxt|}}}{{{green|}}}|#006400|{{SAFESUBST:<noinclude />#if:{{{!mxt|}}}{{{red|}}}|#8B0000|inherit}}}};}} {{SAFESUBST:<noinclude />#if:{{{style|}}}|{{{style}}}}}">&#124;{{SAFESUBST:<noinclude />#if:{{{1|}}}|{{{1}}}&#61;}}{{{2|}}}</code><noinclude><br />
{{Documentation}}<br />
<!--Categories and interwikis go near the bottom of the /doc subpage.--><br />
</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Yesno-no&diff=550Template:Yesno-no2022-10-01T05:27:27Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>{{safesubst:<noinclude />yesno|{{{1}}}|yes={{{yes|yes}}}|no={{{no|no}}}|blank={{{blank|no}}}|¬={{{¬|no}}}|def={{{def|no}}}}}<noinclude><br />
{{Documentation|Template:Yesno/doc}}<br />
<!--Categories go in the doc page referenced above; interwikis go in Wikidata.--><br />
</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Div_col_end&diff=548Template:Div col end2022-10-01T05:27:27Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div><includeonly></div></includeonly><noinclude><br />
{{Documentation|Template:Div col/doc}}<br />
</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Div_col/styles.css&diff=546Template:Div col/styles.css2022-10-01T05:27:27Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>/* {{pp|small=yes}} */<br />
.div-col {<br />
margin-top: 0.3em;<br />
column-width: 30em;<br />
}<br />
<br />
.div-col-small {<br />
font-size: 90%;<br />
}<br />
<br />
.div-col-rules {<br />
column-rule: 1px solid #aaa;<br />
}<br />
<br />
/* Reset top margin for lists in div col */<br />
.div-col dl,<br />
.div-col ol,<br />
.div-col ul {<br />
margin-top: 0;<br />
}<br />
<br />
/* Avoid elements breaking between columns<br />
See also Template:No col break */<br />
.div-col li,<br />
.div-col dd {<br />
page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */<br />
break-inside: avoid-column;<br />
}</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Div_col&diff=544Template:Div col2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div><includeonly><templatestyles src="Div col/styles.css"/><!--<br />
--><div class="div-col {{#ifeq:{{{small|}}}|yes|div-col-small}} {{#ifeq:{{{rules|}}}|yes|div-col-rules}} {{{class|}}}" <!--<br />
-->{{#if:{{{colwidth|}}}{{{gap|}}}{{{style|}}}|<!--<br />
-->style="{{#if:{{{colwidth|}}}|column-width: {{{colwidth}}};}}{{#if:{{{gap|}}}|column-gap: {{{gap}}};}}{{#if:{{{style|}}}|{{{style}}}}}"<!--<br />
-->}}><!--<br />
-->{{#if:{{{content|}}}|{{{content}}}</div>}}<!-- Inventory how many pages use small=yes <br />
-->{{#ifeq:{{{small|}}}|yes|[[Category:Pages using div col with small parameter]]}}<!--<br />
--></includeonly>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using div col with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Div col]] with unknown parameter "_VALUE_"; use colwidth= to specify column size |ignoreblank=y | class | colwidth | content | gap | rules | small | style }}<noinclude><br />
{{Documentation}}<br />
</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Sidebar/styles.css&diff=542Module:Sidebar/styles.css2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>/* {{pp-template}} */<br />
/* TODO: Invert width design to be "mobile first" */<br />
.sidebar {<br />
/* TODO: Ask if we should have max-width 22em instead */<br />
width: 22em;<br />
/* @noflip */<br />
float: right;<br />
/* @noflip */<br />
clear: right;<br />
/* @noflip */<br />
margin: 0.5em 0 1em 1em;<br />
background: #f8f9fa;<br />
border: 1px solid #aaa;<br />
padding: 0.2em;<br />
text-align: center;<br />
line-height: 1.4em;<br />
font-size: 88%;<br />
border-collapse: collapse;<br />
/* Timeless has display: none on .nomobile at mobile resolutions, so we<br />
* unhide it with display: table and let precedence and proximity win.<br />
*/<br />
display: table; <br />
}<br />
<br />
/* Unfortunately, so does Minerva desktop, except Minerva drops an<br />
* !important on the declaration. So we have to be mean for Minerva users.<br />
* Mobile removes the element entirely with `wgMFRemovableClasses` in <br />
* https://github.com/wikimedia/operations-mediawiki-config/blob/master/<br />
wmf-config/InitialiseSettings.php#L16992<br />
* which is why displaying it categorically with display: table works.<br />
* We don't really want to expose the generic user in the wild on mobile to have<br />
* to deal with sidebars. (Maybe the ones with collapsible lists, so that<br />
* might be an improvement. That is blocked on [[:phab:T111565]].)<br />
*/<br />
body.skin-minerva .sidebar {<br />
display: table !important;<br />
/* also, minerva is way too aggressive about other stylings on tables.<br />
* TODO remove when this template gets moved to a div. plans on talk page.<br />
* We always float right on Minerva because that's a lot of extra CSS<br />
* otherwise. */<br />
float: right !important;<br />
margin: 0.5em 0 1em 1em !important;<br />
}<br />
<br />
.sidebar-subgroup {<br />
width: 100%;<br />
margin: 0;<br />
border-spacing: 0;<br />
}<br />
<br />
.sidebar-left {<br />
/* @noflip */<br />
float: left;<br />
/* @noflip */<br />
clear: left;<br />
/* @noflip */<br />
margin: 0.5em 1em 1em 0;<br />
}<br />
<br />
.sidebar-none {<br />
float: none;<br />
clear: both;<br />
/* @noflip */<br />
margin: 0.5em 1em 1em 0;<br />
}<br />
<br />
.sidebar-outer-title {<br />
padding: 0 0.4em 0.2em;<br />
font-size: 125%;<br />
line-height: 1.2em;<br />
font-weight: bold;<br />
}<br />
<br />
.sidebar-top-image {<br />
padding: 0.4em;<br />
}<br />
<br />
.sidebar-top-caption,<br />
.sidebar-pretitle-with-top-image,<br />
.sidebar-caption {<br />
padding: 0.2em 0.4em 0;<br />
line-height: 1.2em;<br />
}<br />
<br />
.sidebar-pretitle {<br />
padding: 0.4em 0.4em 0;<br />
line-height: 1.2em;<br />
}<br />
<br />
.sidebar-title,<br />
.sidebar-title-with-pretitle {<br />
padding: 0.2em 0.8em;<br />
font-size: 145%;<br />
line-height: 1.2em;<br />
}<br />
<br />
.sidebar-title-with-pretitle {<br />
padding: 0.1em 0.4em;<br />
}<br />
<br />
.sidebar-image {<br />
padding: 0.2em 0.4em 0.4em;<br />
}<br />
<br />
.sidebar-heading {<br />
padding: 0.1em 0.4em;<br />
}<br />
<br />
.sidebar-content {<br />
padding: 0 0.5em 0.4em;<br />
}<br />
<br />
.sidebar-content-with-subgroup {<br />
padding: 0.1em 0.4em 0.2em;<br />
}<br />
<br />
.sidebar-above,<br />
.sidebar-below {<br />
padding: 0.3em 0.8em;<br />
font-weight: bold;<br />
}<br />
<br />
.sidebar-collapse .sidebar-above,<br />
.sidebar-collapse .sidebar-below {<br />
border-top: 1px solid #aaa;<br />
border-bottom: 1px solid #aaa;<br />
}<br />
<br />
.sidebar-navbar {<br />
text-align: right;<br />
font-size: 115%;<br />
padding: 0 0.4em 0.4em;<br />
}<br />
<br />
.sidebar-list-title {<br />
padding: 0 0.4em;<br />
text-align: left;<br />
font-weight: bold;<br />
line-height: 1.6em;<br />
font-size: 105%;<br />
}<br />
<br />
/* centered text with mw-collapsible headers is finicky */<br />
.sidebar-list-title-c {<br />
padding: 0 0.4em;<br />
text-align: center;<br />
margin: 0 3.3em;<br />
}<br />
<br />
@media (max-width: 720px) {<br />
/* users have wide latitude to set arbitrary width and margin :(<br />
"Super-specific" selector to prevent overriding this appearance by<br />
lower level sidebars too */<br />
body.mediawiki .sidebar {<br />
width: 100% !important;<br />
clear: both;<br />
float: none !important; /* Remove when we div based; Minerva is dumb */<br />
margin-left: 0 !important;<br />
margin-right: 0 !important;<br />
}<br />
/* TODO: We might consider making all links wrap at small resolutions and then<br />
* only introduce nowrap at higher resolutions. Do when we invert the media<br />
* query.<br />
*/<br />
}</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Sidebar/configuration&diff=540Module:Sidebar/configuration2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>return {<br />
i18n = {<br />
child_yes = 'yes',<br />
float_none = 'none',<br />
float_left = 'left',<br />
wrap_true = 'true',<br />
navbar_none = 'none',<br />
navbar_off = 'off',<br />
default_list_title = 'List',<br />
title_not_to_add_navbar = 'Template:Sidebar',<br />
collapse_title_not_to_add_navbar = 'Template:Sidebar with collapsible lists',<br />
templatestyles = 'Module:Sidebar/styles.css',<br />
category = {<br />
child = '[[Category:Pages using sidebar with the child parameter]]',<br />
conversion = '[[Category:Sidebars with styles needing conversion]]'<br />
},<br />
pattern = {<br />
collapse_sandbox = '/sandbox$',<br />
sandbox = '/sandbox$',<br />
subgroup = 'sidebar%-subgroup',<br />
style_conversion = 'style$',<br />
uncategorized_conversion_titles = {<br />
'/[Ss]andbox',<br />
'/[Tt]estcases',<br />
'/[Dd]oc$'<br />
}<br />
},<br />
class = {<br />
sidebar = 'sidebar',<br />
subgroup = 'sidebar-subgroup',<br />
collapse = 'sidebar-collapse',<br />
float_none = 'sidebar-none',<br />
float_left = 'sidebar-left',<br />
wraplinks = 'nowraplinks',<br />
outer_title = 'sidebar-outer-title',<br />
top_image = 'sidebar-top-image',<br />
top_caption = 'sidebar-top-caption',<br />
pretitle = 'sidebar-pretitle',<br />
pretitle_with_top_image = 'sidebar-pretitle-with-top-image',<br />
title = 'sidebar-title',<br />
title_with_pretitle = 'sidebar-title-with-pretitle',<br />
image = 'sidebar-image',<br />
caption = 'sidebar-caption',<br />
above = 'sidebar-above',<br />
heading = 'sidebar-heading',<br />
content = 'sidebar-content',<br />
content_with_subgroup = 'sidebar-content-with-subgroup',<br />
below = 'sidebar-below',<br />
navbar = 'sidebar-navbar',<br />
list = 'sidebar-list',<br />
list_title = 'sidebar-list-title',<br />
list_title_centered = 'sidebar-list-title-c',<br />
list_content = 'sidebar-list-content'<br />
}<br />
}<br />
}</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Sidebar&diff=538Module:Sidebar2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>--<br />
-- This module implements {{Sidebar}}<br />
--<br />
require('Module:No globals')<br />
local cfg = mw.loadData('Module:Sidebar/configuration')<br />
<br />
local p = {}<br />
<br />
local getArgs = require('Module:Arguments').getArgs<br />
<br />
--[[<br />
Categorizes calling templates and modules with a 'style' parameter of any sort<br />
for tracking to convert to TemplateStyles.<br />
<br />
TODO after a long cleanup: Catch sidebars in other namespaces than Template and Module.<br />
TODO would probably want to remove /log and /archive as CS1 does<br />
]]<br />
local function categorizeTemplatesWithInlineStyles(args)<br />
local title = mw.title.getCurrentTitle()<br />
if title.namespace ~= 10 and title.namespace ~= 828 then return '' end<br />
for _, pattern in ipairs (cfg.i18n.pattern.uncategorized_conversion_titles) do<br />
if title.text:match(pattern) then return '' end<br />
end<br />
<br />
for key, _ in pairs(args) do<br />
if mw.ustring.find(key, cfg.i18n.pattern.style_conversion) or key == 'width' then<br />
return cfg.i18n.category.conversion<br />
end<br />
end<br />
end<br />
<br />
--[[<br />
For compatibility with the original {{sidebar with collapsible lists}}<br />
implementation, which passed some parameters through {{#if}} to trim their<br />
whitespace. This also triggered the automatic newline behavior.<br />
]]<br />
-- See ([[meta:Help:Newlines and spaces#Automatic newline]])<br />
local function trimAndAddAutomaticNewline(s)<br />
s = mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1")<br />
if mw.ustring.find(s, '^[#*:;]') or mw.ustring.find(s, '^{|') then<br />
return '\n' .. s<br />
else<br />
return s<br />
end<br />
end<br />
<br />
--[[<br />
Finds whether a sidebar has a subgroup sidebar.<br />
]]<br />
local function hasSubgroup(s)<br />
if mw.ustring.find(s, cfg.i18n.pattern.subgroup) then<br />
return true<br />
else<br />
return false<br />
end<br />
end<br />
<br />
--[[<br />
Main sidebar function. Takes the frame, args, and an optional collapsibleClass.<br />
The collapsibleClass is and should be used only for sidebars with collapsible<br />
lists, as in p.collapsible.<br />
]]<br />
function p.sidebar(frame, args, collapsibleClass)<br />
if not args then<br />
args = getArgs(frame)<br />
end<br />
local root = mw.html.create()<br />
local child = args.child and mw.text.trim(args.child) == cfg.i18n.child_yes<br />
<br />
root = root:tag('table')<br />
if not child then<br />
root <br />
:addClass(cfg.i18n.class.sidebar)<br />
-- force collapsibleclass to be sidebar-collapse otherwise output nothing<br />
:addClass(collapsibleClass == cfg.i18n.class.collapse and cfg.i18n.class.collapse or nil)<br />
:addClass('nomobile')<br />
:addClass(args.float == cfg.i18n.float_none and cfg.i18n.class.float_none or nil)<br />
:addClass(args.float == cfg.i18n.float_left and cfg.i18n.class.float_left or nil)<br />
:addClass(args.wraplinks ~= cfg.i18n.wrap_true and cfg.i18n.class.wraplinks or nil)<br />
:addClass(args.bodyclass or args.class)<br />
:css('width', args.width or nil)<br />
:cssText(args.bodystyle or args.style)<br />
<br />
if args.outertitle then<br />
root<br />
:tag('caption')<br />
:addClass(cfg.i18n.class.outer_title)<br />
:addClass(args.outertitleclass)<br />
:cssText(args.outertitlestyle)<br />
:wikitext(args.outertitle)<br />
end<br />
<br />
if args.topimage then<br />
local imageCell = root:tag('tr'):tag('td')<br />
<br />
imageCell<br />
:addClass(cfg.i18n.class.top_image)<br />
:addClass(args.topimageclass)<br />
:cssText(args.topimagestyle)<br />
:wikitext(args.topimage)<br />
<br />
if args.topcaption then<br />
imageCell<br />
:tag('div')<br />
:addClass(cfg.i18n.class.top_caption)<br />
:cssText(args.topcaptionstyle)<br />
:wikitext(args.topcaption)<br />
end<br />
end<br />
<br />
if args.pretitle then<br />
root<br />
:tag('tr')<br />
:tag('td')<br />
:addClass(args.topimage and cfg.i18n.class.pretitle_with_top_image<br />
or cfg.i18n.class.pretitle)<br />
:addClass(args.pretitleclass)<br />
:cssText(args.basestyle)<br />
:cssText(args.pretitlestyle)<br />
:wikitext(args.pretitle)<br />
end<br />
else<br />
root<br />
:addClass(cfg.i18n.class.subgroup)<br />
:addClass(args.bodyclass or args.class)<br />
:cssText(args.bodystyle or args.style)<br />
end<br />
<br />
if args.title then<br />
if child then<br />
root<br />
:wikitext(args.title)<br />
else<br />
root<br />
:tag('tr')<br />
:tag('th')<br />
:addClass(args.pretitle and cfg.i18n.class.title_with_pretitle<br />
or cfg.i18n.class.title)<br />
:addClass(args.titleclass)<br />
:cssText(args.basestyle)<br />
:cssText(args.titlestyle)<br />
:wikitext(args.title)<br />
end<br />
end<br />
<br />
if args.image then<br />
local imageCell = root:tag('tr'):tag('td')<br />
<br />
imageCell<br />
:addClass(cfg.i18n.class.image)<br />
:addClass(args.imageclass)<br />
:cssText(args.imagestyle)<br />
:wikitext(args.image)<br />
<br />
if args.caption then<br />
imageCell<br />
:tag('div')<br />
:addClass(cfg.i18n.class.caption)<br />
:cssText(args.captionstyle)<br />
:wikitext(args.caption)<br />
end<br />
end<br />
<br />
if args.above then<br />
root<br />
:tag('tr')<br />
:tag('td')<br />
:addClass(cfg.i18n.class.above)<br />
:addClass(args.aboveclass)<br />
:cssText(args.abovestyle)<br />
:newline() -- newline required for bullet-points to work<br />
:wikitext(args.above)<br />
end<br />
<br />
local rowNums = {}<br />
for k, v in pairs(args) do<br />
k = '' .. k<br />
local num = k:match('^heading(%d+)$') or k:match('^content(%d+)$')<br />
if num then table.insert(rowNums, tonumber(num)) end<br />
end<br />
table.sort(rowNums)<br />
-- remove duplicates from the list (e.g. 3 will be duplicated if both heading3<br />
-- and content3 are specified)<br />
for i = #rowNums, 1, -1 do<br />
if rowNums[i] == rowNums[i - 1] then<br />
table.remove(rowNums, i)<br />
end<br />
end<br />
<br />
for i, num in ipairs(rowNums) do<br />
local heading = args['heading' .. num]<br />
if heading then<br />
root<br />
:tag('tr')<br />
:tag('th')<br />
:addClass(cfg.i18n.class.heading)<br />
:addClass(args.headingclass)<br />
:addClass(args['heading' .. num .. 'class'])<br />
:cssText(args.basestyle)<br />
:cssText(args.headingstyle)<br />
:cssText(args['heading' .. num .. 'style'])<br />
:newline()<br />
:wikitext(heading)<br />
end<br />
<br />
local content = args['content' .. num]<br />
if content then<br />
root<br />
:tag('tr')<br />
:tag('td')<br />
:addClass(hasSubgroup(content) and cfg.i18n.class.content_with_subgroup<br />
or cfg.i18n.class.content)<br />
:addClass(args.contentclass)<br />
:addClass(args['content' .. num .. 'class'])<br />
:cssText(args.contentstyle)<br />
:cssText(args['content' .. num .. 'style'])<br />
:newline()<br />
:wikitext(content)<br />
:done()<br />
-- Without a linebreak after the </td>, a nested list like<br />
-- "* {{hlist| ...}}" doesn't parse correctly.<br />
:newline()<br />
end<br />
end<br />
<br />
if args.below then<br />
root<br />
:tag('tr')<br />
:tag('td')<br />
:addClass(cfg.i18n.class.below)<br />
:addClass(args.belowclass)<br />
:cssText(args.belowstyle)<br />
:newline()<br />
:wikitext(args.below)<br />
end<br />
<br />
if not child then<br />
if args.navbar ~= cfg.i18n.navbar_none and args.navbar ~= cfg.i18n.navbar_off and<br />
(args.name or frame:getParent():getTitle():gsub(cfg.i18n.pattern.sandbox, '') ~=<br />
cfg.i18n.title_not_to_add_navbar) then<br />
root<br />
:tag('tr')<br />
:tag('td')<br />
:addClass(cfg.i18n.class.navbar)<br />
:cssText(args.navbarstyle)<br />
:wikitext(require('Module:Navbar')._navbar{<br />
args.name,<br />
mini = 1,<br />
fontstyle = args.navbarfontstyle<br />
})<br />
end<br />
end<br />
<br />
local base_templatestyles = frame:extensionTag{<br />
name = 'templatestyles', args = { src = cfg.i18n.templatestyles }<br />
}<br />
<br />
local templatestyles = ''<br />
if args['templatestyles'] and args['templatestyles'] ~= '' then<br />
templatestyles = frame:extensionTag{<br />
name = 'templatestyles', args = { src = args['templatestyles'] }<br />
}<br />
end<br />
<br />
local child_templatestyles = ''<br />
if args['child templatestyles'] and args['child templatestyles'] ~= '' then<br />
child_templatestyles = frame:extensionTag{<br />
name = 'templatestyles', args = { src = args['child templatestyles'] }<br />
}<br />
end<br />
<br />
local grandchild_templatestyles = ''<br />
if args['grandchild templatestyles'] and args['grandchild templatestyles'] ~= '' then<br />
grandchild_templatestyles = frame:extensionTag{<br />
name = 'templatestyles', args = { src = args['grandchild templatestyles'] }<br />
}<br />
end<br />
<br />
return table.concat({<br />
base_templatestyles,<br />
templatestyles,<br />
child_templatestyles,<br />
grandchild_templatestyles,<br />
tostring(root),<br />
(child and cfg.i18n.category.child or ''),<br />
categorizeTemplatesWithInlineStyles(args)<br />
})<br />
end<br />
<br />
local function list_title(args, is_centered_list_titles, num)<br />
<br />
local title_text = trimAndAddAutomaticNewline(args['list' .. num .. 'title']<br />
or cfg.i18n.default_list_title)<br />
<br />
local title<br />
if is_centered_list_titles then<br />
-- collapsible can be finicky, so provide some CSS/HTML to support<br />
title = mw.html.create('div')<br />
:addClass(cfg.i18n.class.list_title_centered)<br />
:wikitext(title_text)<br />
else<br />
title = mw.html.create()<br />
:wikitext(title_text)<br />
end<br />
<br />
local title_container = mw.html.create('div')<br />
:addClass(cfg.i18n.class.list_title)<br />
-- don't /need/ a listnumtitleclass because you can do<br />
-- .templateclass .listnumclass .sidebar-list-title<br />
:addClass(args.listtitleclass)<br />
:cssText(args.basestyle)<br />
:cssText(args.listtitlestyle)<br />
:cssText(args['list' .. num .. 'titlestyle'])<br />
:node(title)<br />
:done()<br />
<br />
return title_container<br />
end<br />
<br />
--[[<br />
Main entry point for sidebar with collapsible lists.<br />
Does the work of creating the collapsible lists themselves and including them<br />
into the args.<br />
]]<br />
function p.collapsible(frame)<br />
local args = getArgs(frame)<br />
if not args.name and<br />
frame:getParent():getTitle():gsub(cfg.i18n.pattern.collapse_sandbox, '') ==<br />
cfg.i18n.collapse_title_not_to_add_navbar then<br />
args.navbar = cfg.i18n.navbar_none<br />
end<br />
<br />
local contentArgs = {}<br />
<br />
local is_centered_list_titles<br />
if args['centered list titles'] and args['centered list titles'] ~= '' then<br />
is_centered_list_titles = true<br />
else<br />
is_centered_list_titles = false<br />
end<br />
<br />
for k, v in pairs(args) do<br />
local num = string.match(k, '^list(%d+)$')<br />
if num then<br />
local expand = args.expanded and<br />
(args.expanded == 'all' or args.expanded == args['list' .. num .. 'name'])<br />
local row = mw.html.create('div')<br />
row<br />
:addClass(cfg.i18n.class.list)<br />
:addClass('mw-collapsible')<br />
:addClass((not expand) and 'mw-collapsed' or nil)<br />
:addClass(args['list' .. num .. 'class'])<br />
:cssText(args.listframestyle)<br />
:cssText(args['list' .. num .. 'framestyle'])<br />
:node(list_title(args, is_centered_list_titles, num))<br />
:tag('div')<br />
:addClass(cfg.i18n.class.list_content)<br />
:addClass('mw-collapsible-content')<br />
-- don't /need/ a listnumstyleclass because you can do<br />
-- .templatename .listnumclass .sidebar-list<br />
:addClass(args.listclass)<br />
:cssText(args.liststyle)<br />
:cssText(args['list' .. num .. 'style'])<br />
:wikitext(trimAndAddAutomaticNewline(args['list' .. num]))<br />
<br />
contentArgs['content' .. num] = tostring(row)<br />
end<br />
end<br />
<br />
for k, v in pairs(contentArgs) do<br />
args[k] = v<br />
end<br />
<br />
return p.sidebar(frame, args, cfg.i18n.class.collapse)<br />
end<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Protection_banner/config&diff=536Module:Protection banner/config2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>-- This module provides configuration data for [[Module:Protection banner]].<br />
<br />
return {<br />
<br />
--------------------------------------------------------------------------------<br />
--<br />
-- BANNER DATA<br />
--<br />
--------------------------------------------------------------------------------<br />
<br />
--[[<br />
-- Banner data consists of six fields:<br />
-- * text - the main protection text that appears at the top of protection<br />
-- banners.<br />
-- * explanation - the text that appears below the main protection text, used<br />
-- to explain the details of the protection.<br />
-- * tooltip - the tooltip text you see when you move the mouse over a small<br />
-- padlock icon.<br />
-- * link - the page that the small padlock icon links to.<br />
-- * alt - the alt text for the small padlock icon. This is also used as tooltip<br />
-- text for the large protection banners.<br />
-- * image - the padlock image used in both protection banners and small padlock<br />
-- icons.<br />
--<br />
-- The module checks in three separate tables to find a value for each field.<br />
-- First it checks the banners table, which has values specific to the reason<br />
-- for the page being protected. Then the module checks the defaultBanners<br />
-- table, which has values specific to each protection level. Finally, the<br />
-- module checks the masterBanner table, which holds data for protection<br />
-- templates to use if no data has been found in the previous two tables.<br />
--<br />
-- The values in the banner data can take parameters. These are specified<br />
-- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name<br />
-- enclosed in curly braces).<br />
--<br />
-- Available parameters:<br />
--<br />
-- ${CURRENTVERSION} - a link to the page history or the move log, with the<br />
-- display message "current-version-edit-display" or<br />
-- "current-version-move-display".<br />
--<br />
-- ${EDITREQUEST} - a link to create an edit request for the current page.<br />
--<br />
-- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes<br />
-- on the talk page; you may submit a request to ask an administrator to make<br />
-- an edit if it is minor or supported by consensus."<br />
--<br />
-- ${IMAGELINK} - a link to set the image to, depending on the protection<br />
-- action and protection level.<br />
--<br />
-- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry<br />
-- is set. E.g. "Editing of this page by new or unregistered users is currently <br />
-- disabled until dd Month YYYY."<br />
--<br />
-- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation<br />
-- so that it can be used in run-on sentences.<br />
--<br />
-- ${PAGETYPE} - the type of the page, e.g. "article" or "template".<br />
-- Defined in the cfg.pagetypes table.<br />
--<br />
-- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g.<br />
-- "Editing of this page by new or unregistered users is currently disabled"<br />
--<br />
-- ${PROTECTIONDATE} - the protection date, if it has been supplied to the<br />
-- template.<br />
--<br />
-- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or<br />
-- "semi-protected".<br />
--<br />
-- ${PROTECTIONLOG} - a link to the protection log or the pending changes log,<br />
-- depending on the protection action.<br />
--<br />
-- ${TALKPAGE} - a link to the talk page. If a section is specified, links<br />
-- straight to that talk page section.<br />
--<br />
-- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to<br />
-- create a blurb like "This template is semi-protected", or "This article is<br />
-- move-protected until DD Month YYYY".<br />
--<br />
-- ${VANDAL} - links for the specified username (or the root page name)<br />
-- using Module:Vandal-m.<br />
--<br />
-- Functions<br />
--<br />
-- For advanced users, it is possible to use Lua functions instead of strings<br />
-- in the banner config tables. Using functions gives flexibility that is not<br />
-- possible just by using parameters. Functions take two arguments, the<br />
-- protection object and the template arguments, and they must output a string.<br />
--<br />
-- For example:<br />
--<br />
-- text = function (protectionObj, args)<br />
-- if protectionObj.level == 'autoconfirmed' then<br />
-- return 'foo'<br />
-- else<br />
-- return 'bar'<br />
-- end<br />
-- end<br />
--<br />
-- Some protection object properties and methods that may be useful:<br />
-- protectionObj.action - the protection action<br />
-- protectionObj.level - the protection level<br />
-- protectionObj.reason - the protection reason<br />
-- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set<br />
-- to indefinite, and the protection time in unix time if temporary.<br />
-- protectionObj.protectionDate - the protection date in unix time, or nil if<br />
-- unspecified.<br />
-- protectionObj.bannerConfig - the banner config found by the module. Beware<br />
-- of editing the config field used by the function, as it could create an<br />
-- infinite loop.<br />
-- protectionObj:isProtected - returns a boolean showing whether the page is<br />
-- protected.<br />
-- protectionObj:isTemporary - returns a boolean showing whether the expiry is<br />
-- temporary.<br />
-- protectionObj:isIncorrect - returns a boolean showing whether the protection<br />
-- template is incorrect.<br />
--]]<br />
<br />
-- The master banner data, used if no values have been found in banners or<br />
-- defaultBanners.<br />
masterBanner = {<br />
text = '${INTROBLURB}',<br />
explanation = '${EXPLANATIONBLURB}',<br />
tooltip = '${TOOLTIPBLURB}',<br />
link = '${IMAGELINK}',<br />
alt = 'Page ${PROTECTIONLEVEL}'<br />
},<br />
<br />
-- The default banner data. This holds banner data for different protection<br />
-- levels.<br />
-- *required* - this table needs edit, move, autoreview and upload subtables.<br />
defaultBanners = {<br />
edit = {},<br />
move = {},<br />
autoreview = {<br />
default = {<br />
alt = 'Page protected with pending changes',<br />
tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users',<br />
image = 'Pending-protection-shackle.svg'<br />
}<br />
},<br />
upload = {}<br />
},<br />
<br />
-- The banner data. This holds banner data for different protection reasons.<br />
-- In fact, the reasons specified in this table control which reasons are<br />
-- valid inputs to the first positional parameter.<br />
--<br />
-- There is also a non-standard "description" field that can be used for items<br />
-- in this table. This is a description of the protection reason for use in the<br />
-- module documentation.<br />
--<br />
-- *required* - this table needs edit, move, autoreview and upload subtables.<br />
banners = {<br />
edit = {<br />
blp = {<br />
description = 'For pages protected to promote compliance with the'<br />
.. ' [[Wikipedia:Biographies of living persons'<br />
.. '|biographies of living persons]] policy',<br />
text = '${INTROFRAGMENT} to promote compliance with'<br />
.. ' [[Wikipedia:Biographies of living persons'<br />
.. "|Wikipedia's&nbsp;policy on&nbsp;the&nbsp;biographies"<br />
.. ' of&nbsp;living&nbsp;people]].',<br />
tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on'<br />
.. ' biographies of living persons',<br />
},<br />
dmca = {<br />
description = 'For pages protected by the Wikimedia Foundation'<br />
.. ' due to [[Digital Millennium Copyright Act]] takedown requests',<br />
explanation = function (protectionObj, args)<br />
local ret = 'Pursuant to a rights owner notice under the Digital'<br />
.. ' Millennium Copyright Act (DMCA) regarding some content'<br />
.. ' in this article, the Wikimedia Foundation acted under'<br />
.. ' applicable law and took down and restricted the content'<br />
.. ' in question.'<br />
if args.notice then<br />
ret = ret .. ' A copy of the received notice can be found here: '<br />
.. args.notice .. '.'<br />
end<br />
ret = ret .. ' For more information, including websites discussing'<br />
.. ' how to file a counter-notice, please see'<br />
.. " [[Wikipedia:Office actions]] and the article's ${TALKPAGE}."<br />
.. "'''Do not remove this template from the article until the"<br />
.. " restrictions are withdrawn'''."<br />
return ret<br />
end,<br />
image = 'Office-protection-shackle.svg',<br />
},<br />
dispute = {<br />
description = 'For pages protected due to editing disputes',<br />
text = function (protectionObj, args)<br />
-- Find the value of "disputes".<br />
local display = 'disputes'<br />
local disputes<br />
if args.section then<br />
disputes = string.format(<br />
'[[%s:%s#%s|%s]]',<br />
mw.site.namespaces[protectionObj.title.namespace].talk.name,<br />
protectionObj.title.text,<br />
args.section,<br />
display<br />
)<br />
else<br />
disputes = display<br />
end<br />
<br />
-- Make the blurb, depending on the expiry.<br />
local msg<br />
if type(protectionObj.expiry) == 'number' then<br />
msg = '${INTROFRAGMENT} or until editing %s have been resolved.'<br />
else<br />
msg = '${INTROFRAGMENT} until editing %s have been resolved.'<br />
end<br />
return string.format(msg, disputes)<br />
end,<br />
explanation = "This protection is '''not''' an endorsement of the"<br />
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}',<br />
tooltip = '${TOOLTIPFRAGMENT} due to editing disputes',<br />
},<br />
ecp = {<br />
description = 'For articles in topic areas authorized by'<br />
.. ' [[Wikipedia:Arbitration Committee|ArbCom]] or'<br />
.. ' meets the criteria for community use',<br />
tooltip = 'This ${PAGETYPE} is extended-confirmed protected',<br />
alt = 'Extended-protected ${PAGETYPE}',<br />
},<br />
mainpage = {<br />
description = 'For pages protected for being displayed on the [[Main Page]]',<br />
text = 'This file is currently'<br />
.. ' [[Wikipedia:This page is protected|protected]] from'<br />
.. ' editing because it is currently or will soon be displayed'<br />
.. ' on the [[Main Page]].',<br />
explanation = 'Images on the Main Page are protected due to their high'<br />
.. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.'<br />
.. '<br /><span style="font-size:90%;">'<br />
.. "'''Administrators:''' Once this image is definitely off the Main Page,"<br />
.. ' please unprotect this file, or reduce to semi-protection,'<br />
.. ' as appropriate.</span>',<br />
},<br />
office = {<br />
description = 'For pages protected by the Wikimedia Foundation',<br />
text = function (protectionObj, args)<br />
local ret = 'This ${PAGETYPE} is currently under the'<br />
.. ' scrutiny of the'<br />
.. ' [[Wikipedia:Office actions|Wikimedia Foundation Office]]'<br />
.. ' and is protected.'<br />
if protectionObj.protectionDate then<br />
ret = ret .. ' It has been protected since ${PROTECTIONDATE}.'<br />
end<br />
return ret<br />
end,<br />
explanation = "If you can edit this page, please discuss all changes and"<br />
.. " additions on the ${TALKPAGE} first. '''Do not remove protection from this"<br />
.. " page unless you are authorized by the Wikimedia Foundation to do"<br />
.. " so.'''",<br />
image = 'Office-protection-shackle.svg',<br />
},<br />
reset = {<br />
description = 'For pages protected by the Wikimedia Foundation and'<br />
.. ' "reset" to a bare-bones version',<br />
text = 'This ${PAGETYPE} is currently under the'<br />
.. ' scrutiny of the'<br />
.. ' [[Wikipedia:Office actions|Wikimedia Foundation Office]]'<br />
.. ' and is protected.',<br />
explanation = function (protectionObj, args)<br />
local ret = ''<br />
if protectionObj.protectionDate then<br />
ret = ret .. 'On ${PROTECTIONDATE} this ${PAGETYPE} was'<br />
else<br />
ret = ret .. 'This ${PAGETYPE} has been'<br />
end<br />
ret = ret .. ' reduced to a'<br />
.. ' simplified, "bare bones" version so that it may be completely'<br />
.. ' rewritten to ensure it meets the policies of'<br />
.. ' [[WP:NPOV|Neutral Point of View]] and [[WP:V|Verifiability]].'<br />
.. ' Standard Wikipedia policies will apply to its rewriting—which'<br />
.. ' will eventually be open to all editors—and will be strictly'<br />
.. ' enforced. The ${PAGETYPE} has been ${PROTECTIONLEVEL} while'<br />
.. ' it is being rebuilt.\n\n'<br />
.. 'Any insertion of material directly from'<br />
.. ' pre-protection revisions of the ${PAGETYPE} will be removed, as'<br />
.. ' will any material added to the ${PAGETYPE} that is not properly'<br />
.. ' sourced. The associated talk page(s) were also cleared on the'<br />
.. " same date.\n\n"<br />
.. "If you can edit this page, please discuss all changes and"<br />
.. " additions on the ${TALKPAGE} first. '''Do not override"<br />
.. " this action, and do not remove protection from this page,"<br />
.. " unless you are authorized by the Wikimedia Foundation"<br />
.. " to do so. No editor may remove this notice.'''"<br />
<br />
return ret<br />
end,<br />
image = 'Office-protection-shackle.svg',<br />
},<br />
sock = {<br />
description = 'For pages protected due to'<br />
.. ' [[Wikipedia:Sock puppetry|sock puppetry]]',<br />
text = '${INTROFRAGMENT} to prevent [[Wikipedia:Sock puppetry|sock puppets]] of'<br />
.. ' [[Wikipedia:Blocking policy|blocked]] or'<br />
.. ' [[Wikipedia:Banning policy|banned users]]'<br />
.. ' from editing it.',<br />
tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from'<br />
.. ' editing it',<br />
},<br />
template = {<br />
description = 'For [[Wikipedia:High-risk templates|high-risk]]'<br />
.. ' templates and Lua modules',<br />
text = 'This is a permanently [[Help:Protection|protected]] ${PAGETYPE},'<br />
.. ' as it is [[Wikipedia:High-risk templates|high-risk]].',<br />
explanation = 'Please discuss any changes on the ${TALKPAGE}; you may'<br />
.. ' ${EDITREQUEST} to ask an'<br />
.. ' [[Wikipedia:Administrators|administrator]] or'<br />
.. ' [[Wikipedia:Template editor|template editor]] to make an edit if'<br />
.. ' it is [[Help:Minor edit#When to mark an edit as a minor edit'<br />
.. '|uncontroversial]] or supported by'<br />
.. ' [[Wikipedia:Consensus|consensus]]. You can also'<br />
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'<br />
.. ' unprotected.',<br />
tooltip = 'This high-risk ${PAGETYPE} is permanently ${PROTECTIONLEVEL}'<br />
.. ' to prevent vandalism',<br />
alt = 'Permanently protected ${PAGETYPE}',<br />
},<br />
usertalk = {<br />
description = 'For pages protected against disruptive edits by a'<br />
.. ' particular user',<br />
text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,'<br />
.. ' such as abusing the'<br />
.. ' &#123;&#123;[[Template:unblock|unblock]]&#125;&#125; template.',<br />
explanation = 'If you cannot edit this user talk page and you need to'<br />
.. ' make a change or leave a message, you can'<br />
.. ' [[Wikipedia:Requests for page protection'<br />
.. '#Current requests for edits to a protected page'<br />
.. '|request an edit]],'<br />
.. ' [[Wikipedia:Requests for page protection'<br />
.. '#Current requests for reduction in protection level'<br />
.. '|request unprotection]],'<br />
.. ' [[Special:Userlogin|log in]],'<br />
.. ' or [[Special:UserLogin/signup|create an account]].',<br />
},<br />
vandalism = {<br />
description = 'For pages protected against'<br />
.. ' [[Wikipedia:Vandalism|vandalism]]',<br />
text = '${INTROFRAGMENT} due to [[Wikipedia:Vandalism|vandalism]].',<br />
explanation = function (protectionObj, args)<br />
local ret = ''<br />
if protectionObj.level == 'sysop' then<br />
ret = ret .. "This protection is '''not''' an endorsement of the"<br />
.. ' ${CURRENTVERSION}. '<br />
end<br />
return ret .. '${EXPLANATIONBLURB}'<br />
end,<br />
tooltip = '${TOOLTIPFRAGMENT} due to vandalism',<br />
}<br />
},<br />
move = {<br />
dispute = {<br />
description = 'For pages protected against page moves due to'<br />
.. ' disputes over the page title',<br />
explanation = "This protection is '''not''' an endorsement of the"<br />
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}',<br />
image = 'Move-protection-shackle.svg'<br />
},<br />
vandalism = {<br />
description = 'For pages protected against'<br />
.. ' [[Wikipedia:Vandalism#Page-move vandalism'<br />
.. ' |page-move vandalism]]'<br />
}<br />
},<br />
autoreview = {},<br />
upload = {}<br />
},<br />
<br />
--------------------------------------------------------------------------------<br />
--<br />
-- GENERAL DATA TABLES<br />
--<br />
--------------------------------------------------------------------------------<br />
<br />
--------------------------------------------------------------------------------<br />
-- Protection blurbs<br />
--------------------------------------------------------------------------------<br />
<br />
-- This table produces the protection blurbs available with the<br />
-- ${PROTECTIONBLURB} parameter. It is sorted by protection action and<br />
-- protection level, and is checked by the module in the following order:<br />
-- 1. page's protection action, page's protection level<br />
-- 2. page's protection action, default protection level<br />
-- 3. "edit" protection action, default protection level<br />
--<br />
-- It is possible to use banner parameters inside this table.<br />
-- *required* - this table needs edit, move, autoreview and upload subtables.<br />
protectionBlurbs = {<br />
edit = {<br />
default = 'This ${PAGETYPE} is currently [[Help:Protection|'<br />
.. 'protected]] from editing',<br />
autoconfirmed = 'Editing of this ${PAGETYPE} by [[Wikipedia:User access'<br />
.. ' levels#New users|new]] or [[Wikipedia:User access levels#Unregistered'<br />
.. ' users|unregistered]] users is currently [[Help:Protection|disabled]]',<br />
extendedconfirmed = 'This ${PAGETYPE} is currently under extended confirmed protection',<br />
},<br />
move = {<br />
default = 'This ${PAGETYPE} is currently [[Help:Protection|protected]]'<br />
.. ' from [[Help:Moving a page|page moves]]'<br />
},<br />
autoreview = {<br />
default = 'All edits made to this ${PAGETYPE} by'<br />
.. ' [[Wikipedia:User access levels#New users|new]] or'<br />
.. ' [[Wikipedia:User access levels#Unregistered users|unregistered]]'<br />
.. ' users are currently'<br />
.. ' [[Wikipedia:Pending changes|subject to review]]'<br />
},<br />
upload = {<br />
default = 'Uploading new versions of this ${PAGETYPE} is currently disabled'<br />
}<br />
},<br />
<br />
<br />
--------------------------------------------------------------------------------<br />
-- Explanation blurbs<br />
--------------------------------------------------------------------------------<br />
<br />
-- This table produces the explanation blurbs available with the<br />
-- ${EXPLANATIONBLURB} parameter. It is sorted by protection action,<br />
-- protection level, and whether the page is a talk page or not. If the page is<br />
-- a talk page it will have a talk key of "talk"; otherwise it will have a talk<br />
-- key of "subject". The table is checked in the following order:<br />
-- 1. page's protection action, page's protection level, page's talk key<br />
-- 2. page's protection action, page's protection level, default talk key<br />
-- 3. page's protection action, default protection level, page's talk key<br />
-- 4. page's protection action, default protection level, default talk key<br />
--<br />
-- It is possible to use banner parameters inside this table.<br />
-- *required* - this table needs edit, move, autoreview and upload subtables.<br />
explanationBlurbs = {<br />
edit = {<br />
autoconfirmed = {<br />
subject = 'See the [[Wikipedia:Protection policy|'<br />
.. 'protection policy]] and ${PROTECTIONLOG} for more details. If you'<br />
.. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can'<br />
.. ' ${EDITREQUEST}, discuss changes on the ${TALKPAGE},'<br />
.. ' [[Wikipedia:Requests for page protection'<br />
.. '#Current requests for reduction in protection level'<br />
.. '|request unprotection]], [[Special:Userlogin|log in]], or'<br />
.. ' [[Special:UserLogin/signup|create an account]].',<br />
default = 'See the [[Wikipedia:Protection policy|'<br />
.. 'protection policy]] and ${PROTECTIONLOG} for more details. If you'<br />
.. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can'<br />
.. ' [[Wikipedia:Requests for page protection'<br />
.. '#Current requests for reduction in protection level'<br />
.. '|request unprotection]], [[Special:Userlogin|log in]], or'<br />
.. ' [[Special:UserLogin/signup|create an account]].',<br />
},<br />
extendedconfirmed = {<br />
default = 'Extended confirmed protection prevents edits from all unregistered editors'<br />
.. ' and registered users with fewer than 30 days tenure and 500 edits.'<br />
.. ' The [[Wikipedia:Protection policy#extended|policy on community use]]'<br />
.. ' specifies that extended confirmed protection can be applied to combat'<br />
.. ' disruption, if semi-protection has proven to be ineffective.'<br />
.. ' Extended confirmed protection may also be applied to enforce'<br />
.. ' [[Wikipedia:Arbitration Committee|arbitration sanctions]].'<br />
.. ' Please discuss any changes on the ${TALKPAGE}; you may'<br />
.. ' ${EDITREQUEST} to ask for uncontroversial changes supported by'<br />
.. ' [[Wikipedia:Consensus|consensus]].'<br />
},<br />
default = {<br />
subject = 'See the [[Wikipedia:Protection policy|'<br />
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'<br />
.. ' Please discuss any changes on the ${TALKPAGE}; you'<br />
.. ' may ${EDITREQUEST} to ask an'<br />
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'<br />
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'<br />
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'<br />
.. '|consensus]]. You may also [[Wikipedia:Requests for'<br />
.. ' page protection#Current requests for reduction in protection level'<br />
.. '|request]] that this page be unprotected.',<br />
default = 'See the [[Wikipedia:Protection policy|'<br />
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'<br />
.. ' You may [[Wikipedia:Requests for page'<br />
.. ' protection#Current requests for edits to a protected page|request an'<br />
.. ' edit]] to this page, or [[Wikipedia:Requests for'<br />
.. ' page protection#Current requests for reduction in protection level'<br />
.. '|ask]] for it to be unprotected.'<br />
}<br />
},<br />
move = {<br />
default = {<br />
subject = 'See the [[Wikipedia:Protection policy|'<br />
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'<br />
.. ' The page may still be edited but cannot be moved'<br />
.. ' until unprotected. Please discuss any suggested moves on the'<br />
.. ' ${TALKPAGE} or at [[Wikipedia:Requested moves]]. You can also'<br />
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'<br />
.. ' unprotected.',<br />
default = 'See the [[Wikipedia:Protection policy|'<br />
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'<br />
.. ' The page may still be edited but cannot be moved'<br />
.. ' until unprotected. Please discuss any suggested moves at'<br />
.. ' [[Wikipedia:Requested moves]]. You can also'<br />
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'<br />
.. ' unprotected.'<br />
}<br />
},<br />
autoreview = {<br />
default = {<br />
default = 'See the [[Wikipedia:Protection policy|'<br />
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'<br />
.. ' Edits to this ${PAGETYPE} by new and unregistered users'<br />
.. ' will not be visible to readers until they are accepted by'<br />
.. ' a reviewer. To avoid the need for your edits to be'<br />
.. ' reviewed, you may'<br />
.. ' [[Wikipedia:Requests for page protection'<br />
.. '#Current requests for reduction in protection level'<br />
.. '|request unprotection]], [[Special:Userlogin|log in]], or'<br />
.. ' [[Special:UserLogin/signup|create an account]].'<br />
},<br />
},<br />
upload = {<br />
default = {<br />
default = 'See the [[Wikipedia:Protection policy|'<br />
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'<br />
.. ' The page may still be edited but new versions of the file'<br />
.. ' cannot be uploaded until it is unprotected. You can'<br />
.. ' request that a new version be uploaded by using a'<br />
.. ' [[Wikipedia:Edit requests|protected edit request]], or you'<br />
.. ' can [[Wikipedia:Requests for page protection|request]]'<br />
.. ' that the file be unprotected.'<br />
}<br />
}<br />
},<br />
<br />
--------------------------------------------------------------------------------<br />
-- Protection levels<br />
--------------------------------------------------------------------------------<br />
<br />
-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which<br />
-- produces a short label for different protection levels. It is sorted by<br />
-- protection action and protection level, and is checked in the following<br />
-- order:<br />
-- 1. page's protection action, page's protection level<br />
-- 2. page's protection action, default protection level<br />
-- 3. "edit" protection action, default protection level<br />
--<br />
-- It is possible to use banner parameters inside this table.<br />
-- *required* - this table needs edit, move, autoreview and upload subtables.<br />
protectionLevels = {<br />
edit = {<br />
default = 'protected',<br />
templateeditor = 'template-protected',<br />
extendedconfirmed = 'extended-protected',<br />
autoconfirmed = 'semi-protected',<br />
},<br />
move = {<br />
default = 'move-protected'<br />
},<br />
autoreview = {<br />
},<br />
upload = {<br />
default = 'upload-protected'<br />
}<br />
},<br />
<br />
--------------------------------------------------------------------------------<br />
-- Images<br />
--------------------------------------------------------------------------------<br />
<br />
-- This table lists different padlock images for each protection action and<br />
-- protection level. It is used if an image is not specified in any of the<br />
-- banner data tables, and if the page does not satisfy the conditions for using<br />
-- the ['image-filename-indef'] image. It is checked in the following order:<br />
-- 1. page's protection action, page's protection level<br />
-- 2. page's protection action, default protection level<br />
images = {<br />
edit = {<br />
default = 'Full-protection-shackle.svg',<br />
templateeditor = 'Template-protection-shackle.svg',<br />
extendedconfirmed = 'Extended-protection-shackle.svg',<br />
autoconfirmed = 'Semi-protection-shackle.svg'<br />
},<br />
move = {<br />
default = 'Move-protection-shackle.svg',<br />
},<br />
autoreview = {<br />
default = 'Pending-protection-shackle.svg'<br />
},<br />
upload = {<br />
default = 'Upload-protection-shackle.svg'<br />
}<br />
},<br />
<br />
-- Pages with a reason specified in this table will show the special "indef"<br />
-- padlock, defined in the 'image-filename-indef' message, if no expiry is set.<br />
indefImageReasons = {<br />
template = true<br />
},<br />
<br />
--------------------------------------------------------------------------------<br />
-- Image links<br />
--------------------------------------------------------------------------------<br />
<br />
-- This table provides the data for the ${IMAGELINK} parameter, which gets<br />
-- the image link for small padlock icons based on the page's protection action<br />
-- and protection level. It is checked in the following order:<br />
-- 1. page's protection action, page's protection level<br />
-- 2. page's protection action, default protection level<br />
-- 3. "edit" protection action, default protection level<br />
--<br />
-- It is possible to use banner parameters inside this table.<br />
-- *required* - this table needs edit, move, autoreview and upload subtables.<br />
imageLinks = {<br />
edit = {<br />
default = 'Wikipedia:Protection policy#full',<br />
templateeditor = 'Wikipedia:Protection policy#template',<br />
extendedconfirmed = 'Wikipedia:Protection policy#extended',<br />
autoconfirmed = 'Wikipedia:Protection policy#semi'<br />
},<br />
move = {<br />
default = 'Wikipedia:Protection policy#move'<br />
},<br />
autoreview = {<br />
default = 'Wikipedia:Protection policy#pending'<br />
},<br />
upload = {<br />
default = 'Wikipedia:Protection policy#upload'<br />
}<br />
},<br />
<br />
--------------------------------------------------------------------------------<br />
-- Padlock indicator names<br />
--------------------------------------------------------------------------------<br />
<br />
-- This table provides the "name" attribute for the <indicator> extension tag<br />
-- with which small padlock icons are generated. All indicator tags on a page<br />
-- are displayed in alphabetical order based on this attribute, and with<br />
-- indicator tags with duplicate names, the last tag on the page wins.<br />
-- The attribute is chosen based on the protection action; table keys must be a<br />
-- protection action name or the string "default".<br />
padlockIndicatorNames = {<br />
autoreview = 'pp-autoreview',<br />
default = 'pp-default'<br />
},<br />
<br />
--------------------------------------------------------------------------------<br />
-- Protection categories<br />
--------------------------------------------------------------------------------<br />
<br />
--[[<br />
-- The protection categories are stored in the protectionCategories table.<br />
-- Keys to this table are made up of the following strings:<br />
--<br />
-- 1. the expiry date<br />
-- 2. the namespace<br />
-- 3. the protection reason (e.g. "dispute" or "vandalism")<br />
-- 4. the protection level (e.g. "sysop" or "autoconfirmed")<br />
-- 5. the action (e.g. "edit" or "move")<br />
-- <br />
-- When the module looks up a category in the table, first it will will check to<br />
-- see a key exists that corresponds to all five parameters. For example, a<br />
-- user page semi-protected from vandalism for two weeks would have the key<br />
-- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module<br />
-- changes the first part of the key to "all" and checks the table again. It<br />
-- keeps checking increasingly generic key combinations until it finds the<br />
-- field, or until it reaches the key "all-all-all-all-all".<br />
--<br />
-- The module uses a binary matrix to determine the order in which to search.<br />
-- This is best demonstrated by a table. In this table, the "0" values<br />
-- represent "all", and the "1" values represent the original data (e.g.<br />
-- "indef" or "file" or "vandalism").<br />
--<br />
-- expiry namespace reason level action<br />
-- order<br />
-- 1 1 1 1 1 1<br />
-- 2 0 1 1 1 1<br />
-- 3 1 0 1 1 1<br />
-- 4 0 0 1 1 1<br />
-- 5 1 1 0 1 1<br />
-- 6 0 1 0 1 1<br />
-- 7 1 0 0 1 1<br />
-- 8 0 0 0 1 1<br />
-- 9 1 1 1 0 1<br />
-- 10 0 1 1 0 1<br />
-- 11 1 0 1 0 1<br />
-- 12 0 0 1 0 1<br />
-- 13 1 1 0 0 1<br />
-- 14 0 1 0 0 1<br />
-- 15 1 0 0 0 1<br />
-- 16 0 0 0 0 1<br />
-- 17 1 1 1 1 0<br />
-- 18 0 1 1 1 0<br />
-- 19 1 0 1 1 0<br />
-- 20 0 0 1 1 0<br />
-- 21 1 1 0 1 0<br />
-- 22 0 1 0 1 0<br />
-- 23 1 0 0 1 0<br />
-- 24 0 0 0 1 0<br />
-- 25 1 1 1 0 0<br />
-- 26 0 1 1 0 0<br />
-- 27 1 0 1 0 0<br />
-- 28 0 0 1 0 0<br />
-- 29 1 1 0 0 0<br />
-- 30 0 1 0 0 0<br />
-- 31 1 0 0 0 0<br />
-- 32 0 0 0 0 0<br />
--<br />
-- In this scheme the action has the highest priority, as it is the last<br />
-- to change, and the expiry has the least priority, as it changes the most.<br />
-- The priorities of the expiry, the protection level and the action are<br />
-- fixed, but the priorities of the reason and the namespace can be swapped<br />
-- through the use of the cfg.bannerDataNamespaceHasPriority table.<br />
--]]<br />
<br />
-- If the reason specified to the template is listed in this table,<br />
-- namespace data will take priority over reason data in the protectionCategories<br />
-- table.<br />
reasonsWithNamespacePriority = {<br />
vandalism = true,<br />
},<br />
<br />
-- The string to use as a namespace key for the protectionCategories table for each<br />
-- namespace number.<br />
categoryNamespaceKeys = {<br />
[ 2] = 'user',<br />
[ 3] = 'user',<br />
[ 4] = 'project',<br />
[ 6] = 'file',<br />
[ 8] = 'mediawiki',<br />
[ 10] = 'template',<br />
[ 12] = 'project',<br />
[ 14] = 'category',<br />
[100] = 'portal',<br />
[828] = 'module',<br />
},<br />
<br />
protectionCategories = {<br />
['all|all|all|all|all'] = 'Wikipedia fully protected pages',<br />
['all|all|office|all|all'] = 'Wikipedia Office-protected pages',<br />
['all|all|reset|all|all'] = 'Wikipedia Office-protected pages',<br />
['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages',<br />
['all|all|mainpage|all|all'] = 'Wikipedia fully-protected main page files',<br />
['all|all|all|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages',<br />
['all|all|ecp|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages',<br />
['all|template|all|all|edit'] = 'Wikipedia fully protected templates',<br />
['all|all|all|autoconfirmed|edit'] = 'Wikipedia semi-protected pages',<br />
['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages',<br />
['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people',<br />
['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people',<br />
['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute',<br />
['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users',<br />
['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism',<br />
['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories',<br />
['all|file|all|autoconfirmed|edit'] = 'Wikipedia semi-protected files',<br />
['all|portal|all|autoconfirmed|edit'] = 'Wikipedia semi-protected portals',<br />
['all|project|all|autoconfirmed|edit'] = 'Wikipedia semi-protected project pages',<br />
['all|talk|all|autoconfirmed|edit'] = 'Wikipedia semi-protected talk pages',<br />
['all|template|all|autoconfirmed|edit'] = 'Wikipedia semi-protected templates',<br />
['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages',<br />
['all|all|all|templateeditor|edit'] = 'Wikipedia template-protected pages other than templates and modules',<br />
['all|template|all|templateeditor|edit'] = 'Wikipedia template-protected templates',<br />
['all|template|all|templateeditor|move'] = 'Wikipedia template-protected templates', -- move-protected templates<br />
['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people',<br />
['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people',<br />
['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute',<br />
['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users',<br />
['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism',<br />
['all|category|all|sysop|edit'] = 'Wikipedia fully protected categories',<br />
['all|file|all|sysop|edit'] = 'Wikipedia fully-protected files',<br />
['all|project|all|sysop|edit'] = 'Wikipedia fully-protected project pages',<br />
['all|talk|all|sysop|edit'] = 'Wikipedia fully-protected talk pages',<br />
['all|template|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected templates',<br />
['all|template|all|sysop|edit'] = 'Wikipedia fully protected templates',<br />
['all|user|all|sysop|edit'] = 'Wikipedia fully protected user and user talk pages',<br />
['all|module|all|all|edit'] = 'Wikipedia fully-protected modules',<br />
['all|module|all|templateeditor|edit'] = 'Wikipedia template-protected modules',<br />
['all|module|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected modules',<br />
['all|module|all|autoconfirmed|edit'] = 'Wikipedia semi-protected modules',<br />
['all|all|all|sysop|move'] = 'Wikipedia move-protected pages',<br />
['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages',<br />
['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute',<br />
['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism',<br />
['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals',<br />
['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages',<br />
['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages',<br />
['all|template|all|sysop|move'] = 'Wikipedia move-protected templates',<br />
['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages',<br />
['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages',<br />
['all|file|all|all|upload'] = 'Wikipedia upload-protected files',<br />
},<br />
<br />
--------------------------------------------------------------------------------<br />
-- Expiry category config<br />
--------------------------------------------------------------------------------<br />
<br />
-- This table configures the expiry category behaviour for each protection<br />
-- action.<br />
-- * If set to true, setting that action will always categorise the page if<br />
-- an expiry parameter is not set.<br />
-- * If set to false, setting that action will never categorise the page.<br />
-- * If set to nil, the module will categorise the page if:<br />
-- 1) an expiry parameter is not set, and<br />
-- 2) a reason is provided, and<br />
-- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck<br />
-- table.<br />
<br />
expiryCheckActions = {<br />
edit = nil,<br />
move = false,<br />
autoreview = true,<br />
upload = false<br />
},<br />
<br />
reasonsWithoutExpiryCheck = {<br />
blp = true,<br />
template = true,<br />
},<br />
<br />
--------------------------------------------------------------------------------<br />
-- Pagetypes<br />
--------------------------------------------------------------------------------<br />
<br />
-- This table produces the page types available with the ${PAGETYPE} parameter.<br />
-- Keys are namespace numbers, or the string "default" for the default value.<br />
pagetypes = {<br />
[0] = 'article',<br />
[6] = 'file',<br />
[10] = 'template',<br />
[14] = 'category',<br />
[828] = 'module',<br />
default = 'page'<br />
},<br />
<br />
--------------------------------------------------------------------------------<br />
-- Strings marking indefinite protection<br />
--------------------------------------------------------------------------------<br />
<br />
-- This table contains values passed to the expiry parameter that mean the page<br />
-- is protected indefinitely.<br />
indefStrings = {<br />
['indef'] = true,<br />
['indefinite'] = true,<br />
['indefinitely'] = true,<br />
['infinite'] = true,<br />
},<br />
<br />
--------------------------------------------------------------------------------<br />
-- Group hierarchy<br />
--------------------------------------------------------------------------------<br />
<br />
-- This table maps each group to all groups that have a superset of the original<br />
-- group's page editing permissions.<br />
hierarchy = {<br />
sysop = {},<br />
reviewer = {'sysop'},<br />
filemover = {'sysop'},<br />
templateeditor = {'sysop'},<br />
extendedconfirmed = {'sysop'},<br />
autoconfirmed = {'reviewer', 'filemover', 'templateeditor', 'extendedconfirmed'},<br />
user = {'autoconfirmed'},<br />
['*'] = {'user'}<br />
},<br />
<br />
--------------------------------------------------------------------------------<br />
-- Wrapper templates and their default arguments<br />
--------------------------------------------------------------------------------<br />
<br />
-- This table contains wrapper templates used with the module, and their<br />
-- default arguments. Templates specified in this table should contain the<br />
-- following invocation, and no other template content:<br />
--<br />
-- {{#invoke:Protection banner|main}}<br />
--<br />
-- If other content is desired, it can be added between<br />
-- <noinclude>...</noinclude> tags.<br />
--<br />
-- When a user calls one of these wrapper templates, they will use the<br />
-- default arguments automatically. However, users can override any of the<br />
-- arguments.<br />
wrappers = {<br />
['Template:Pp'] = {},<br />
['Template:Pp-extended'] = {'ecp'},<br />
['Template:Pp-blp'] = {'blp'},<br />
-- we don't need Template:Pp-create<br />
['Template:Pp-dispute'] = {'dispute'},<br />
['Template:Pp-main-page'] = {'mainpage'},<br />
['Template:Pp-move'] = {action = 'move', catonly = 'yes'},<br />
['Template:Pp-move-dispute'] = {'dispute', action = 'move', catonly = 'yes'},<br />
-- we don't need Template:Pp-move-indef<br />
['Template:Pp-move-vandalism'] = {'vandalism', action = 'move', catonly = 'yes'},<br />
['Template:Pp-office'] = {'office'},<br />
['Template:Pp-office-dmca'] = {'dmca'},<br />
['Template:Pp-pc'] = {action = 'autoreview', small = true},<br />
['Template:Pp-pc1'] = {action = 'autoreview', small = true},<br />
['Template:Pp-reset'] = {'reset'},<br />
['Template:Pp-semi-indef'] = {small = true},<br />
['Template:Pp-sock'] = {'sock'},<br />
['Template:Pp-template'] = {'template', small = true},<br />
['Template:Pp-upload'] = {action = 'upload'},<br />
['Template:Pp-usertalk'] = {'usertalk'},<br />
['Template:Pp-vandalism'] = {'vandalism'},<br />
},<br />
<br />
--------------------------------------------------------------------------------<br />
-- <br />
-- MESSAGES<br />
-- <br />
--------------------------------------------------------------------------------<br />
<br />
msg = {<br />
<br />
--------------------------------------------------------------------------------<br />
-- Intro blurb and intro fragment<br />
--------------------------------------------------------------------------------<br />
<br />
-- These messages specify what is produced by the ${INTROBLURB} and<br />
-- ${INTROFRAGMENT} parameters. If the protection is temporary they use the<br />
-- intro-blurb-expiry or intro-fragment-expiry, and if not they use<br />
-- intro-blurb-noexpiry or intro-fragment-noexpiry.<br />
-- It is possible to use banner parameters in these messages.<br />
['intro-blurb-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY}.',<br />
['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}.',<br />
['intro-fragment-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY},',<br />
['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}',<br />
<br />
--------------------------------------------------------------------------------<br />
-- Tooltip blurb<br />
--------------------------------------------------------------------------------<br />
<br />
-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter.<br />
-- If the protection is temporary the tooltip-blurb-expiry message is used, and<br />
-- if not the tooltip-blurb-noexpiry message is used.<br />
-- It is possible to use banner parameters in these messages.<br />
['tooltip-blurb-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.',<br />
['tooltip-blurb-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.',<br />
['tooltip-fragment-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY},',<br />
['tooltip-fragment-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',<br />
<br />
--------------------------------------------------------------------------------<br />
-- Special explanation blurb<br />
--------------------------------------------------------------------------------<br />
<br />
-- An explanation blurb for pages that cannot be unprotected, e.g. for pages<br />
-- in the MediaWiki namespace.<br />
-- It is possible to use banner parameters in this message.<br />
['explanation-blurb-nounprotect'] = 'See the [[Wikipedia:Protection policy|'<br />
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'<br />
.. ' Please discuss any changes on the ${TALKPAGE}; you'<br />
.. ' may ${EDITREQUEST} to ask an'<br />
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'<br />
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'<br />
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'<br />
.. '|consensus]].',<br />
<br />
--------------------------------------------------------------------------------<br />
-- Protection log display values<br />
--------------------------------------------------------------------------------<br />
<br />
-- These messages determine the display values for the protection log link<br />
-- or the pending changes log link produced by the ${PROTECTIONLOG} parameter.<br />
-- It is possible to use banner parameters in these messages.<br />
['protection-log-display'] = 'protection log',<br />
['pc-log-display'] = 'pending changes log',<br />
<br />
--------------------------------------------------------------------------------<br />
-- Current version display values<br />
--------------------------------------------------------------------------------<br />
<br />
-- These messages determine the display values for the page history link<br />
-- or the move log link produced by the ${CURRENTVERSION} parameter.<br />
-- It is possible to use banner parameters in these messages.<br />
['current-version-move-display'] = 'current title',<br />
['current-version-edit-display'] = 'current version',<br />
<br />
--------------------------------------------------------------------------------<br />
-- Talk page<br />
--------------------------------------------------------------------------------<br />
<br />
-- This message determines the display value of the talk page link produced<br />
-- with the ${TALKPAGE} parameter.<br />
-- It is possible to use banner parameters in this message.<br />
['talk-page-link-display'] = 'talk page',<br />
<br />
--------------------------------------------------------------------------------<br />
-- Edit requests<br />
--------------------------------------------------------------------------------<br />
<br />
-- This message determines the display value of the edit request link produced<br />
-- with the ${EDITREQUEST} parameter.<br />
-- It is possible to use banner parameters in this message.<br />
['edit-request-display'] = 'submit an edit request',<br />
<br />
--------------------------------------------------------------------------------<br />
-- Expiry date format<br />
--------------------------------------------------------------------------------<br />
<br />
-- This is the format for the blurb expiry date. It should be valid input for<br />
-- the first parameter of the #time parser function.<br />
['expiry-date-format'] = 'F j, Y "at" H:i e',<br />
<br />
--------------------------------------------------------------------------------<br />
-- Tracking categories<br />
--------------------------------------------------------------------------------<br />
<br />
-- These messages determine which tracking categories the module outputs.<br />
['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates',<br />
['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules',<br />
<br />
--------------------------------------------------------------------------------<br />
-- Images<br />
--------------------------------------------------------------------------------<br />
<br />
-- These are images that are not defined by their protection action and protection level.<br />
['image-filename-indef'] = 'Full-protection-shackle.svg',<br />
['image-filename-default'] = 'Transparent.gif',<br />
<br />
--------------------------------------------------------------------------------<br />
-- End messages<br />
--------------------------------------------------------------------------------<br />
}<br />
<br />
--------------------------------------------------------------------------------<br />
-- End configuration<br />
--------------------------------------------------------------------------------<br />
}</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Protection_banner&diff=534Module:Protection banner2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>-- This module implements {{pp-meta}} and its daughter templates such as<br />
-- {{pp-dispute}}, {{pp-vandalism}} and {{pp-sock}}.<br />
<br />
-- Initialise necessary modules.<br />
require('Module:No globals')<br />
local makeFileLink = require('Module:File link')._main<br />
local effectiveProtectionLevel = require('Module:Effective protection level')._main<br />
local effectiveProtectionExpiry = require('Module:Effective protection expiry')._main<br />
local yesno = require('Module:Yesno')<br />
<br />
-- Lazily initialise modules and objects we don't always need.<br />
local getArgs, makeMessageBox, lang<br />
<br />
-- Set constants.<br />
local CONFIG_MODULE = 'Module:Protection banner/config'<br />
<br />
--------------------------------------------------------------------------------<br />
-- Helper functions<br />
--------------------------------------------------------------------------------<br />
<br />
local function makeCategoryLink(cat, sort)<br />
if cat then<br />
return string.format(<br />
'[[%s:%s|%s]]',<br />
mw.site.namespaces[14].name,<br />
cat,<br />
sort<br />
)<br />
end<br />
end<br />
<br />
-- Validation function for the expiry and the protection date<br />
local function validateDate(dateString, dateType)<br />
if not lang then<br />
lang = mw.language.getContentLanguage()<br />
end<br />
local success, result = pcall(lang.formatDate, lang, 'U', dateString)<br />
if success then<br />
result = tonumber(result)<br />
if result then<br />
return result<br />
end<br />
end<br />
error(string.format(<br />
'invalid %s: %s',<br />
dateType,<br />
tostring(dateString)<br />
), 4)<br />
end<br />
<br />
local function makeFullUrl(page, query, display)<br />
return string.format(<br />
'[%s %s]',<br />
tostring(mw.uri.fullUrl(page, query)),<br />
display<br />
)<br />
end<br />
<br />
-- Given a directed graph formatted as node -> table of direct successors,<br />
-- get a table of all nodes reachable from a given node (though always<br />
-- including the given node).<br />
local function getReachableNodes(graph, start)<br />
local toWalk, retval = {[start] = true}, {}<br />
while true do<br />
-- Can't use pairs() since we're adding and removing things as we're iterating<br />
local k = next(toWalk) -- This always gets the "first" key<br />
if k == nil then<br />
return retval<br />
end<br />
toWalk[k] = nil<br />
retval[k] = true<br />
for _,v in ipairs(graph[k]) do<br />
if not retval[v] then<br />
toWalk[v] = true<br />
end<br />
end<br />
end<br />
end<br />
<br />
--------------------------------------------------------------------------------<br />
-- Protection class<br />
--------------------------------------------------------------------------------<br />
<br />
local Protection = {}<br />
Protection.__index = Protection<br />
<br />
Protection.supportedActions = {<br />
edit = true,<br />
move = true,<br />
autoreview = true,<br />
upload = true<br />
}<br />
<br />
Protection.bannerConfigFields = {<br />
'text',<br />
'explanation',<br />
'tooltip',<br />
'alt',<br />
'link',<br />
'image'<br />
}<br />
<br />
function Protection.new(args, cfg, title)<br />
local obj = {}<br />
obj._cfg = cfg<br />
obj.title = title or mw.title.getCurrentTitle()<br />
<br />
-- Set action<br />
if not args.action then<br />
obj.action = 'edit'<br />
elseif Protection.supportedActions[args.action] then<br />
obj.action = args.action<br />
else<br />
error(string.format(<br />
'invalid action: %s',<br />
tostring(args.action)<br />
), 3)<br />
end<br />
<br />
-- Set level<br />
obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title)<br />
if not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then<br />
-- Users need to be autoconfirmed to move pages anyway, so treat<br />
-- semi-move-protected pages as unprotected.<br />
obj.level = '*'<br />
end<br />
<br />
-- Set expiry<br />
local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title)<br />
if effectiveExpiry == 'infinity' then<br />
obj.expiry = 'indef'<br />
elseif effectiveExpiry ~= 'unknown' then<br />
obj.expiry = validateDate(effectiveExpiry, 'expiry date')<br />
end<br />
<br />
-- Set reason<br />
if args[1] then<br />
obj.reason = mw.ustring.lower(args[1])<br />
if obj.reason:find('|') then<br />
error('reasons cannot contain the pipe character ("|")', 3)<br />
end<br />
end<br />
<br />
-- Set protection date<br />
if args.date then<br />
obj.protectionDate = validateDate(args.date, 'protection date')<br />
end<br />
<br />
-- Set banner config<br />
do<br />
obj.bannerConfig = {}<br />
local configTables = {}<br />
if cfg.banners[obj.action] then<br />
configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason]<br />
end<br />
if cfg.defaultBanners[obj.action] then<br />
configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level]<br />
configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default<br />
end<br />
configTables[#configTables + 1] = cfg.masterBanner<br />
for i, field in ipairs(Protection.bannerConfigFields) do<br />
for j, t in ipairs(configTables) do<br />
if t[field] then<br />
obj.bannerConfig[field] = t[field]<br />
break<br />
end<br />
end<br />
end<br />
end<br />
return setmetatable(obj, Protection)<br />
end<br />
<br />
function Protection:isUserScript()<br />
-- Whether the page is a user JavaScript or CSS page.<br />
local title = self.title<br />
return title.namespace == 2 and (<br />
title.contentModel == 'javascript' or title.contentModel == 'css'<br />
)<br />
end<br />
<br />
function Protection:isProtected()<br />
return self.level ~= '*'<br />
end<br />
<br />
function Protection:shouldShowLock()<br />
-- Whether we should output a banner/padlock<br />
return self:isProtected() and not self:isUserScript()<br />
end<br />
<br />
-- Whether this page needs a protection category.<br />
Protection.shouldHaveProtectionCategory = Protection.shouldShowLock<br />
<br />
function Protection:isTemporary()<br />
return type(self.expiry) == 'number'<br />
end<br />
<br />
function Protection:makeProtectionCategory()<br />
if not self:shouldHaveProtectionCategory() then<br />
return ''<br />
end<br />
<br />
local cfg = self._cfg<br />
local title = self.title<br />
<br />
-- Get the expiry key fragment.<br />
local expiryFragment<br />
if self.expiry == 'indef' then<br />
expiryFragment = self.expiry<br />
elseif type(self.expiry) == 'number' then<br />
expiryFragment = 'temp'<br />
end<br />
<br />
-- Get the namespace key fragment.<br />
local namespaceFragment = cfg.categoryNamespaceKeys[title.namespace]<br />
if not namespaceFragment and title.namespace % 2 == 1 then<br />
namespaceFragment = 'talk'<br />
end<br />
<br />
-- Define the order that key fragments are tested in. This is done with an<br />
-- array of tables containing the value to be tested, along with its<br />
-- position in the cfg.protectionCategories table.<br />
local order = {<br />
{val = expiryFragment, keypos = 1},<br />
{val = namespaceFragment, keypos = 2},<br />
{val = self.reason, keypos = 3},<br />
{val = self.level, keypos = 4},<br />
{val = self.action, keypos = 5}<br />
}<br />
<br />
--[[<br />
-- The old protection templates used an ad-hoc protection category system,<br />
-- with some templates prioritising namespaces in their categories, and<br />
-- others prioritising the protection reason. To emulate this in this module<br />
-- we use the config table cfg.reasonsWithNamespacePriority to set the<br />
-- reasons for which namespaces have priority over protection reason.<br />
-- If we are dealing with one of those reasons, move the namespace table to<br />
-- the end of the order table, i.e. give it highest priority. If not, the<br />
-- reason should have highest priority, so move that to the end of the table<br />
-- instead.<br />
--]]<br />
table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))<br />
<br />
--[[<br />
-- Define the attempt order. Inactive subtables (subtables with nil "value"<br />
-- fields) are moved to the end, where they will later be given the key<br />
-- "all". This is to cut down on the number of table lookups in<br />
-- cfg.protectionCategories, which grows exponentially with the number of<br />
-- non-nil keys. We keep track of the number of active subtables with the<br />
-- noActive parameter.<br />
--]]<br />
local noActive, attemptOrder<br />
do<br />
local active, inactive = {}, {}<br />
for i, t in ipairs(order) do<br />
if t.val then<br />
active[#active + 1] = t<br />
else<br />
inactive[#inactive + 1] = t<br />
end<br />
end<br />
noActive = #active<br />
attemptOrder = active<br />
for i, t in ipairs(inactive) do<br />
attemptOrder[#attemptOrder + 1] = t<br />
end<br />
end<br />
<br />
--[[<br />
-- Check increasingly generic key combinations until we find a match. If a<br />
-- specific category exists for the combination of key fragments we are<br />
-- given, that match will be found first. If not, we keep trying different<br />
-- key fragment combinations until we match using the key<br />
-- "all-all-all-all-all".<br />
--<br />
-- To generate the keys, we index the key subtables using a binary matrix<br />
-- with indexes i and j. j is only calculated up to the number of active<br />
-- subtables. For example, if there were three active subtables, the matrix<br />
-- would look like this, with 0 corresponding to the key fragment "all", and<br />
-- 1 corresponding to other key fragments.<br />
-- <br />
-- j 1 2 3<br />
-- i <br />
-- 1 1 1 1<br />
-- 2 0 1 1<br />
-- 3 1 0 1<br />
-- 4 0 0 1<br />
-- 5 1 1 0<br />
-- 6 0 1 0<br />
-- 7 1 0 0<br />
-- 8 0 0 0<br />
-- <br />
-- Values of j higher than the number of active subtables are set<br />
-- to the string "all".<br />
--<br />
-- A key for cfg.protectionCategories is constructed for each value of i.<br />
-- The position of the value in the key is determined by the keypos field in<br />
-- each subtable.<br />
--]]<br />
local cats = cfg.protectionCategories<br />
for i = 1, 2^noActive do<br />
local key = {}<br />
for j, t in ipairs(attemptOrder) do<br />
if j > noActive then<br />
key[t.keypos] = 'all'<br />
else<br />
local quotient = i / 2 ^ (j - 1)<br />
quotient = math.ceil(quotient)<br />
if quotient % 2 == 1 then<br />
key[t.keypos] = t.val<br />
else<br />
key[t.keypos] = 'all'<br />
end<br />
end<br />
end<br />
key = table.concat(key, '|')<br />
local attempt = cats[key]<br />
if attempt then<br />
return makeCategoryLink(attempt, title.text)<br />
end<br />
end<br />
return ''<br />
end<br />
<br />
function Protection:isIncorrect()<br />
local expiry = self.expiry<br />
return not self:shouldHaveProtectionCategory()<br />
or type(expiry) == 'number' and expiry < os.time()<br />
end<br />
<br />
function Protection:isTemplateProtectedNonTemplate()<br />
local action, namespace = self.action, self.title.namespace<br />
return self.level == 'templateeditor'<br />
and (<br />
(action ~= 'edit' and action ~= 'move')<br />
or (namespace ~= 10 and namespace ~= 828)<br />
)<br />
end<br />
<br />
function Protection:makeCategoryLinks()<br />
local msg = self._cfg.msg<br />
local ret = {self:makeProtectionCategory()}<br />
if self:isIncorrect() then<br />
ret[#ret + 1] = makeCategoryLink(<br />
msg['tracking-category-incorrect'],<br />
self.title.text<br />
)<br />
end<br />
if self:isTemplateProtectedNonTemplate() then<br />
ret[#ret + 1] = makeCategoryLink(<br />
msg['tracking-category-template'],<br />
self.title.text<br />
)<br />
end<br />
return table.concat(ret)<br />
end<br />
<br />
--------------------------------------------------------------------------------<br />
-- Blurb class<br />
--------------------------------------------------------------------------------<br />
<br />
local Blurb = {}<br />
Blurb.__index = Blurb<br />
<br />
Blurb.bannerTextFields = {<br />
text = true,<br />
explanation = true,<br />
tooltip = true,<br />
alt = true,<br />
link = true<br />
}<br />
<br />
function Blurb.new(protectionObj, args, cfg)<br />
return setmetatable({<br />
_cfg = cfg,<br />
_protectionObj = protectionObj,<br />
_args = args<br />
}, Blurb)<br />
end<br />
<br />
-- Private methods --<br />
<br />
function Blurb:_formatDate(num)<br />
-- Formats a Unix timestamp into dd Month, YYYY format.<br />
lang = lang or mw.language.getContentLanguage()<br />
local success, date = pcall(<br />
lang.formatDate,<br />
lang,<br />
self._cfg.msg['expiry-date-format'] or 'j F Y',<br />
'@' .. tostring(num)<br />
)<br />
if success then<br />
return date<br />
end<br />
end<br />
<br />
function Blurb:_getExpandedMessage(msgKey)<br />
return self:_substituteParameters(self._cfg.msg[msgKey])<br />
end<br />
<br />
function Blurb:_substituteParameters(msg)<br />
if not self._params then<br />
local parameterFuncs = {}<br />
<br />
parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter<br />
parameterFuncs.EDITREQUEST = self._makeEditRequestParameter<br />
parameterFuncs.EXPIRY = self._makeExpiryParameter<br />
parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter<br />
parameterFuncs.IMAGELINK = self._makeImageLinkParameter<br />
parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter<br />
parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter<br />
parameterFuncs.PAGETYPE = self._makePagetypeParameter<br />
parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter<br />
parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter<br />
parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter<br />
parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter<br />
parameterFuncs.TALKPAGE = self._makeTalkPageParameter<br />
parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter<br />
parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter<br />
parameterFuncs.VANDAL = self._makeVandalTemplateParameter<br />
<br />
self._params = setmetatable({}, {<br />
__index = function (t, k)<br />
local param<br />
if parameterFuncs[k] then<br />
param = parameterFuncs[k](self)<br />
end<br />
param = param or ''<br />
t[k] = param<br />
return param<br />
end<br />
})<br />
end<br />
<br />
msg = msg:gsub('${(%u+)}', self._params)<br />
return msg<br />
end<br />
<br />
function Blurb:_makeCurrentVersionParameter()<br />
-- A link to the page history or the move log, depending on the kind of<br />
-- protection.<br />
local pagename = self._protectionObj.title.prefixedText<br />
if self._protectionObj.action == 'move' then<br />
-- We need the move log link.<br />
return makeFullUrl(<br />
'Special:Log',<br />
{type = 'move', page = pagename},<br />
self:_getExpandedMessage('current-version-move-display')<br />
)<br />
else<br />
-- We need the history link.<br />
return makeFullUrl(<br />
pagename,<br />
{action = 'history'},<br />
self:_getExpandedMessage('current-version-edit-display')<br />
)<br />
end<br />
end<br />
<br />
function Blurb:_makeEditRequestParameter()<br />
local mEditRequest = require('Module:Submit an edit request')<br />
local action = self._protectionObj.action<br />
local level = self._protectionObj.level<br />
<br />
-- Get the edit request type.<br />
local requestType<br />
if action == 'edit' then<br />
if level == 'autoconfirmed' then<br />
requestType = 'semi'<br />
elseif level == 'extendedconfirmed' then<br />
requestType = 'extended'<br />
elseif level == 'templateeditor' then<br />
requestType = 'template'<br />
end<br />
end<br />
requestType = requestType or 'full'<br />
<br />
-- Get the display value.<br />
local display = self:_getExpandedMessage('edit-request-display')<br />
<br />
return mEditRequest._link{type = requestType, display = display}<br />
end<br />
<br />
function Blurb:_makeExpiryParameter()<br />
local expiry = self._protectionObj.expiry<br />
if type(expiry) == 'number' then<br />
return self:_formatDate(expiry)<br />
else<br />
return expiry<br />
end<br />
end<br />
<br />
function Blurb:_makeExplanationBlurbParameter()<br />
-- Cover special cases first.<br />
if self._protectionObj.title.namespace == 8 then<br />
-- MediaWiki namespace<br />
return self:_getExpandedMessage('explanation-blurb-nounprotect')<br />
end<br />
<br />
-- Get explanation blurb table keys<br />
local action = self._protectionObj.action<br />
local level = self._protectionObj.level<br />
local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'<br />
<br />
-- Find the message in the explanation blurb table and substitute any<br />
-- parameters.<br />
local explanations = self._cfg.explanationBlurbs<br />
local msg<br />
if explanations[action][level] and explanations[action][level][talkKey] then<br />
msg = explanations[action][level][talkKey]<br />
elseif explanations[action][level] and explanations[action][level].default then<br />
msg = explanations[action][level].default<br />
elseif explanations[action].default and explanations[action].default[talkKey] then<br />
msg = explanations[action].default[talkKey]<br />
elseif explanations[action].default and explanations[action].default.default then<br />
msg = explanations[action].default.default<br />
else<br />
error(string.format(<br />
'could not find explanation blurb for action "%s", level "%s" and talk key "%s"',<br />
action,<br />
level,<br />
talkKey<br />
), 8)<br />
end<br />
return self:_substituteParameters(msg)<br />
end<br />
<br />
function Blurb:_makeImageLinkParameter()<br />
local imageLinks = self._cfg.imageLinks<br />
local action = self._protectionObj.action<br />
local level = self._protectionObj.level<br />
local msg<br />
if imageLinks[action][level] then<br />
msg = imageLinks[action][level]<br />
elseif imageLinks[action].default then<br />
msg = imageLinks[action].default<br />
else<br />
msg = imageLinks.edit.default<br />
end<br />
return self:_substituteParameters(msg)<br />
end<br />
<br />
function Blurb:_makeIntroBlurbParameter()<br />
if self._protectionObj:isTemporary() then<br />
return self:_getExpandedMessage('intro-blurb-expiry')<br />
else<br />
return self:_getExpandedMessage('intro-blurb-noexpiry')<br />
end<br />
end<br />
<br />
function Blurb:_makeIntroFragmentParameter()<br />
if self._protectionObj:isTemporary() then<br />
return self:_getExpandedMessage('intro-fragment-expiry')<br />
else<br />
return self:_getExpandedMessage('intro-fragment-noexpiry')<br />
end<br />
end<br />
<br />
function Blurb:_makePagetypeParameter()<br />
local pagetypes = self._cfg.pagetypes<br />
return pagetypes[self._protectionObj.title.namespace]<br />
or pagetypes.default<br />
or error('no default pagetype defined', 8)<br />
end<br />
<br />
function Blurb:_makeProtectionBlurbParameter()<br />
local protectionBlurbs = self._cfg.protectionBlurbs<br />
local action = self._protectionObj.action<br />
local level = self._protectionObj.level<br />
local msg<br />
if protectionBlurbs[action][level] then<br />
msg = protectionBlurbs[action][level]<br />
elseif protectionBlurbs[action].default then<br />
msg = protectionBlurbs[action].default<br />
elseif protectionBlurbs.edit.default then<br />
msg = protectionBlurbs.edit.default<br />
else<br />
error('no protection blurb defined for protectionBlurbs.edit.default', 8)<br />
end<br />
return self:_substituteParameters(msg)<br />
end<br />
<br />
function Blurb:_makeProtectionDateParameter()<br />
local protectionDate = self._protectionObj.protectionDate<br />
if type(protectionDate) == 'number' then<br />
return self:_formatDate(protectionDate)<br />
else<br />
return protectionDate<br />
end<br />
end<br />
<br />
function Blurb:_makeProtectionLevelParameter()<br />
local protectionLevels = self._cfg.protectionLevels<br />
local action = self._protectionObj.action<br />
local level = self._protectionObj.level<br />
local msg<br />
if protectionLevels[action][level] then<br />
msg = protectionLevels[action][level]<br />
elseif protectionLevels[action].default then<br />
msg = protectionLevels[action].default<br />
elseif protectionLevels.edit.default then<br />
msg = protectionLevels.edit.default<br />
else<br />
error('no protection level defined for protectionLevels.edit.default', 8)<br />
end<br />
return self:_substituteParameters(msg)<br />
end<br />
<br />
function Blurb:_makeProtectionLogParameter()<br />
local pagename = self._protectionObj.title.prefixedText<br />
if self._protectionObj.action == 'autoreview' then<br />
-- We need the pending changes log.<br />
return makeFullUrl(<br />
'Special:Log',<br />
{type = 'stable', page = pagename},<br />
self:_getExpandedMessage('pc-log-display')<br />
)<br />
else<br />
-- We need the protection log.<br />
return makeFullUrl(<br />
'Special:Log',<br />
{type = 'protect', page = pagename},<br />
self:_getExpandedMessage('protection-log-display')<br />
)<br />
end<br />
end<br />
<br />
function Blurb:_makeTalkPageParameter()<br />
return string.format(<br />
'[[%s:%s#%s|%s]]',<br />
mw.site.namespaces[self._protectionObj.title.namespace].talk.name,<br />
self._protectionObj.title.text,<br />
self._args.section or 'top',<br />
self:_getExpandedMessage('talk-page-link-display')<br />
)<br />
end<br />
<br />
function Blurb:_makeTooltipBlurbParameter()<br />
if self._protectionObj:isTemporary() then<br />
return self:_getExpandedMessage('tooltip-blurb-expiry')<br />
else<br />
return self:_getExpandedMessage('tooltip-blurb-noexpiry')<br />
end<br />
end<br />
<br />
function Blurb:_makeTooltipFragmentParameter()<br />
if self._protectionObj:isTemporary() then<br />
return self:_getExpandedMessage('tooltip-fragment-expiry')<br />
else<br />
return self:_getExpandedMessage('tooltip-fragment-noexpiry')<br />
end<br />
end<br />
<br />
function Blurb:_makeVandalTemplateParameter()<br />
return mw.getCurrentFrame():expandTemplate{<br />
title="vandal-m",<br />
args={self._args.user or self._protectionObj.title.baseText}<br />
}<br />
end<br />
<br />
-- Public methods --<br />
<br />
function Blurb:makeBannerText(key)<br />
-- Validate input.<br />
if not key or not Blurb.bannerTextFields[key] then<br />
error(string.format(<br />
'"%s" is not a valid banner config field',<br />
tostring(key)<br />
), 2)<br />
end<br />
<br />
-- Generate the text.<br />
local msg = self._protectionObj.bannerConfig[key]<br />
if type(msg) == 'string' then<br />
return self:_substituteParameters(msg)<br />
elseif type(msg) == 'function' then<br />
msg = msg(self._protectionObj, self._args)<br />
if type(msg) ~= 'string' then<br />
error(string.format(<br />
'bad output from banner config function with key "%s"'<br />
.. ' (expected string, got %s)',<br />
tostring(key),<br />
type(msg)<br />
), 4)<br />
end<br />
return self:_substituteParameters(msg)<br />
end<br />
end<br />
<br />
--------------------------------------------------------------------------------<br />
-- BannerTemplate class<br />
--------------------------------------------------------------------------------<br />
<br />
local BannerTemplate = {}<br />
BannerTemplate.__index = BannerTemplate<br />
<br />
function BannerTemplate.new(protectionObj, cfg)<br />
local obj = {}<br />
obj._cfg = cfg<br />
<br />
-- Set the image filename.<br />
local imageFilename = protectionObj.bannerConfig.image<br />
if imageFilename then<br />
obj._imageFilename = imageFilename<br />
else<br />
-- If an image filename isn't specified explicitly in the banner config,<br />
-- generate it from the protection status and the namespace.<br />
local action = protectionObj.action<br />
local level = protectionObj.level<br />
local namespace = protectionObj.title.namespace<br />
local reason = protectionObj.reason<br />
<br />
-- Deal with special cases first.<br />
if (<br />
namespace == 10<br />
or namespace == 828<br />
or reason and obj._cfg.indefImageReasons[reason]<br />
)<br />
and action == 'edit'<br />
and level == 'sysop'<br />
and not protectionObj:isTemporary()<br />
then<br />
-- Fully protected modules and templates get the special red "indef"<br />
-- padlock.<br />
obj._imageFilename = obj._cfg.msg['image-filename-indef']<br />
else<br />
-- Deal with regular protection types.<br />
local images = obj._cfg.images<br />
if images[action] then<br />
if images[action][level] then<br />
obj._imageFilename = images[action][level]<br />
elseif images[action].default then<br />
obj._imageFilename = images[action].default<br />
end<br />
end<br />
end<br />
end<br />
return setmetatable(obj, BannerTemplate)<br />
end<br />
<br />
function BannerTemplate:renderImage()<br />
local filename = self._imageFilename<br />
or self._cfg.msg['image-filename-default']<br />
or 'Transparent.gif'<br />
return makeFileLink{<br />
file = filename,<br />
size = (self.imageWidth or 20) .. 'px',<br />
alt = self._imageAlt,<br />
link = self._imageLink,<br />
caption = self.imageCaption<br />
}<br />
end<br />
<br />
--------------------------------------------------------------------------------<br />
-- Banner class<br />
--------------------------------------------------------------------------------<br />
<br />
local Banner = setmetatable({}, BannerTemplate)<br />
Banner.__index = Banner<br />
<br />
function Banner.new(protectionObj, blurbObj, cfg)<br />
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.<br />
obj.imageWidth = 40<br />
obj.imageCaption = blurbObj:makeBannerText('alt') -- Large banners use the alt text for the tooltip.<br />
obj._reasonText = blurbObj:makeBannerText('text')<br />
obj._explanationText = blurbObj:makeBannerText('explanation')<br />
obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing.<br />
return setmetatable(obj, Banner)<br />
end<br />
<br />
function Banner:__tostring()<br />
-- Renders the banner.<br />
makeMessageBox = makeMessageBox or require('Module:Message box').main<br />
local reasonText = self._reasonText or error('no reason text set', 2)<br />
local explanationText = self._explanationText<br />
local mbargs = {<br />
page = self._page,<br />
type = 'protection',<br />
image = self:renderImage(),<br />
text = string.format(<br />
"'''%s'''%s",<br />
reasonText,<br />
explanationText and '<br />' .. explanationText or ''<br />
)<br />
}<br />
return makeMessageBox('mbox', mbargs)<br />
end<br />
<br />
--------------------------------------------------------------------------------<br />
-- Padlock class<br />
--------------------------------------------------------------------------------<br />
<br />
local Padlock = setmetatable({}, BannerTemplate)<br />
Padlock.__index = Padlock<br />
<br />
function Padlock.new(protectionObj, blurbObj, cfg)<br />
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.<br />
obj.imageWidth = 20<br />
obj.imageCaption = blurbObj:makeBannerText('tooltip')<br />
obj._imageAlt = blurbObj:makeBannerText('alt')<br />
obj._imageLink = blurbObj:makeBannerText('link')<br />
obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action]<br />
or cfg.padlockIndicatorNames.default<br />
or 'pp-default'<br />
return setmetatable(obj, Padlock)<br />
end<br />
<br />
function Padlock:__tostring()<br />
local frame = mw.getCurrentFrame()<br />
-- The nowiki tag helps prevent whitespace at the top of articles.<br />
return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{<br />
name = 'indicator',<br />
args = {name = self._indicatorName},<br />
content = self:renderImage()<br />
}<br />
end<br />
<br />
--------------------------------------------------------------------------------<br />
-- Exports<br />
--------------------------------------------------------------------------------<br />
<br />
local p = {}<br />
<br />
function p._exportClasses()<br />
-- This is used for testing purposes.<br />
return {<br />
Protection = Protection,<br />
Blurb = Blurb,<br />
BannerTemplate = BannerTemplate,<br />
Banner = Banner,<br />
Padlock = Padlock,<br />
}<br />
end<br />
<br />
function p._main(args, cfg, title)<br />
args = args or {}<br />
cfg = cfg or require(CONFIG_MODULE)<br />
<br />
local protectionObj = Protection.new(args, cfg, title)<br />
<br />
local ret = {}<br />
<br />
-- If a page's edit protection is equally or more restrictive than its<br />
-- protection from some other action, then don't bother displaying anything<br />
-- for the other action (except categories).<br />
if not yesno(args.catonly) and (protectionObj.action == 'edit' or<br />
args.demolevel or<br />
not getReachableNodes(<br />
cfg.hierarchy,<br />
protectionObj.level<br />
)[effectiveProtectionLevel('edit', protectionObj.title)])<br />
then<br />
-- Initialise the blurb object<br />
local blurbObj = Blurb.new(protectionObj, args, cfg)<br />
<br />
-- Render the banner<br />
if protectionObj:shouldShowLock() then<br />
ret[#ret + 1] = tostring(<br />
(yesno(args.small) and Padlock or Banner)<br />
.new(protectionObj, blurbObj, cfg)<br />
)<br />
end<br />
end<br />
<br />
-- Render the categories<br />
if yesno(args.category) ~= false then<br />
ret[#ret + 1] = protectionObj:makeCategoryLinks()<br />
end<br />
<br />
return table.concat(ret) <br />
end<br />
<br />
function p.main(frame, cfg)<br />
cfg = cfg or require(CONFIG_MODULE)<br />
<br />
-- Find default args, if any.<br />
local parent = frame.getParent and frame:getParent()<br />
local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', '')]<br />
<br />
-- Find user args, and use the parent frame if we are being called from a<br />
-- wrapper template.<br />
getArgs = getArgs or require('Module:Arguments').getArgs<br />
local userArgs = getArgs(frame, {<br />
parentOnly = defaultArgs,<br />
frameOnly = not defaultArgs<br />
})<br />
<br />
-- Build the args table. User-specified args overwrite default args.<br />
local args = {}<br />
for k, v in pairs(defaultArgs or {}) do<br />
args[k] = v<br />
end<br />
for k, v in pairs(userArgs) do<br />
args[k] = v<br />
end<br />
return p._main(args, cfg)<br />
end<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Navbar/styles.css&diff=532Module:Navbar/styles.css2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>/* {{pp|small=yes}} */<br />
.navbar {<br />
display: inline;<br />
font-size: 88%;<br />
font-weight: normal;<br />
}<br />
<br />
.navbar-collapse {<br />
float: left;<br />
text-align: left;<br />
}<br />
<br />
.navbar-boxtext {<br />
word-spacing: 0;<br />
}<br />
<br />
.navbar ul {<br />
display: inline-block;<br />
white-space: nowrap;<br />
line-height: inherit;<br />
}<br />
<br />
.navbar-brackets::before {<br />
margin-right: -0.125em;<br />
content: '[ ';<br />
}<br />
<br />
.navbar-brackets::after {<br />
margin-left: -0.125em;<br />
content: ' ]';<br />
}<br />
<br />
.navbar li {<br />
word-spacing: -0.125em;<br />
}<br />
<br />
.navbar a > span,<br />
.navbar a > abbr {<br />
text-decoration: inherit;<br />
}<br />
<br />
.navbar-mini abbr {<br />
font-variant: small-caps;<br />
border-bottom: none;<br />
text-decoration: none;<br />
cursor: inherit;<br />
}<br />
<br />
.navbar-ct-full {<br />
font-size: 114%;<br />
margin: 0 7em;<br />
}<br />
<br />
.navbar-ct-mini {<br />
font-size: 114%;<br />
margin: 0 4em;<br />
}</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Navbar/configuration&diff=530Module:Navbar/configuration2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>return {<br />
['templatestyles'] = 'Module:Navbar/styles.css',<br />
['box_text'] = 'This box: ', -- default text box when not plain or mini<br />
['title_namespace'] = 'Template', -- namespace to default to for title<br />
['invalid_title'] = 'Invalid title ',<br />
['classes'] = { -- set a line to nil if you don't want it<br />
['navbar'] = 'navbar',<br />
['plainlinks'] = 'plainlinks', -- plainlinks<br />
['horizontal_list'] = 'hlist', -- horizontal list class<br />
['mini'] = 'navbar-mini', -- class indicating small links in the navbar<br />
['this_box'] = 'navbar-boxtext',<br />
['brackets'] = 'navbar-brackets',<br />
-- 'collapsible' is the key for a class to indicate the navbar is<br />
-- setting up the collapsible element in addition to the normal<br />
-- navbar.<br />
['collapsible'] = 'navbar-collapse',<br />
['collapsible_title_mini'] = 'navbar-ct-mini',<br />
['collapsible_title_full'] = 'navbar-ct-full'<br />
}<br />
}</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Navbar&diff=528Module:Navbar2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>local p = {}<br />
local cfg = mw.loadData('Module:Navbar/configuration')<br />
<br />
local function get_title_arg(is_collapsible, template)<br />
local title_arg = 1<br />
if is_collapsible then title_arg = 2 end<br />
if template then title_arg = 'template' end<br />
return title_arg<br />
end<br />
<br />
local function choose_links(template, args)<br />
-- The show table indicates the default displayed items.<br />
-- view, talk, edit, hist, move, watch<br />
-- TODO: Move to configuration.<br />
local show = {true, true, true, false, false, false}<br />
if template then<br />
show[2] = false<br />
show[3] = false<br />
local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6,<br />
talk = 2, edit = 3, hist = 4, move = 5, watch = 6}<br />
-- TODO: Consider removing TableTools dependency.<br />
for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do<br />
local num = index[v]<br />
if num then show[num] = true end<br />
end<br />
end<br />
<br />
local remove_edit_link = args.noedit<br />
if remove_edit_link then show[3] = false end<br />
<br />
return show<br />
<br />
end<br />
<br />
local function add_link(link_description, ul, is_mini, font_style)<br />
local l<br />
if link_description.url then<br />
l = {'[', '', ']'}<br />
else<br />
l = {'[[', '|', ']]'}<br />
end<br />
ul:tag('li')<br />
:addClass('nv-' .. link_description.full)<br />
:wikitext(l[1] .. link_description.link .. l[2])<br />
:tag(is_mini and 'abbr' or 'span')<br />
:attr('title', link_description.html_title)<br />
:cssText(font_style)<br />
:wikitext(is_mini and link_description.mini or link_description.full)<br />
:done()<br />
:wikitext(l[3])<br />
:done()<br />
end<br />
<br />
local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)<br />
<br />
local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace)<br />
if not title then<br />
error(cfg.invalid_title .. title_text)<br />
end<br />
local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ''<br />
<br />
-- TODO: Get link_descriptions and show into the configuration module.<br />
-- link_descriptions should be easier...<br />
local link_descriptions = {<br />
{ ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template',<br />
['link'] = title.fullText, ['url'] = false },<br />
{ ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template',<br />
['link'] = talkpage, ['url'] = false },<br />
{ ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template',<br />
['link'] = title:fullUrl('action=edit'), ['url'] = true },<br />
{ ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template',<br />
['link'] = title:fullUrl('action=history'), ['url'] = true },<br />
{ ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template',<br />
['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true },<br />
{ ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template', <br />
['link'] = title:fullUrl('action=watch'), ['url'] = true }<br />
}<br />
<br />
local ul = mw.html.create('ul')<br />
if has_brackets then<br />
ul:addClass(cfg.classes.brackets)<br />
:cssText(font_style)<br />
end<br />
<br />
for i, _ in ipairs(displayed_links) do<br />
if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end<br />
end<br />
return ul:done()<br />
<br />
end<br />
<br />
function p._navbar(args)<br />
<br />
-- TODO: We probably don't need both fontstyle and fontcolor...<br />
local font_style = args.fontstyle<br />
local font_color = args.fontcolor<br />
local is_collapsible = args.collapsible<br />
local is_mini = args.mini<br />
local is_plain = args.plain<br />
<br />
local collapsible_class = nil<br />
if is_collapsible then<br />
collapsible_class = cfg.classes.collapsible<br />
if not is_plain then is_mini = 1 end<br />
if font_color then<br />
font_style = (font_style or '') .. '; color: ' .. font_color .. ';'<br />
end<br />
end<br />
<br />
local navbar_style = args.style<br />
local div = mw.html.create():tag('div')<br />
div<br />
:addClass(cfg.classes.navbar)<br />
:addClass(cfg.classes.plainlinks)<br />
:addClass(cfg.classes.horizontal_list)<br />
:addClass(collapsible_class) -- we made the determination earlier<br />
:cssText(navbar_style)<br />
<br />
if is_mini then div:addClass(cfg.classes.mini) end<br />
<br />
local box_text = (args.text or cfg.box_text) .. ' '<br />
-- the concatenated space guarantees the box text is separated<br />
if not (is_mini or is_plain) then<br />
div<br />
:tag('span')<br />
:addClass(cfg.classes.box_text)<br />
:cssText(font_style)<br />
:wikitext(box_text)<br />
end<br />
<br />
local template = args.template<br />
local displayed_links = choose_links(template, args)<br />
local has_brackets = args.brackets<br />
local title_arg = get_title_arg(is_collapsible, template)<br />
local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle())<br />
local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style)<br />
div:node(list)<br />
<br />
if is_collapsible then<br />
local title_text_class<br />
if is_mini then<br />
title_text_class = cfg.classes.collapsible_title_mini<br />
else<br />
title_text_class = cfg.classes.collapsible_title_full<br />
end<br />
div:done()<br />
:tag('div')<br />
:addClass(title_text_class)<br />
:cssText(font_style)<br />
:wikitext(args[1])<br />
end<br />
<br />
return mw.getCurrentFrame():extensionTag{<br />
name = 'templatestyles', args = { src = cfg.templatestyles }<br />
} .. tostring(div:done())<br />
end<br />
<br />
function p.navbar(frame)<br />
return p._navbar(require('Module:Arguments').getArgs(frame))<br />
end<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Hatnote_list&diff=526Module:Hatnote list2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>--------------------------------------------------------------------------------<br />
-- Module:Hatnote list --<br />
-- --<br />
-- This module produces and formats lists for use in hatnotes. In particular, --<br />
-- it implements the for-see list, i.e. lists of "For X, see Y" statements, --<br />
-- as used in {{about}}, {{redirect}}, and their variants. Also introduced --<br />
-- are andList & orList helpers for formatting lists with those conjunctions. --<br />
--------------------------------------------------------------------------------<br />
<br />
local mArguments --initialize lazily<br />
local mFormatLink = require('Module:Format link')<br />
local mHatnote = require('Module:Hatnote')<br />
local libraryUtil = require('libraryUtil')<br />
local checkType = libraryUtil.checkType<br />
local p = {}<br />
<br />
--------------------------------------------------------------------------------<br />
-- List stringification helper functions<br />
--<br />
-- These functions are used for stringifying lists, usually page lists inside<br />
-- the "Y" portion of "For X, see Y" for-see items.<br />
--------------------------------------------------------------------------------<br />
<br />
--default options table used across the list stringification functions<br />
local stringifyListDefaultOptions = {<br />
conjunction = "and",<br />
separator = ",",<br />
altSeparator = ";",<br />
space = " ",<br />
formatted = false<br />
}<br />
<br />
--Searches display text only<br />
local function searchDisp(haystack, needle)<br />
return string.find(<br />
string.sub(haystack, (string.find(haystack, '|') or 0) + 1), needle<br />
)<br />
end<br />
<br />
-- Stringifies a list generically; probably shouldn't be used directly<br />
local function stringifyList(list, options)<br />
-- Type-checks, defaults, and a shortcut<br />
checkType("stringifyList", 1, list, "table")<br />
if #list == 0 then return nil end<br />
checkType("stringifyList", 2, options, "table", true)<br />
options = options or {}<br />
for k, v in pairs(stringifyListDefaultOptions) do<br />
if options[k] == nil then options[k] = v end<br />
end<br />
local s = options.space<br />
-- Format the list if requested<br />
if options.formatted then<br />
list = mFormatLink.formatPages(<br />
{categorizeMissing = mHatnote.missingTargetCat}, list<br />
)<br />
end<br />
-- Set the separator; if any item contains it, use the alternate separator<br />
local separator = options.separator<br />
for k, v in pairs(list) do<br />
if searchDisp(v, separator) then<br />
separator = options.altSeparator<br />
break<br />
end<br />
end<br />
-- Set the conjunction, apply Oxford comma, and force a comma if #1 has "§"<br />
local conjunction = s .. options.conjunction .. s<br />
if #list == 2 and searchDisp(list[1], "§") or #list > 2 then<br />
conjunction = separator .. conjunction<br />
end<br />
-- Return the formatted string<br />
return mw.text.listToText(list, separator .. s, conjunction)<br />
end<br />
<br />
--DRY function<br />
function p.conjList (conj, list, fmt)<br />
return stringifyList(list, {conjunction = conj, formatted = fmt})<br />
end<br />
<br />
-- Stringifies lists with "and" or "or"<br />
function p.andList (...) return p.conjList("and", ...) end<br />
function p.orList (...) return p.conjList("or", ...) end<br />
<br />
--------------------------------------------------------------------------------<br />
-- For see<br />
--<br />
-- Makes a "For X, see [[Y]]." list from raw parameters. Intended for the<br />
-- {{about}} and {{redirect}} templates and their variants.<br />
--------------------------------------------------------------------------------<br />
<br />
--default options table used across the forSee family of functions<br />
local forSeeDefaultOptions = {<br />
andKeyword = 'and',<br />
title = mw.title.getCurrentTitle().text,<br />
otherText = 'other uses',<br />
forSeeForm = 'For %s, see %s.',<br />
}<br />
<br />
--Collapses duplicate punctuation<br />
local function punctuationCollapse (text)<br />
local replacements = {<br />
["%.%.$"] = ".",<br />
["%?%.$"] = "?",<br />
["%!%.$"] = "!",<br />
["%.%]%]%.$"] = ".]]",<br />
["%?%]%]%.$"] = "?]]",<br />
["%!%]%]%.$"] = "!]]"<br />
}<br />
for k, v in pairs(replacements) do text = string.gsub(text, k, v) end<br />
return text<br />
end<br />
<br />
-- Structures arguments into a table for stringification, & options<br />
function p.forSeeArgsToTable (args, from, options)<br />
-- Type-checks and defaults<br />
checkType("forSeeArgsToTable", 1, args, 'table')<br />
checkType("forSeeArgsToTable", 2, from, 'number', true)<br />
from = from or 1<br />
checkType("forSeeArgsToTable", 3, options, 'table', true)<br />
options = options or {}<br />
for k, v in pairs(forSeeDefaultOptions) do<br />
if options[k] == nil then options[k] = v end<br />
end<br />
-- maxArg's gotten manually because getArgs() and table.maxn aren't friends<br />
local maxArg = 0<br />
for k, v in pairs(args) do<br />
if type(k) == 'number' and k > maxArg then maxArg = k end<br />
end<br />
-- Structure the data out from the parameter list:<br />
-- * forTable is the wrapper table, with forRow rows<br />
-- * Rows are tables of a "use" string & a "pages" table of pagename strings<br />
-- * Blanks are left empty for defaulting elsewhere, but can terminate list<br />
local forTable = {}<br />
local i = from<br />
local terminated = false<br />
-- If there is extra text, and no arguments are given, give nil value<br />
-- to not produce default of "For other uses, see foo (disambiguation)"<br />
if options.extratext and i > maxArg then return nil end<br />
-- Loop to generate rows<br />
repeat<br />
-- New empty row<br />
local forRow = {}<br />
-- On blank use, assume list's ended & break at end of this loop<br />
forRow.use = args[i]<br />
if not args[i] then terminated = true end<br />
-- New empty list of pages<br />
forRow.pages = {}<br />
-- Insert first pages item if present<br />
table.insert(forRow.pages, args[i + 1])<br />
-- If the param after next is "and", do inner loop to collect params<br />
-- until the "and"'s stop. Blanks are ignored: "1|and||and|3" → {1, 3}<br />
while args[i + 2] == options.andKeyword do<br />
if args[i + 3] then <br />
table.insert(forRow.pages, args[i + 3])<br />
end<br />
-- Increment to next "and"<br />
i = i + 2<br />
end<br />
-- Increment to next use<br />
i = i + 2<br />
-- Append the row<br />
table.insert(forTable, forRow)<br />
until terminated or i > maxArg<br />
<br />
return forTable<br />
end<br />
<br />
-- Stringifies a table as formatted by forSeeArgsToTable<br />
function p.forSeeTableToString (forSeeTable, options)<br />
-- Type-checks and defaults<br />
checkType("forSeeTableToString", 1, forSeeTable, "table", true)<br />
checkType("forSeeTableToString", 2, options, "table", true)<br />
options = options or {}<br />
for k, v in pairs(forSeeDefaultOptions) do<br />
if options[k] == nil then options[k] = v end<br />
end<br />
-- Stringify each for-see item into a list<br />
local strList = {}<br />
if forSeeTable then<br />
for k, v in pairs(forSeeTable) do<br />
local useStr = v.use or options.otherText<br />
local pagesStr =<br />
p.andList(v.pages, true) or<br />
mFormatLink._formatLink{<br />
categorizeMissing = mHatnote.missingTargetCat,<br />
link = mHatnote.disambiguate(options.title)<br />
}<br />
local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr)<br />
forSeeStr = punctuationCollapse(forSeeStr)<br />
table.insert(strList, forSeeStr)<br />
end<br />
end<br />
if options.extratext then table.insert(strList, punctuationCollapse(options.extratext..'.')) end<br />
-- Return the concatenated list<br />
return table.concat(strList, ' ')<br />
end<br />
<br />
-- Produces a "For X, see [[Y]]" string from arguments. Expects index gaps<br />
-- but not blank/whitespace values. Ignores named args and args < "from".<br />
function p._forSee (args, from, options)<br />
local forSeeTable = p.forSeeArgsToTable(args, from, options)<br />
return p.forSeeTableToString(forSeeTable, options)<br />
end<br />
<br />
-- As _forSee, but uses the frame.<br />
function p.forSee (frame, from, options)<br />
mArguments = require('Module:Arguments')<br />
return p._forSee(mArguments.getArgs(frame), from, options)<br />
end<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Hatnote/styles.css&diff=524Module:Hatnote/styles.css2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>/* {{pp|small=y}} */<br />
.hatnote {<br />
font-style: italic;<br />
}<br />
<br />
/* Limit structure CSS to divs because of [[Module:Hatnote inline]] */<br />
div.hatnote {<br />
/* @noflip */<br />
padding-left: 1.6em;<br />
margin-bottom: 0.5em;<br />
}<br />
<br />
.hatnote i {<br />
font-style: normal;<br />
}<br />
<br />
/* The templatestyles element inserts a link element before hatnotes.<br />
* TODO: Remove link if/when WMF resolves T200206 */<br />
.hatnote + link + .hatnote {<br />
margin-top: -0.5em;<br />
}</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Hatnote&diff=522Module:Hatnote2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>--------------------------------------------------------------------------------<br />
-- Module:Hatnote --<br />
-- --<br />
-- This module produces hatnote links and links to related articles. It --<br />
-- implements the {{hatnote}} and {{format link}} meta-templates and includes --<br />
-- helper functions for other Lua hatnote modules. --<br />
--------------------------------------------------------------------------------<br />
<br />
local libraryUtil = require('libraryUtil')<br />
local checkType = libraryUtil.checkType<br />
local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg<br />
local mArguments -- lazily initialise [[Module:Arguments]]<br />
local yesno -- lazily initialise [[Module:Yesno]]<br />
local formatLink -- lazily initialise [[Module:Format link]] ._formatLink<br />
<br />
local p = {}<br />
<br />
--------------------------------------------------------------------------------<br />
-- Helper functions<br />
--------------------------------------------------------------------------------<br />
<br />
local function getArgs(frame)<br />
-- Fetches the arguments from the parent frame. Whitespace is trimmed and<br />
-- blanks are removed.<br />
mArguments = require('Module:Arguments')<br />
return mArguments.getArgs(frame, {parentOnly = true})<br />
end<br />
<br />
local function removeInitialColon(s)<br />
-- Removes the initial colon from a string, if present.<br />
return s:match('^:?(.*)')<br />
end<br />
<br />
function p.defaultClasses(inline)<br />
-- Provides the default hatnote classes as a space-separated string; useful<br />
-- for hatnote-manipulation modules like [[Module:Hatnote group]].<br />
return<br />
(inline == 1 and 'hatnote-inline' or 'hatnote') .. ' ' ..<br />
'navigation-not-searchable'<br />
end<br />
<br />
function p.disambiguate(page, disambiguator)<br />
-- Formats a page title with a disambiguation parenthetical,<br />
-- i.e. "Example" → "Example (disambiguation)".<br />
checkType('disambiguate', 1, page, 'string')<br />
checkType('disambiguate', 2, disambiguator, 'string', true)<br />
disambiguator = disambiguator or 'disambiguation'<br />
return mw.ustring.format('%s (%s)', page, disambiguator)<br />
end<br />
<br />
function p.findNamespaceId(link, removeColon)<br />
-- Finds the namespace id (namespace number) of a link or a pagename. This<br />
-- function will not work if the link is enclosed in double brackets. Colons<br />
-- are trimmed from the start of the link by default. To skip colon<br />
-- trimming, set the removeColon parameter to false.<br />
checkType('findNamespaceId', 1, link, 'string')<br />
checkType('findNamespaceId', 2, removeColon, 'boolean', true)<br />
if removeColon ~= false then<br />
link = removeInitialColon(link)<br />
end<br />
local namespace = link:match('^(.-):')<br />
if namespace then<br />
local nsTable = mw.site.namespaces[namespace]<br />
if nsTable then<br />
return nsTable.id<br />
end<br />
end<br />
return 0<br />
end<br />
<br />
function p.makeWikitextError(msg, helpLink, addTrackingCategory, title)<br />
-- Formats an error message to be returned to wikitext. If<br />
-- addTrackingCategory is not false after being returned from<br />
-- [[Module:Yesno]], and if we are not on a talk page, a tracking category<br />
-- is added.<br />
checkType('makeWikitextError', 1, msg, 'string')<br />
checkType('makeWikitextError', 2, helpLink, 'string', true)<br />
yesno = require('Module:Yesno')<br />
title = title or mw.title.getCurrentTitle()<br />
-- Make the help link text.<br />
local helpText<br />
if helpLink then<br />
helpText = ' ([[' .. helpLink .. '|help]])'<br />
else<br />
helpText = ''<br />
end<br />
-- Make the category text.<br />
local category<br />
if not title.isTalkPage -- Don't categorise talk pages<br />
and title.namespace ~= 2 -- Don't categorise userspace<br />
and yesno(addTrackingCategory) ~= false -- Allow opting out<br />
then<br />
category = 'Hatnote templates with errors'<br />
category = mw.ustring.format(<br />
'[[%s:%s]]',<br />
mw.site.namespaces[14].name,<br />
category<br />
)<br />
else<br />
category = ''<br />
end<br />
return mw.ustring.format(<br />
'<strong class="error">Error: %s%s.</strong>%s',<br />
msg,<br />
helpText,<br />
category<br />
)<br />
end<br />
<br />
local curNs = mw.title.getCurrentTitle().namespace<br />
p.missingTargetCat =<br />
--Default missing target category, exported for use in related modules<br />
((curNs == 0) or (curNs == 14)) and<br />
'Articles with hatnote templates targeting a nonexistent page' or nil<br />
<br />
function p.quote(title)<br />
--Wraps titles in quotation marks. If the title starts/ends with a quotation<br />
--mark, kerns that side as with {{-'}}<br />
local quotationMarks = {<br />
["'"]=true, ['"']=true, ['“']=true, ["‘"]=true, ['”']=true, ["’"]=true<br />
}<br />
local quoteLeft, quoteRight = -- Test if start/end are quotation marks<br />
quotationMarks[string.sub(title, 1, 1)],<br />
quotationMarks[string.sub(title, -1, -1)]<br />
if quoteLeft or quoteRight then<br />
title = mw.html.create("span"):wikitext(title)<br />
end<br />
if quoteLeft then title:css("padding-left", "0.15em") end<br />
if quoteRight then title:css("padding-right", "0.15em") end<br />
return '"' .. tostring(title) .. '"'<br />
end<br />
<br />
--------------------------------------------------------------------------------<br />
-- Hatnote<br />
--<br />
-- Produces standard hatnote text. Implements the {{hatnote}} template.<br />
--------------------------------------------------------------------------------<br />
<br />
function p.hatnote(frame)<br />
local args = getArgs(frame)<br />
local s = args[1]<br />
if not s then<br />
return p.makeWikitextError(<br />
'no text specified',<br />
'Template:Hatnote#Errors',<br />
args.category<br />
)<br />
end<br />
return p._hatnote(s, {<br />
extraclasses = args.extraclasses,<br />
selfref = args.selfref<br />
})<br />
end<br />
<br />
function p._hatnote(s, options)<br />
checkType('_hatnote', 1, s, 'string')<br />
checkType('_hatnote', 2, options, 'table', true)<br />
options = options or {}<br />
local inline = options.inline<br />
local hatnote = mw.html.create(inline == 1 and 'span' or 'div')<br />
local extraclasses<br />
if type(options.extraclasses) == 'string' then<br />
extraclasses = options.extraclasses<br />
end<br />
<br />
hatnote<br />
:attr('role', 'note')<br />
:addClass(p.defaultClasses(inline))<br />
:addClass(extraclasses)<br />
:addClass(options.selfref and 'selfref' or nil)<br />
:wikitext(s)<br />
<br />
return mw.getCurrentFrame():extensionTag{<br />
name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' }<br />
} .. tostring(hatnote)<br />
end<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Format_link&diff=520Module:Format link2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>--------------------------------------------------------------------------------<br />
-- Format link<br />
--<br />
-- Makes a wikilink from the given link and display values. Links are escaped<br />
-- with colons if necessary, and links to sections are detected and displayed<br />
-- with " § " as a separator rather than the standard MediaWiki "#". Used in<br />
-- the {{format link}} template.<br />
--------------------------------------------------------------------------------<br />
local libraryUtil = require('libraryUtil')<br />
local checkType = libraryUtil.checkType<br />
local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg<br />
local mArguments -- lazily initialise [[Module:Arguments]]<br />
local mError -- lazily initialise [[Module:Error]]<br />
local yesno -- lazily initialise [[Module:Yesno]]<br />
<br />
local p = {}<br />
<br />
--------------------------------------------------------------------------------<br />
-- Helper functions<br />
--------------------------------------------------------------------------------<br />
<br />
local function getArgs(frame)<br />
-- Fetches the arguments from the parent frame. Whitespace is trimmed and<br />
-- blanks are removed.<br />
mArguments = require('Module:Arguments')<br />
return mArguments.getArgs(frame, {parentOnly = true})<br />
end<br />
<br />
local function removeInitialColon(s)<br />
-- Removes the initial colon from a string, if present.<br />
return s:match('^:?(.*)')<br />
end<br />
<br />
local function maybeItalicize(s, shouldItalicize)<br />
-- Italicize s if s is a string and the shouldItalicize parameter is true.<br />
if s and shouldItalicize then<br />
return '<i>' .. s .. '</i>'<br />
else<br />
return s<br />
end<br />
end<br />
<br />
local function parseLink(link)<br />
-- Parse a link and return a table with the link's components.<br />
-- These components are:<br />
-- - link: the link, stripped of any initial colon (always present)<br />
-- - page: the page name (always present)<br />
-- - section: the page name (may be nil)<br />
-- - display: the display text, if manually entered after a pipe (may be nil)<br />
link = removeInitialColon(link)<br />
<br />
-- Find whether a faux display value has been added with the {{!}} magic<br />
-- word.<br />
local prePipe, display = link:match('^(.-)|(.*)$')<br />
link = prePipe or link<br />
<br />
-- Find the page, if it exists.<br />
-- For links like [[#Bar]], the page will be nil.<br />
local preHash, postHash = link:match('^(.-)#(.*)$')<br />
local page<br />
if not preHash then<br />
-- We have a link like [[Foo]].<br />
page = link<br />
elseif preHash ~= '' then<br />
-- We have a link like [[Foo#Bar]].<br />
page = preHash<br />
end<br />
<br />
-- Find the section, if it exists.<br />
local section<br />
if postHash and postHash ~= '' then<br />
section = postHash<br />
end<br />
<br />
return {<br />
link = link,<br />
page = page,<br />
section = section,<br />
display = display,<br />
}<br />
end<br />
<br />
local function formatDisplay(parsed, options)<br />
-- Formats a display string based on a parsed link table (matching the<br />
-- output of parseLink) and an options table (matching the input options for<br />
-- _formatLink).<br />
local page = maybeItalicize(parsed.page, options.italicizePage)<br />
local section = maybeItalicize(parsed.section, options.italicizeSection)<br />
if (not section) then<br />
return page<br />
elseif (not page) then<br />
return mw.ustring.format('§&nbsp;%s', section)<br />
else<br />
return mw.ustring.format('%s §&nbsp;%s', page, section)<br />
end<br />
end<br />
<br />
local function missingArgError(target)<br />
mError = require('Module:Error')<br />
return mError.error{message =<br />
'Error: no link or target specified! ([[' .. target .. '#Errors|help]])'<br />
}<br />
end<br />
<br />
--------------------------------------------------------------------------------<br />
-- Main functions<br />
--------------------------------------------------------------------------------<br />
<br />
function p.formatLink(frame)<br />
-- The formatLink export function, for use in templates.<br />
yesno = require('Module:Yesno')<br />
local args = getArgs(frame)<br />
local link = args[1] or args.link<br />
local target = args[3] or args.target<br />
if not (link or target) then<br />
return missingArgError('Template:Format link')<br />
end<br />
<br />
return p._formatLink{<br />
link = link,<br />
display = args[2] or args.display,<br />
target = target,<br />
italicizePage = yesno(args.italicizepage),<br />
italicizeSection = yesno(args.italicizesection),<br />
categorizeMissing = args.categorizemissing<br />
}<br />
end<br />
<br />
function p._formatLink(options)<br />
-- The formatLink export function, for use in modules.<br />
checkType('_formatLink', 1, options, 'table')<br />
local function check(key, expectedType) --for brevity<br />
checkTypeForNamedArg(<br />
'_formatLink', key, options[key], expectedType or 'string', true<br />
)<br />
end<br />
check('link')<br />
check('display')<br />
check('target')<br />
check('italicizePage', 'boolean')<br />
check('italicizeSection', 'boolean')<br />
check('categorizeMissing')<br />
<br />
-- Normalize link and target and check that at least one is present<br />
if options.link == '' then options.link = nil end<br />
if options.target == '' then options.target = nil end<br />
if not (options.link or options.target) then<br />
return missingArgError('Module:Format link')<br />
end<br />
<br />
local parsed = parseLink(options.link)<br />
local display = options.display or parsed.display<br />
local catMissing = options.categorizeMissing<br />
local category = ''<br />
<br />
-- Find the display text<br />
if not display then display = formatDisplay(parsed, options) end<br />
<br />
-- Handle the target option if present<br />
if options.target then<br />
local parsedTarget = parseLink(options.target)<br />
parsed.link = parsedTarget.link<br />
parsed.page = parsedTarget.page<br />
end<br />
<br />
-- Test if page exists if a diagnostic category is specified<br />
if catMissing and (mw.ustring.len(catMissing) > 0) then<br />
local title = nil<br />
if parsed.page then title = mw.title.new(parsed.page) end<br />
if title and (not title.isExternal) and (not title.exists) then<br />
category = mw.ustring.format('[[Category:%s]]', catMissing)<br />
end<br />
end<br />
<br />
-- Format the result as a link<br />
if parsed.link == display then<br />
return mw.ustring.format('[[:%s]]%s', parsed.link, category)<br />
else<br />
return mw.ustring.format('[[:%s|%s]]%s', parsed.link, display, category)<br />
end<br />
end<br />
<br />
--------------------------------------------------------------------------------<br />
-- Derived convenience functions<br />
--------------------------------------------------------------------------------<br />
<br />
function p.formatPages(options, pages)<br />
-- Formats an array of pages using formatLink and the given options table,<br />
-- and returns it as an array. Nil values are not allowed.<br />
local ret = {}<br />
for i, page in ipairs(pages) do<br />
ret[i] = p._formatLink{<br />
link = page,<br />
categorizeMissing = options.categorizeMissing,<br />
italicizePage = options.italicizePage,<br />
italicizeSection = options.italicizeSection<br />
}<br />
end<br />
return ret<br />
end<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:File_link&diff=518Module:File link2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>-- This module provides a library for formatting file wikilinks.<br />
<br />
local yesno = require('Module:Yesno')<br />
local checkType = require('libraryUtil').checkType<br />
<br />
local p = {}<br />
<br />
function p._main(args)<br />
checkType('_main', 1, args, 'table')<br />
<br />
-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our<br />
-- own function to get the right error level.<br />
local function checkArg(key, val, level)<br />
if type(val) ~= 'string' then<br />
error(string.format(<br />
"type error in '%s' parameter of '_main' (expected string, got %s)",<br />
key, type(val)<br />
), level)<br />
end<br />
end<br />
<br />
local ret = {}<br />
<br />
-- Adds a positional parameter to the buffer.<br />
local function addPositional(key)<br />
local val = args[key]<br />
if not val then<br />
return nil<br />
end<br />
checkArg(key, val, 4)<br />
ret[#ret + 1] = val<br />
end<br />
<br />
-- Adds a named parameter to the buffer. We assume that the parameter name<br />
-- is the same as the argument key.<br />
local function addNamed(key)<br />
local val = args[key]<br />
if not val then<br />
return nil<br />
end<br />
checkArg(key, val, 4)<br />
ret[#ret + 1] = key .. '=' .. val<br />
end<br />
<br />
-- Filename<br />
checkArg('file', args.file, 3)<br />
ret[#ret + 1] = 'File:' .. args.file<br />
<br />
-- Format<br />
if args.format then<br />
checkArg('format', args.format)<br />
if args.formatfile then<br />
checkArg('formatfile', args.formatfile)<br />
ret[#ret + 1] = args.format .. '=' .. args.formatfile<br />
else<br />
ret[#ret + 1] = args.format<br />
end<br />
end<br />
<br />
-- Border<br />
if yesno(args.border) then<br />
ret[#ret + 1] = 'border'<br />
end<br />
<br />
addPositional('location')<br />
addPositional('alignment')<br />
addPositional('size')<br />
addNamed('upright')<br />
addNamed('link')<br />
addNamed('alt')<br />
addNamed('page')<br />
addNamed('class')<br />
addNamed('lang')<br />
addNamed('start')<br />
addNamed('end')<br />
addNamed('thumbtime')<br />
addPositional('caption')<br />
<br />
return string.format('[[%s]]', table.concat(ret, '|'))<br />
end<br />
<br />
function p.main(frame)<br />
local origArgs = require('Module:Arguments').getArgs(frame, {<br />
wrappers = 'Template:File link'<br />
})<br />
if not origArgs.file then<br />
error("'file' parameter missing from [[Template:File link]]", 0)<br />
end<br />
<br />
-- Copy the arguments that were passed to a new table to avoid looking up<br />
-- every possible parameter in the frame object.<br />
local args = {}<br />
for k, v in pairs(origArgs) do<br />
-- Make _BLANK a special argument to add a blank parameter. For use in<br />
-- conditional templates etc. it is useful for blank arguments to be<br />
-- ignored, but we still need a way to specify them so that we can do<br />
-- things like [[File:Example.png|link=]].<br />
if v == '_BLANK' then<br />
v = ''<br />
end<br />
args[k] = v<br />
end<br />
return p._main(args)<br />
end<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Effective_protection_level&diff=516Module:Effective protection level2022-10-01T05:27:26Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>local p = {}<br />
<br />
-- Returns the permission required to perform a given action on a given title.<br />
-- If no title is specified, the title of the page being displayed is used.<br />
function p._main(action, pagename)<br />
local title<br />
if type(pagename) == 'table' and pagename.prefixedText then<br />
title = pagename<br />
elseif pagename then<br />
title = mw.title.new(pagename)<br />
else<br />
title = mw.title.getCurrentTitle()<br />
end<br />
pagename = title.prefixedText<br />
if action == 'autoreview' then<br />
local level = mw.ext.FlaggedRevs.getStabilitySettings(title)<br />
level = level and level.autoreview<br />
if level == 'review' then<br />
return 'reviewer'<br />
elseif level ~= '' then<br />
return level<br />
else<br />
return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not '', as that would mean PC-protected but nobody can review<br />
end<br />
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' and action ~= 'undelete' then<br />
error( 'First parameter must be one of edit, move, create, upload, undelete, autoreview', 2 )<br />
end<br />
if title.namespace == 8 then -- MediaWiki namespace<br />
if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page<br />
return 'interfaceadmin'<br />
else -- any non-JS/CSS MediaWiki page<br />
return 'sysop'<br />
end<br />
elseif title.namespace == 2 and title.isSubpage then<br />
if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page<br />
return 'interfaceadmin'<br />
elseif title.contentModel == 'json' then -- user JSON page<br />
return 'sysop'<br />
end<br />
end<br />
if action == 'undelete' then<br />
return 'sysop'<br />
end<br />
local level = title.protectionLevels[action] and title.protectionLevels[action][1]<br />
if level == 'sysop' or level == 'editprotected' then<br />
return 'sysop'<br />
elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page<br />
return 'sysop'<br />
elseif level == 'templateeditor' then<br />
return 'templateeditor'<br />
elseif action == 'move' then<br />
local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move.<br />
if blacklistentry and not blacklistentry.params.autoconfirmed then<br />
return 'templateeditor'<br />
elseif title.namespace == 6 then<br />
return 'filemover'<br />
elseif level == 'extendedconfirmed' then<br />
return 'extendedconfirmed'<br />
else<br />
return 'autoconfirmed'<br />
end<br />
end<br />
local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename)<br />
if blacklistentry then<br />
if not blacklistentry.params.autoconfirmed then<br />
return 'templateeditor'<br />
elseif level == 'extendedconfirmed' then<br />
return 'extendedconfirmed'<br />
else<br />
return 'autoconfirmed'<br />
end<br />
elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason<br />
return 'autoconfirmed'<br />
elseif level then<br />
return level<br />
elseif action == 'upload' then<br />
return 'autoconfirmed'<br />
elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts<br />
return 'user'<br />
else<br />
return '*'<br />
end<br />
end<br />
<br />
setmetatable(p, { __index = function(t, k)<br />
return function(frame)<br />
return t._main(k, frame.args[1])<br />
end<br />
end })<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Effective_protection_expiry&diff=514Module:Effective protection expiry2022-10-01T05:27:25Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>local p = {}<br />
<br />
-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known.<br />
-- If no title is specified, the title of the page being displayed is used.<br />
function p._main(action, pagename)<br />
local title<br />
if type(pagename) == 'table' and pagename.prefixedText then<br />
title = pagename<br />
elseif pagename then<br />
title = mw.title.new(pagename)<br />
else<br />
title = mw.title.getCurrentTitle()<br />
end<br />
pagename = title.prefixedText<br />
if action == 'autoreview' then<br />
local stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title)<br />
return stabilitySettings and stabilitySettings.expiry or 'unknown'<br />
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then<br />
error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 )<br />
end<br />
local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename)<br />
if rawExpiry == 'infinity' then<br />
return 'infinity'<br />
elseif rawExpiry == '' then<br />
return 'unknown'<br />
else<br />
local year, month, day, hour, minute, second = rawExpiry:match(<br />
'^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$'<br />
)<br />
if year then<br />
return string.format(<br />
'%s-%s-%sT%s:%s:%s',<br />
year, month, day, hour, minute, second<br />
)<br />
else<br />
error('internal error in Module:Effective protection expiry; malformed expiry timestamp')<br />
end<br />
end<br />
end<br />
<br />
setmetatable(p, { __index = function(t, k)<br />
return function(frame)<br />
return t._main(k, frame.args[1])<br />
end<br />
end })<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Module:Distinguish&diff=512Module:Distinguish2022-10-01T05:27:25Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>local mHatnote = require('Module:Hatnote')<br />
local mHatlist = require('Module:Hatnote list')<br />
local mArguments --initialize lazily<br />
local mTableTools --initialize lazily<br />
local libraryUtil = require('libraryUtil')<br />
local checkType = libraryUtil.checkType<br />
local p = {}<br />
<br />
function p.distinguish(frame)<br />
mArguments = require('Module:Arguments')<br />
mTableTools = require('Module:TableTools')<br />
local args = mArguments.getArgs(frame)<br />
local selfref = args.selfref<br />
local text = args.text<br />
args = mTableTools.compressSparseArray(args)<br />
return p._distinguish(args, text, selfref)<br />
end<br />
<br />
function p._distinguish(args, text, selfref)<br />
checkType("_distinguish", 1, args, 'table')<br />
if #args == 0 and not text then return '' end<br />
local text = string.format(<br />
'Not to be confused with %s.',<br />
text or mHatlist.orList(args, true)<br />
)<br />
hnOptions = {selfref = selfref}<br />
return mHatnote._hatnote(text, hnOptions)<br />
end<br />
<br />
return p</div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Sidebar&diff=510Template:Sidebar2022-10-01T05:27:25Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>{{#invoke:Sidebar|sidebar}}<noinclude><br />
{{documentation}}</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Distinguish&diff=508Template:Distinguish2022-10-01T05:27:25Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>{{#invoke:Distinguish|distinguish}}<noinclude><!-- splitting these lines causes {{Documentation}} template to terminate green shading when Distinguish is used in /doc pages. --><br />
{{Documentation}}<br />
<!-- Add categories to the /doc subpage and interwikis to Wikidata, not here! --><br />
</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Clear&diff=506Template:Clear2022-10-01T05:27:25Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div><div style="clear:{{{1|both}}};"></div><noinclude><br />
{{documentation}}<br />
</noinclude></div>UnderMybrellahttps://wiki.spiralframework.info/w/index.php?title=Template:Template_other&diff=504Template:Template other2022-10-01T05:27:25Z<p>UnderMybrella: 1 revision imported</p>
<hr />
<div>{{#switch:<br />
<!--If no or empty "demospace" parameter then detect namespace--><br />
{{#if:{{{demospace|}}}<br />
| {{lc: {{{demospace}}} }} <!--Use lower case "demospace"--><br />
| {{#ifeq:{{NAMESPACE}}|{{ns:Template}}<br />
| template<br />
| other<br />
}}<br />
}}<br />
| template = {{{1|}}}<br />
| other<br />
| #default = {{{2|}}}<br />
}}<!--End switch--><noinclude><br />
<br />
{{documentation}}<br />
<!-- Add categories and interwikis to the /doc subpage, not here! --><br />
</noinclude></div>UnderMybrella