https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3AContentious_topics_talk_banner%2Fsandbox Module:Contentious topics talk banner/sandbox - Revision history 2025-06-13T19:55:47Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.5 https://en.wikipedia.org/w/index.php?title=Module:Contentious_topics_talk_banner/sandbox&diff=1294008906&oldid=prev HouseBlaster: dipping my toes into the fray 2025-06-05T01:20:57Z <p>dipping my toes into the fray</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 01:20, 5 June 2025</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 40:</td> <td colspan="2" class="diff-lineno">Line 40:</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 args = require('Module:Arguments').getArgs(frame)</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 args = require('Module:Arguments').getArgs(frame)</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 topics = collectTopics(args)</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 topics = collectTopics(args)</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 partialTopics</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 restrictions = {} -- A list of which restrictions are enabled for easier iteration</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 restrictions = {} -- A list of which restrictions are enabled for easier iteration</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 restrictionFlags = {} -- Track which restrictions are enabled, as a set</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 restrictionFlags = {} -- Track which restrictions are enabled, as a set</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 230:</td> <td colspan="2" class="diff-lineno">Line 231:</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> </div></td> <td colspan="2" class="diff-empty diff-side-added"></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> </div></td> <td colspan="2" class="diff-empty diff-side-added"></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> --[[</div></td> <td colspan="2" class="diff-empty diff-side-added"></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> Now build some further information collapse boxes</div></td> <td colspan="2" class="diff-empty diff-side-added"></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> We get the content of each collapse box from Wikipedia:Contentious topics/[Topic]/Further information</div></td> <td colspan="2" class="diff-empty diff-side-added"></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> --]]</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> </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 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> -- Now build the messageBox</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> -- Now build the messageBox</div></td> </tr> </table> HouseBlaster https://en.wikipedia.org/w/index.php?title=Module:Contentious_topics_talk_banner/sandbox&diff=1293619371&oldid=prev HouseBlaster: test 2025-06-02T19:19:12Z <p>test</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 19:19, 2 June 2025</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 69:</td> <td colspan="2" class="diff-lineno">Line 69:</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 function alwaysAddRestriction(restriction)</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 function alwaysAddRestriction(restriction)</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> restrictionFlags[restriction] = true</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> restrictionFlags[restriction] = true</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_17_6_lhs">&#x26AB;</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_1_0_rhs"></a> end</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_17_0_lhs">&#x26AB;</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_1_1_rhs"></a> </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_17_1_lhs">&#x26AB;</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_1_2_rhs"></a> -- <ins style="font-weight: bold; text-decoration: none;">Helper</ins> to add a category</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_17_2_lhs">&#x26AB;</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_1_3_rhs"></a> local function addCategory(cat)</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_17_3_lhs">&#x26AB;</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_1_4_rhs"></a> if cat then</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_17_4_lhs">&#x26AB;</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_1_5_rhs"></a> categories = categories .. '[[Category:' .. cat .. '|' .. currentTitleObject.text .. ']]'</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_17_5_lhs">&#x26AB;</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_1_6_rhs"></a> 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> </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-lineno">Line 94:</td> <td colspan="2" class="diff-lineno">Line 101:</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 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> -- Add the protection level</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> -- Add the protection level</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 yesno(args.protection, true) 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> protectionLevel = subjectTitleObject.protectionLevels["edit"][1]</div></td> <td colspan="2" class="diff-empty diff-side-added"></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;">if </del>protectionLevel <del style="font-weight: bold; text-decoration: none;">then</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;"> </ins>protectionLevel <ins style="font-weight: bold; text-decoration: none;">= subjectTitleObject.protectionLevels["edit"][1]</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> if protectionLevel 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> -- we have page protection</div></td> <td colspan="2" class="diff-empty diff-side-added"></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;"> </del> --<del style="font-weight: bold; text-decoration: none;"> so</del> we <del style="font-weight: bold; text-decoration: none;">check</del> <del style="font-weight: bold; text-decoration: none;">if</del> <del style="font-weight: bold; text-decoration: none;">ECR is</del> <del style="font-weight: bold; text-decoration: none;">active</del>, and <del style="font-weight: bold; text-decoration: none;">if</del> <del style="font-weight: bold; text-decoration: none;">so</del> <del style="font-weight: bold; text-decoration: none;">only</del> <del style="font-weight: bold; text-decoration: none;">care about full protection</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;"> </ins> -- we <ins style="font-weight: bold; text-decoration: none;">have</ins> <ins style="font-weight: bold; text-decoration: none;">a</ins> <ins style="font-weight: bold; text-decoration: none;">|protection=foo</ins> <ins style="font-weight: bold; text-decoration: none;">parameter</ins>, and <ins style="font-weight: bold; text-decoration: none;">the</ins> <ins style="font-weight: bold; text-decoration: none;">page</ins> <ins style="font-weight: bold; text-decoration: none;">is</ins> <ins style="font-weight: bold; text-decoration: none;">protected</ins></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;"> </del> if restrictionFlags["ECR"] 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><ins style="font-weight: bold; text-decoration: none;"> </ins> if restrictionFlags["ECR"] 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> -- handle ECR with protection correctly</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 protectionLevel == "full" then alwaysAddRestriction("full") end</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> if protectionLevel == "full" then alwaysAddRestriction("full") 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> else</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> else</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_15_1_rhs">&#x26AB;</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_14_0_lhs"></a> alwaysAddRestriction(protectionLevel)</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> -- no ECR, so just add the protection as normal</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_14_0_lhs">&#x26AB;</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_15_1_rhs"></a> <ins style="font-weight: bold; text-decoration: none;"> </ins> alwaysAddRestriction(protectionLevel)</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> manualRestrictions = true</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> -- we have a |protection=foo parameter, but the page is *not* protected</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> addCategory(categoryDatabase['protection-error'])</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 colspan="2" class="diff-lineno">Line 132:</td> <td colspan="2" class="diff-lineno">Line 146:</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> -- Determines whether we should use the string "article" or "page"</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> -- Determines whether we should use the string "article" or "page"</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 articleOrPage = currentTitleObject:inNamespaces(1) and "article" or "page"</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 articleOrPage = currentTitleObject:inNamespaces(1) and "article" or "page"</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_1_1_rhs">&#x26AB;</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_17_0_lhs"></a> </div></td> <td colspan="2" class="diff-empty diff-side-added"></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_1_2_rhs">&#x26AB;</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_17_1_lhs"></a> -- <del style="font-weight: bold; text-decoration: none;">helper</del> to add a category</div></td> <td colspan="2" class="diff-empty diff-side-added"></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_1_3_rhs">&#x26AB;</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_17_2_lhs"></a> local function addCategory(cat)</div></td> <td colspan="2" class="diff-empty diff-side-added"></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_1_4_rhs">&#x26AB;</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_17_3_lhs"></a> if cat then</div></td> <td colspan="2" class="diff-empty diff-side-added"></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_1_5_rhs">&#x26AB;</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_17_4_lhs"></a> categories = categories .. '[[Category:' .. cat .. '|' .. currentTitleObject.text .. ']]'</div></td> <td colspan="2" class="diff-empty diff-side-added"></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_1_6_rhs">&#x26AB;</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_17_5_lhs"></a> end</div></td> <td colspan="2" class="diff-empty diff-side-added"></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_1_0_rhs">&#x26AB;</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_17_6_lhs"></a> end</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;"><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;"><div> -- Makes a bullet point for a given contentious topic</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> -- Makes a bullet point for a given contentious topic</div></td> </tr> </table> HouseBlaster https://en.wikipedia.org/w/index.php?title=Module:Contentious_topics_talk_banner/sandbox&diff=1293618031&oldid=prev HouseBlaster: Create sandbox version of Module:Contentious topics talk banner 2025-06-02T19:09:24Z <p>Create sandbox version of <a href="/wiki/Module:Contentious_topics_talk_banner" title="Module:Contentious topics talk banner">Module:Contentious topics talk banner</a></p> <p><b>New page</b></p><div>local p = {}<br /> local TableTools = require(&#039;Module:TableTools&#039;)<br /> local yesno = require(&#039;Module:Yesno&#039;)<br /> local setToList = require(&#039;Module:Set to list&#039;)<br /> local restrictionsDatabase = mw.loadJsonData(&quot;Template:Contentious topics/Additional restrictions.json&quot;)<br /> local restrictionsDefinition = mw.loadJsonData(&quot;Template:Contentious topics/Restrictions definition.json&quot;)<br /> local standardSet = mw.loadJsonData(&quot;Template:Contentious topics/Standard set.json&quot;)<br /> local categoryDatabase = mw.loadJsonData(&quot;Template:Contentious topics/Category database.json&quot;)<br /> <br /> local function collectTopics(args)<br /> local seen = {}<br /> local topics = {}<br /> <br /> local function add(value)<br /> if value then<br /> value = mw.text.trim(value)<br /> if value ~= &#039;&#039; and not seen[value] then<br /> seen[value] = true<br /> table.insert(topics, value)<br /> end<br /> end<br /> end<br /> <br /> -- Primary topic params<br /> add(args.topic)<br /> add(args.t)<br /> add(args[1])<br /> <br /> -- Additional topics via numbered forms<br /> for i = 2, 10 do<br /> add(args[i])<br /> add(args[&#039;t&#039; .. i])<br /> add(args[&#039;topic&#039; .. i])<br /> end<br /> <br /> return topics<br /> end<br /> <br /> function p.main(frame)<br /> local args = require(&#039;Module:Arguments&#039;).getArgs(frame)<br /> local topics = collectTopics(args)<br /> local restrictions = {} -- A list of which restrictions are enabled for easier iteration<br /> local restrictionFlags = {} -- Track which restrictions are enabled, as a set<br /> local currentTitleObject = mw.title.getCurrentTitle()<br /> local subjectTitleObject = currentTitleObject.subjectPageTitle<br /> local underRestrictions -- a boolean for whether there are any active restrictions<br /> local articleOrPage -- the string &quot;article&quot; (if a mainspace page) or &quot;page&quot; (if not)<br /> local protectionLevel -- the edit protection level<br /> local messageBody -- the text within the message box<br /> local messageBox -- the message box itself<br /> local categories = &#039;&#039; -- initialize categories<br /> local manualRestrictions = false -- have we set any restrictions via |parameters?<br /> local section = yesno(args.section) or yesno(args.relatedcontent) -- whether we are a section<br /> <br /> --[[<br /> This area sets active restrictions<br /> The end goal is to get the restrictions variable into a nice, neat, sorted list of which restrictions are active<br /> This is a somewhat intense process<br /> --]]<br /> <br /> -- Helpers to add a restriction if it&#039;s active and hasn&#039;t been added yet<br /> local function maybeAddRestriction(restriction)<br /> if yesno(args[restriction]) then<br /> restrictionFlags[restriction] = true<br /> manualRestrictions = true<br /> end<br /> end<br /> <br /> local function alwaysAddRestriction(restriction)<br /> restrictionFlags[restriction] = true<br /> end<br /> <br /> -- Add the always-available restrictions<br /> for _, r in ipairs(standardSet) do<br /> maybeAddRestriction(r)<br /> end<br /> <br /> -- Topic-based restrictions<br /> for _, topic in ipairs(topics) do<br /> local topicWide = restrictionsDatabase[&quot;topic-wide&quot;][topic]<br /> if topicWide then<br /> for _, restriction in ipairs(topicWide) do<br /> alwaysAddRestriction(restriction)<br /> end<br /> end<br /> <br /> local additional = restrictionsDatabase[&quot;additional-available&quot;][topic]<br /> if additional then<br /> for _, restriction in ipairs(additional) do<br /> maybeAddRestriction(restriction)<br /> end<br /> end<br /> end<br /> <br /> -- Add the protection level<br /> protectionLevel = subjectTitleObject.protectionLevels[&quot;edit&quot;][1]<br /> if protectionLevel then<br /> -- we have page protection<br /> -- so we check if ECR is active, and if so only care about full protection<br /> if restrictionFlags[&quot;ECR&quot;] then<br /> if protectionLevel == &quot;full&quot; then alwaysAddRestriction(&quot;full&quot;) end<br /> else<br /> alwaysAddRestriction(protectionLevel)<br /> end<br /> end<br /> <br /> --[[<br /> Clear duplicate restrictions (e.g. 0RR and 1RR; consensus-required is stronger than BRD)<br /> --]]<br /> <br /> -- if 0RR, then clear 1RR<br /> if restrictionFlags[&quot;0RR&quot;] then<br /> restrictionFlags[&quot;1RR&quot;] = nil<br /> end<br /> <br /> -- clear BRD if consensus-required is enabled<br /> if restrictionFlags[&quot;consensus-required&quot;] then<br /> restrictionFlags[&quot;BRD&quot;] = nil<br /> end<br /> <br /> -- and finally, convert our set to a list to make it easy to work with<br /> <br /> restrictions = setToList(restrictionFlags)<br /> <br /> --[[<br /> Restrictions are now all set. Here, we add additional helper functions and variables necessary for generating the banner<br /> --]]<br /> <br /> -- Check whether any of the added restrictions are enabled<br /> underRestrictions = #restrictions &gt; 0 or args.other<br /> <br /> -- Determines whether we should use the string &quot;article&quot; or &quot;page&quot;<br /> local articleOrPage = currentTitleObject:inNamespaces(1) and &quot;article&quot; or &quot;page&quot;<br /> <br /> -- helper to add a category<br /> local function addCategory(cat)<br /> if cat then<br /> categories = categories .. &#039;[[Category:&#039; .. cat .. &#039;|&#039; .. currentTitleObject.text .. &#039;]]&#039;<br /> end<br /> end<br /> <br /> -- Makes a bullet point for a given contentious topic<br /> local function makeTopicBulletPoint(code)<br /> topicBlurb = frame:expandTemplate{ title = &quot;Contentious topics/list&quot;, args = { scope=code } }<br /> if topicBlurb == &#039;&#039; then<br /> addCategory(categoryDatabase[&#039;bad-topic&#039;])<br /> return &#039;&#039;<br /> else <br /> return &#039;* &lt;b&gt;&#039; .. topicBlurb .. &#039;&lt;/b&gt;\n&#039;<br /> end<br /> end<br /> <br /> -- Makes a restriction bullet point<br /> local function makeRestrictionBulletPoint(code)<br /> local def = restrictionsDefinition[code]<br /> return def and (&#039;* &lt;b&gt;&#039; .. def .. &#039;&lt;/b&gt;\n&#039;) or &#039;&#039;<br /> end<br /> <br /> --[[<br /> Place into an error category if not given a contentious topic code<br /> --]]<br /> if #topics == 0 then<br /> addCategory(categoryDatabase[&#039;no-topic&#039;])<br /> end<br /> <br /> --[[<br /> Begin building the messageBody<br /> --]]<br /> <br /> messageBody = &#039;&lt;b&gt;The [[Wikipedia:Contentious topics|contentious topics]] procedure applies to this &#039;<br /> .. articleOrPage .. &#039;.&lt;/b&gt;&#039;<br /> .. (section and (&#039; Parts of this &#039; .. articleOrPage .. &#039; relate &#039;) or (&#039; This &#039; .. articleOrPage .. &#039; relates &#039;))<br /> <br /> if #topics &gt; 1 then<br /> messageBody = messageBody .. &#039;to the following contentious topics:\n&#039;<br /> for _, topic in ipairs(topics) do<br /> messageBody = messageBody .. makeTopicBulletPoint(topic)<br /> end<br /> else<br /> local topicBlurb = frame:expandTemplate{ <br /> title = &quot;Contentious topics/list&quot;,<br /> args = { scope=topics[1] } }<br /> if topicBlurb ~= &#039;&#039; then<br /> messageBody = messageBody .. &#039;to &lt;b&gt;&#039;<br /> .. topicBlurb<br /> .. &#039;&lt;/b&gt;, a contentious topic.&lt;/p&gt;&#039;<br /> else<br /> addCategory(categoryDatabase[&#039;bad-topic&#039;])<br /> end<br /> end<br /> <br /> if underRestrictions then<br /> messageBody = &#039;&lt;p style=&quot;margin-top:0&quot;&gt;&lt;strong style=&quot;text-transform: uppercase;&quot;&gt;Warning: active arbitration remedies&lt;/strong&gt;&lt;/p&gt;&#039;<br /> .. messageBody<br /> .. &#039;&lt;p style=&quot;text-decoration:underline; text-align:center; font-size:120%;&quot;&gt;The following restrictions apply to everyone editing this &#039; .. articleOrPage .. &#039;:&lt;/p&gt;\n&#039;<br /> for _, restriction in ipairs(restrictions) do<br /> messageBody = messageBody .. makeRestrictionBulletPoint(restriction)<br /> addCategory(categoryDatabase[restriction])<br /> end<br /> if args.other then<br /> messageBody = messageBody .. &#039;* &lt;b&gt;&#039; .. args.other .. &#039;&lt;/b&gt;\n&#039;<br /> addCategory(categoryDatabase[&quot;other&quot;])<br /> end<br /> end<br /> <br /> messageBody = messageBody .. &#039; Editors are advised to familiarise themselves with the [[Wikipedia:Contentious topics|contentious topics procedures]] before editing this page.&#039;<br /> <br /> if not yesno(args.brief) then<br /> messageBody = messageBody .. &#039; Editors who repeatedly or seriously fail to adhere to the [[WP:Five pillars|purpose of Wikipedia]], any expected [[WP:Etiquette|standards of behaviour]], &#039;<br /> .. &#039;or any [[WP:List of policies|normal editorial process]] may be blocked or restricted by an administrator.&#039;<br /> end<br /> <br /> if section then<br /> messageBody = messageBody .. &#039;&lt;p&gt;If it is unclear which parts of the page are related to this contentious topic, the content in question should be marked within the wiki text by an invisible comment.&#039;<br /> .. &#039;If no comment is present, please ask an administrator for assistance. If in doubt it is better to assume that the content is covered.&lt;/p&gt;&#039;<br /> end<br /> <br /> if underRestrictions then<br /> if args[&#039;placed-date&#039;] then<br /> messageBody = messageBody .. &#039;&lt;p&gt;Restrictions placed: &#039; .. require(&#039;Module:Date&#039;)._Date(args[&#039;placed-date&#039;]):text() .. &#039;&lt;/p&gt;&#039;<br /> elseif manualRestrictions then<br /> addCategory(categoryDatabase[&#039;no-date&#039;])<br /> end<br /> end<br /> <br /> <br /> --[[<br /> Now build some further information collapse boxes<br /> We get the content of each collapse box from Wikipedia:Contentious topics/[Topic]/Further information<br /> --]]<br /> <br /> -- Now build the messageBox<br /> <br /> messageBox = require(&#039;Module:Message box&#039;).main(&quot;tmbox&quot;, {<br /> [&quot;type&quot;] = underRestrictions and &quot;delete&quot; or &quot;content&quot;,<br /> [&quot;small&quot;] = yesno(args.small),<br /> [&quot;image&quot;] = &quot;[[File:Commons-emblem-&quot;<br /> .. (underRestrictions and &quot;hand&quot; or &quot;issue&quot;)<br /> .. &quot;.svg|&quot;<br /> .. (yesno(args.small) and &quot;30&quot; or &quot;40&quot;)<br /> .. &quot;px]]&quot;,<br /> [&quot;text&quot;] = messageBody<br /> })<br /> <br /> -- If ECR is enabled, prepend the ECR warning<br /> if restrictionFlags[&quot;ECR&quot;] then<br /> messageBox = frame:expandTemplate{ <br /> title = &quot;Template:Contentious topics/talk notice/ECR warning&quot;, <br /> args = { section = section and &quot;yes&quot; or &quot;&quot;, small = args.small}} <br /> .. messageBox<br /> <br /> -- Hard code for [[WP:BER]]<br /> if TableTools.inArray(topics, &quot;a-i&quot;) then<br /> addCategory(&quot;Wikipedia pages subject to the extended confirmed restriction related to the Arab-Israeli conflict&quot;)<br /> end<br /> end<br /> <br /> --[[<br /> Categories!!!<br /> We set the restriction categories back in the if underRestrictions loop<br /> to avoid looping through the restrictions twice. So we only need to do some cleanup and handle nocat<br /> <br /> Because nocat is only for the ultra-rare case of demonstration,<br /> manually clearing the categories is more efficient<br /> --]]<br /> <br /> if yesno(args.nocat) then<br /> categories = &#039;&#039;<br /> else<br /> addCategory(categoryDatabase[&quot;all&quot;])<br /> end<br /> <br /> return messageBox .. categories<br /> end<br /> <br /> return p</div> HouseBlaster