https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3AFormat_TemplateData%2Fglobal
Module:Format TemplateData/global - Revision history
2025-05-27T19:55:56Z
Revision history for this page on the wiki
MediaWiki 1.45.0-wmf.2
https://en.wikipedia.org/w/index.php?title=Module:Format_TemplateData/global&diff=1101743504&oldid=prev
Tholme: imported from dewiki
2022-08-01T15:57:10Z
<p>imported from dewiki</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 15:57, 1 August 2022</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local Export = { suite = "TemplateDataGlobal",</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local Export = { suite = "TemplateDataGlobal",</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> serial = "<del style="font-weight: bold; text-decoration: none;">2018</del>-<del style="font-weight: bold; text-decoration: none;">04</del>-<del style="font-weight: bold; text-decoration: none;">15</del>",</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> serial = "<ins style="font-weight: bold; text-decoration: none;">2020</ins>-<ins style="font-weight: bold; text-decoration: none;">08</ins>-<ins style="font-weight: bold; text-decoration: none;">01</ins>",</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> item = 51435481,</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> item = 51435481,</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> subpages = "TemplateData",</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> subpages = "TemplateData",</div></td>
</tr>
<tr>
<td colspan="2" class="diff-lineno">Line 9:</td>
<td colspan="2" class="diff-lineno">Line 9:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Inspired by [[User:Yurik]].</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Inspired by [[User:Yurik]].</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>]=]</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>]=]</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>local Failsafe = Export</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>local function <del style="font-weight: bold; text-decoration: none;">failsafe</del>( <del style="font-weight: bold; text-decoration: none;">assert</del> )</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>local<ins style="font-weight: bold; text-decoration: none;"> failsafe =</ins> function ( <ins style="font-weight: bold; text-decoration: none;">atleast</ins> )</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- Retrieve versioning and check for compliance</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- Retrieve versioning and check for compliance</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- Precondition:</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- Precondition:</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> -- <del style="font-weight: bold; text-decoration: none;">assert</del> -- string, with required version<del style="font-weight: bold; text-decoration: none;"> or "wikidata",</del></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> -- <ins style="font-weight: bold; text-decoration: none;">atleast</ins> -- string, with required version</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> -- or false</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> --<ins style="font-weight: bold; text-decoration: none;"> </ins> <ins style="font-weight: bold; text-decoration: none;"> or "wikidata" or "~" or "@"</ins> or false</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- Postcondition:</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- Postcondition:</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> -- Returns string with <del style="font-weight: bold; text-decoration: none;">appropriate</del> version, <del style="font-weight: bold; text-decoration: none;">or</del> <del style="font-weight: bold; text-decoration: none;">false</del></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> -- Returns string<ins style="font-weight: bold; text-decoration: none;"> --</ins> with <ins style="font-weight: bold; text-decoration: none;">queried</ins> version<ins style="font-weight: bold; text-decoration: none;">/item</ins>, <ins style="font-weight: bold; text-decoration: none;">also if</ins> <ins style="font-weight: bold; text-decoration: none;">problem</ins></div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> -- false -- if appropriate</div></td>
</tr>
<tr>
<td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_12_3_rhs">⚫</a></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_11_0_lhs"></a> local since = <del style="font-weight: bold; text-decoration: none;">assert</del></div></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> -- 2020-08-01</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local last = ( atleast == "~" )</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local link = ( atleast == "@" )</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_11_0_lhs">⚫</a></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_12_3_rhs"></a> local since = <ins style="font-weight: bold; text-decoration: none;">atleast</ins></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local r</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local r</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> if since == "wikidata" then</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> if<ins style="font-weight: bold; text-decoration: none;"> last or link or </ins> since == "wikidata" then</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> local item = <del style="font-weight: bold; text-decoration: none;">Export</del>.item</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local item = <ins style="font-weight: bold; text-decoration: none;">Failsafe</ins>.item</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> since = false</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> since = false</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if type( item ) == "number" and item > 0 then</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if type( item ) == "number" and item > 0 then</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> local <del style="font-weight: bold; text-decoration: none;">entity</del> =<del style="font-weight: bold; text-decoration: none;"> mw.wikibase.getEntity(</del> string.format( "Q%d",</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local <ins style="font-weight: bold; text-decoration: none;">suited</ins> = string.format( "Q%d",<ins style="font-weight: bold; text-decoration: none;"> item )</ins></div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local entity = mw.wikibase.getEntity( suited )</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> item ) )</div></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if type( entity ) == "table" then</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if type( entity ) == "table" then</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> local <del style="font-weight: bold; text-decoration: none;">vsn</del> = <del style="font-weight: bold; text-decoration: none;">entity:formatPropertyValues(</del> "P348"<del style="font-weight: bold; text-decoration: none;"> )</del></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local <ins style="font-weight: bold; text-decoration: none;">seek</ins> = <ins style="font-weight: bold; text-decoration: none;">Failsafe.serialProperty or</ins> "P348"</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local vsn = entity:formatPropertyValues( seek )</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if type( vsn ) == "table" and</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if type( vsn ) == "table" and</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> type( vsn.value) == "string" and</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> type( vsn.value<ins style="font-weight: bold; text-decoration: none;"> </ins>) == "string"<ins style="font-weight: bold; text-decoration: none;"> </ins> and</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> vsn.value ~= "" then</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> vsn.value ~= "" then</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <del style="font-weight: bold; text-decoration: none;">r</del> <del style="font-weight: bold; text-decoration: none;">=</del> vsn.value</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">if last and</ins> vsn.value<ins style="font-weight: bold; text-decoration: none;"> == Failsafe.serial then</ins></div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> r = false</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> elseif link then</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> if mw.title.getCurrentTitle().prefixedText ==</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> mw.wikibase.getSitelink( suited ) then</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> r = false</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> else</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> r = suited</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> else</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> r = vsn.value</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> if <del style="font-weight: bold; text-decoration: none;">not</del> r then</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> if <ins style="font-weight: bold; text-decoration: none;">type(</ins> r<ins style="font-weight: bold; text-decoration: none;"> ) == "nil"</ins> then</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> if not since or since <= <del style="font-weight: bold; text-decoration: none;">Export</del>.serial then</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> if not since or since <= <ins style="font-weight: bold; text-decoration: none;">Failsafe</ins>.serial then</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> r = <del style="font-weight: bold; text-decoration: none;">Export</del>.serial</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> r = <ins style="font-weight: bold; text-decoration: none;">Failsafe</ins>.serial</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> else</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> else</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> r = false</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> r = false</div></td>
</tr>
</table>
Tholme
https://en.wikipedia.org/w/index.php?title=Module:Format_TemplateData/global&diff=893688350&oldid=prev
Pppery: Pppery moved page Module:TemplateData/global to Module:Format TemplateData/global without leaving a redirect
2019-04-22T23:51:00Z
<p>Pppery moved page <a href="/w/index.php?title=Module:TemplateData/global&action=edit&redlink=1" class="new" title="Module:TemplateData/global (page does not exist)">Module:TemplateData/global</a> to <a href="/wiki/Module:Format_TemplateData/global" title="Module:Format TemplateData/global">Module:Format TemplateData/global</a> without leaving a redirect</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="en">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 23:51, 22 April 2019</td>
</tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>
Pppery
https://en.wikipedia.org/w/index.php?title=Module:Format_TemplateData/global&diff=837098276&oldid=prev
PerfektesChaos: 2018-04-15
2018-04-18T18:10:08Z
<p>2018-04-15</p>
<p><b>New page</b></p><div>local Export = { suite = "TemplateDataGlobal",<br />
serial = "2018-04-15",<br />
item = 51435481,<br />
subpages = "TemplateData",<br />
suffix = "tab" }<br />
--[=[<br />
Retrieve TemplateData from Commons:Data (or other global source)<br />
require()<br />
Inspired by [[User:Yurik]].<br />
]=]<br />
<br />
<br />
<br />
local function failsafe( assert )<br />
-- Retrieve versioning and check for compliance<br />
-- Precondition:<br />
-- assert -- string, with required version or "wikidata",<br />
-- or false<br />
-- Postcondition:<br />
-- Returns string with appropriate version, or false<br />
local since = assert<br />
local r<br />
if since == "wikidata" then<br />
local item = Export.item<br />
since = false<br />
if type( item ) == "number" and item > 0 then<br />
local entity = mw.wikibase.getEntity( string.format( "Q%d",<br />
item ) )<br />
if type( entity ) == "table" then<br />
local vsn = entity:formatPropertyValues( "P348" )<br />
if type( vsn ) == "table" and<br />
type( vsn.value) == "string" and<br />
vsn.value ~= "" then<br />
r = vsn.value<br />
end<br />
end<br />
end<br />
end<br />
if not r then<br />
if not since or since <= Export.serial then<br />
r = Export.serial<br />
else<br />
r = false<br />
end<br />
end<br />
return r<br />
end -- failsafe()<br />
<br />
<br />
<br />
local function fair( already, adapt, append )<br />
-- Merge local definitions into global base<br />
-- Parameter:<br />
-- already -- global item<br />
-- adapt -- local override item<br />
-- append -- append to sequence table<br />
-- Returns merged item<br />
local r<br />
if already and adapt then<br />
if type( already ) == "table" and<br />
type( adapt ) == "table" then<br />
r = already<br />
if append then<br />
for i = 1, #adapt do<br />
table.insert( r, adapt[ i ] )<br />
end -- for i<br />
else<br />
for k, v in pairs( adapt ) do<br />
r[ k ] = v<br />
end -- for k, v<br />
end<br />
else<br />
r = adapt<br />
end<br />
else<br />
r = already or adapt<br />
end<br />
return r<br />
end -- fair()<br />
<br />
<br />
local function feed( apply )<br />
-- Retrieve override from JSON code<br />
-- Parameter:<br />
-- apply -- string, with JSON<br />
-- Returns string, with error message, or table<br />
local lucky, r = pcall( mw.text.jsonDecode, apply )<br />
if not lucky then<br />
r = "fatal JSON error in LOCAL override"<br />
end<br />
return r<br />
end -- feed()<br />
<br />
<br />
<br />
local function find( access )<br />
-- Fetch data from page<br />
-- Parameter:<br />
-- access -- string, with core page name<br />
-- Returns<br />
-- 1. string, with prefixed page name<br />
-- 2. table with JSON data, or error message<br />
local storage = access<br />
local lucky, r<br />
if Export.suffix and not storage:find( ".", 2, true ) then<br />
local k = -1 - #Export.suffix<br />
if storage:sub( k ) ~= "." .. Export.suffix then<br />
storage = string.format( "%s.%s", storage, Export.suffix )<br />
end<br />
end<br />
if Export.subpages and not storage:find( "/", 1, true ) then<br />
storage = string.format( "%s/%s", Export.subpages, storage )<br />
end<br />
lucky, r = pcall( mw.ext.data.get, storage, "_" )<br />
storage = "Data:" .. storage<br />
if mw.site.siteName ~= "Wikimedia Commons" then<br />
storage = "commons:" .. storage<br />
end<br />
if type( r ) ~= "table" and type( r ) ~= "string" then<br />
r = "INVALID"<br />
end<br />
return storage, r<br />
end -- find()<br />
<br />
<br />
<br />
local function flat( apply )<br />
-- Convert tabular data into TemplateData<br />
-- Parameter:<br />
-- apply -- table, with tabular data<br />
-- Returns string, with error message, or table, with TemplateData<br />
local r, scream<br />
local function failed( at, alert )<br />
if scream then<br />
scream = string.format( "%s * #%d: %s",<br />
scream, at, alert )<br />
else<br />
scream = add<br />
end<br />
end -- failed()<br />
if type( apply.schema ) == "table" and<br />
type( apply.schema.fields ) == "table" and<br />
type( apply.data ) == "table" then<br />
local order = { }<br />
local entry, got, params, parOrder, s, sign, td, v<br />
for k, v in pairs( apply.schema.fields ) do<br />
if type( v ) == "table" then<br />
table.insert( order, v.name )<br />
end<br />
end -- for k, v<br />
for i = 1, #apply.data do<br />
entry = apply.data[ i ]<br />
if type( entry ) == "table" then<br />
got = { }<br />
sign = false<br />
for j = 1, #entry do<br />
s = order[ j ]<br />
v = entry[ j ]<br />
if type( v ) == "string" then<br />
v = mw.text.trim( v )<br />
if v == "" then<br />
v = false<br />
end<br />
end<br />
if v then<br />
if s == "name" then<br />
sign = v<br />
elseif s == "aliases" then<br />
if type( v ) == "string" then<br />
got.aliases = mw.text.split( v,<br />
"%s*|%s*" )<br />
else<br />
failed( i, "aliases not a string" )<br />
end<br />
else<br />
got[ s ] = v<br />
end<br />
end<br />
end -- for j<br />
if sign == "|" then<br />
if td then<br />
failed( i, "root repeated" )<br />
else<br />
td = { description = got.description }<br />
if type( got.type ) == "string" then<br />
td.format = got.type:gsub( "N", "\n" )<br />
end<br />
end<br />
elseif sign then<br />
if params then<br />
if params[ sign ] then<br />
failed( i, "name repeated: " .. sign )<br />
end<br />
else<br />
params = { }<br />
parOrder = { }<br />
end<br />
params[ sign ] = got<br />
table.insert( parOrder, sign )<br />
else<br />
failed( i, "missing name" )<br />
end<br />
else<br />
failed( i, "invalid component" )<br />
end<br />
end -- for i<br />
r = td or { }<br />
r.params = params<br />
r.paramOrder = parOrder<br />
else<br />
r = "bad tabular structure"<br />
end<br />
return scream or r or "EMPTY"<br />
end -- flat()<br />
<br />
<br />
<br />
local function flush( assembly, avoid )<br />
-- Remove element from sequence table<br />
-- Parameter:<br />
-- assembly -- sequence table<br />
-- avoid -- element<br />
for i = 1, #assembly do<br />
if assembly[ i ] == avoid then<br />
table.remove( assembly, i )<br />
break -- for i<br />
end<br />
end -- for i<br />
end -- flush()<br />
<br />
<br />
<br />
local function fold( already, adapt )<br />
-- Merge local parameter definitions into global base<br />
-- Parameter:<br />
-- already -- table, with global data<br />
-- adapt -- sequence table, with local params overrides<br />
-- Returns string, with error message, or table, with TemplateData<br />
local order = { }<br />
local params = { }<br />
local r = already<br />
local entry, override, s<br />
r.params = r.params or { }<br />
r.paramOrder = r.paramOrder or { }<br />
for i = 1, #adapt do<br />
override = adapt[ i ]<br />
if type( override ) ~= "table" then<br />
r = string.format( "No object at LOCAL params[%d]", i )<br />
break -- for i<br />
elseif type( override.global ) == "string" then<br />
s = override.global<br />
entry = r.params[ s ]<br />
if type( entry ) == "table" then<br />
flush( r.paramOrder, s )<br />
if type( override["local"] ) == "string" then<br />
s = override["local"]<br />
override["local"] = nil<br />
elseif override["local"] == false then<br />
entry = nil<br />
end<br />
if entry then<br />
override.global = nil<br />
for k, v in pairs( override ) do<br />
entry[ k ] = fair( entry[ k ], override[ k ],<br />
( k == "aliases" ) )<br />
end -- for k, v<br />
table.insert( order, s )<br />
end<br />
params[ s ] = entry<br />
else<br />
r = string.format( "No GLOBAL params %s for LOCAL [%d]",<br />
s, i )<br />
break -- for i<br />
end<br />
elseif type( override["local"] ) == "string" then<br />
s = override["local"]<br />
override["local"] = nil<br />
params[ s ] = override<br />
table.insert( order, s )<br />
else<br />
r = string.format( "No name for LOCAL params[%d]", i )<br />
break -- for i<br />
end<br />
end -- for i<br />
if type( r ) == "table" then<br />
for i = 1, #r.paramOrder do<br />
s = r.paramOrder[ i ]<br />
params[ s ] = r.params[ s ]<br />
table.insert( order, s )<br />
end -- for i<br />
r.params = params<br />
r.paramOrder = order<br />
end<br />
return r<br />
end -- fold()<br />
<br />
<br />
<br />
local function fork( already, adapt )<br />
-- Merge local definitions into global base<br />
-- Parameter:<br />
-- already -- table, with global data<br />
-- adapt -- table, with local overrides<br />
-- Returns string, with error message, or table, with TemplateData<br />
local root = { "description", "format", "maps", "sets", "style" }<br />
local r = already<br />
for k, v in pairs( root ) do<br />
if adapt[ v ] then<br />
r[ v ] = fair( r[ v ], adapt[ v ] )<br />
end<br />
end -- for k, v<br />
if type( adapt.params ) == "table" then<br />
r = fold( r, adapt.params )<br />
end<br />
return r<br />
end -- fork()<br />
<br />
<br />
<br />
local function furnish( apply, at, adapt )<br />
-- Convert external data into TemplateData<br />
-- Parameter:<br />
-- apply -- table, with external data<br />
-- at -- string, with page name<br />
-- adapt -- JSON string or table or not, with local overrides<br />
-- Returns string, with error message, or table, with TemplateData<br />
local r<br />
if at:sub( -4 ) == ".tab" then<br />
r = flat( apply )<br />
else<br />
r = "Unknown page format: " .. at<br />
end<br />
if adapt and type( r ) == "table" then<br />
local override = adapt<br />
if type( adapt ) == "string" then<br />
override = feed( adapt )<br />
if type( override ) == "string" then<br />
r = override<br />
end<br />
end<br />
if type( override ) == "table" then<br />
r = fork( r, override )<br />
end<br />
end<br />
return r<br />
end -- furnish()<br />
<br />
<br />
<br />
Export.failsafe = function ( frame )<br />
-- Versioning interface<br />
local s = type( frame )<br />
local since<br />
if s == "table" then<br />
since = frame.args[ 1 ]<br />
elseif s == "string" then<br />
since = frame<br />
end<br />
if since then<br />
since = mw.text.trim( since )<br />
if since == "" then<br />
since = false<br />
end<br />
end<br />
return failsafe( since ) or ""<br />
end -- Export.failsafe()<br />
<br />
<br />
<br />
Export.fetch = function ( access, adapt )<br />
-- Fetch data from site<br />
-- Parameter:<br />
-- access -- string, with page specification<br />
-- adapt -- JSON string or table or not, with local overrides<br />
-- Returns<br />
-- 1. string, with error message or prefixed page name<br />
-- 2. table with TemplateData, or not<br />
local storage, t = find( access )<br />
local s<br />
if type( t ) == "table" then<br />
t = furnish( t, storage, adapt )<br />
if type( t ) ~= "table" then<br />
s = t<br />
end<br />
else<br />
s = t<br />
end<br />
if type( t ) ~= "table" then<br />
storage = string.format( "[[%s]]", storage )<br />
if s then<br />
storage = string.format( "%s * %s", storage, s )<br />
end<br />
t = false<br />
end<br />
return storage, t<br />
end -- Export.fetch()<br />
<br />
<br />
<br />
return Export</div>
PerfektesChaos