https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3ASandbox%2FHawkeye7 Module:Sandbox/Hawkeye7 - Revision history 2025-06-02T14:50:45Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.3 https://en.wikipedia.org/w/index.php?title=Module:Sandbox/Hawkeye7&diff=890830731&oldid=prev Anthony Appleyard: Anthony Appleyard moved page Module:User:Hawkeye7 to Module:Sandbox/Hawkeye7 without leaving a redirect: Requested by Hawkeye7 at WP:RM/TR: No good reason. To conform with naming convention on Module:Sandbox. An admin moved my previous module sandbox [https://en.wikipedia.org/w/index.php?title=Module%3ASandbox%2FHawkeye7&type=revision&diff=861798418&oldid=671376817] for this reason without resetting where it was used. So another editor re-create... 2019-04-03T20:33:10Z <p>Anthony Appleyard moved page <a href="/w/index.php?title=Module:User:Hawkeye7&amp;action=edit&amp;redlink=1" class="new" title="Module:User:Hawkeye7 (page does not exist)">Module:User:Hawkeye7</a> to <a href="/wiki/Module:Sandbox/Hawkeye7" title="Module:Sandbox/Hawkeye7">Module:Sandbox/Hawkeye7</a> without leaving a redirect: <a href="/wiki/Special:PermanentLink/890828422" title="Special:PermanentLink/890828422">Requested</a> by Hawkeye7 at <a href="/wiki/Wikipedia:RM/TR" class="mw-redirect" title="Wikipedia:RM/TR">WP:RM/TR</a>: No good reason. To conform with naming convention on <a href="/wiki/Module:Sandbox" title="Module:Sandbox">Module:Sandbox</a>. An admin moved my previous module sandbox [https://en.wikipedia.org/w/index.php?title=Module%3ASandbox%2FHawkeye7&amp;type=revision&amp;diff=861798418&amp;oldid=671376817] for this reason without resetting where it was used. So another editor re-create...</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 20:33, 3 April 2019</td> </tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div> </td></tr></table> Anthony Appleyard https://en.wikipedia.org/w/index.php?title=Module:Sandbox/Hawkeye7&diff=886878904&oldid=prev Pppery: Pppery moved page Module:User/Hawkeye7 to Module:User:Hawkeye7 without leaving a redirect: Make this not a subpage of an entirely unrelated page 2019-03-09T03:33:07Z <p>Pppery moved page <a href="/w/index.php?title=Module:User/Hawkeye7&amp;action=edit&amp;redlink=1" class="new" title="Module:User/Hawkeye7 (page does not exist)">Module:User/Hawkeye7</a> to <a href="/w/index.php?title=Module:User:Hawkeye7&amp;action=edit&amp;redlink=1" class="new" title="Module:User:Hawkeye7 (page does not exist)">Module:User:Hawkeye7</a> without leaving a redirect: Make this not a subpage of an entirely unrelated page</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 03:33, 9 March 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:Sandbox/Hawkeye7&diff=886832954&oldid=prev Hawkeye7: xxxx 2019-03-08T20:48:49Z <p>xxxx</p> <p><b>New page</b></p><div>local getPortalImage = require(&#039;Module:Portal&#039;).image<br /> <br /> local p = {}<br /> <br /> local function getArgNums(prefix, args)<br /> -- Returns a table containing the numbers of the arguments that exist for the specified prefix. For example, if the<br /> -- prefix was &#039;data&#039;, and &#039;data1&#039;, &#039;data2&#039;, and &#039;data5&#039; exist, it would return {1, 2, 5}.<br /> local nums = {}<br /> for k, v in pairs(args) do<br /> local num = tostring(k):match(&#039;^&#039; .. prefix .. &#039;([1-9]%d*)$&#039;)<br /> if num then table.insert(nums, tonumber(num)) end<br /> end<br /> table.sort(nums)<br /> return nums<br /> end<br /> <br /> local function makeHorizontalRule()<br /> local row = mw.html.create(&#039;tr&#039;)<br /> row<br /> :tag(&#039;td&#039;)<br /> :attr(&#039;colspan&#039;, &#039;2&#039;)<br /> :tag(&#039;hr&#039;, {selfClosing = true})<br /> return tostring(row)<br /> end<br /> <br /> local function makeItem(image, text)<br /> local root = mw.html.create(&#039;li&#039;)<br /> root<br /> :css(&#039;float&#039;, &#039;left&#039;)<br /> :css(&#039;margin-left&#039;, &#039;0.3em&#039;)<br /> :css(&#039;height&#039;, &#039;3.6em&#039;)<br /> :tag(&#039;span&#039;)<br /> :css(&#039;display&#039;, &#039;inline-block&#039;)<br /> :css(&#039;margin-right&#039;, &#039;0.3em&#039;)<br /> :css(&#039;width&#039;, &#039;30px&#039;)<br /> :css(&#039;line-height&#039;, &#039;3.6em&#039;)<br /> :css(&#039;text-align&#039;, &#039;center&#039;)<br /> :wikitext(image)<br /> :done()<br /> :tag(&#039;span&#039;)<br /> :css(&#039;display&#039;, &#039;inline-block&#039;)<br /> :css(&#039;width&#039;, &#039;11em&#039;)<br /> :css(&#039;vertical-align&#039;, &#039;middle&#039;)<br /> :wikitext(text)<br /> return tostring(root)<br /> end<br /> <br /> local function makeRow(items, heading, subheading, options)<br /> if #items &lt; 1 then return end<br /> local swapHeadingSize = type(options) == &#039;table&#039; and options.swapHeadingSize or false<br /> local row = mw.html.create(&#039;tr&#039;)<br /> row<br /> :tag(&#039;td&#039;)<br /> :css(&#039;width&#039;, &#039;175px&#039;)<br /> :tag(&#039;span&#039;)<br /> :css(&#039;font-size&#039;, swapHeadingSize and &#039;90%&#039; or &#039;125%&#039;)<br /> :wikitext(heading)<br /> :done()<br /> :tag(&#039;br&#039;, {selfClosing = true})<br /> :done()<br /> :tag(&#039;span&#039;)<br /> :css(&#039;font-size&#039;, swapHeadingSize and &#039;125%&#039; or &#039;90%&#039;)<br /> :wikitext(subheading)<br /> local list = row:tag(&#039;td&#039;):css(&#039;text-align&#039;, &#039;left&#039;):tag(&#039;ul&#039;)<br /> for i, item in ipairs(items) do<br /> local image = item[1]<br /> local text = item[2]<br /> list<br /> :wikitext(makeItem(image, text))<br /> end<br /> return tostring(row)<br /> end<br /> <br /> local function makeNumberedRow(prefix, args, heading, subheading, getItemValsFunc, options)<br /> if args[prefix] then<br /> args[prefix .. &#039;1&#039;] = args[prefix]<br /> end<br /> local argNums = getArgNums(prefix, args)<br /> local items = {}<br /> for i, argNum in ipairs(argNums) do<br /> local image, text = getItemValsFunc(args[prefix .. tostring(argNum)])<br /> table.insert(items, {image, text})<br /> end<br /> return makeRow(items, heading, subheading, options)<br /> end<br /> <br /> function p._main(args)<br /> local rows = {}<br /> <br /> -- Get the book row text.<br /> local bookHeading = &quot;&#039;&#039;&#039;[[Wikipedia:Books|Books]]&#039;&#039;&#039;&quot;<br /> local bookSubheading = &#039;View or order collections of articles&#039;<br /> local function getBookItemVals(book)<br /> local image = &#039;[[File:Office-book.svg|30px|alt=|link=]]&#039;<br /> local text = mw.ustring.format(&quot;&#039;&#039;&#039;&#039;&#039;[[Book:%s|%s]]&#039;&#039;&#039;&#039;&#039;&quot;, book, book)<br /> return image, text<br /> end<br /> local bookRow = makeNumberedRow(&#039;book&#039;, args, bookHeading, bookSubheading, getBookItemVals)<br /> table.insert(rows, bookRow)<br /> <br /> -- Get the portal row text<br /> local portalHeading = &quot;&#039;&#039;&#039;[[Portal:Contents/Portals|Portals]]&#039;&#039;&#039;&quot;<br /> local portalSubheading = &#039;Access related topics&#039;<br /> local function getPortalItemVals(portal)<br /> local image = mw.ustring.format(&#039;[[File:%s|30x30px]]&#039;, getPortalImage{portal})<br /> local text = mw.ustring.format(&quot;&#039;&#039;&#039;&#039;&#039;[[Portal:%s|%s portal]]&#039;&#039;&#039;&#039;&#039;&quot;, portal, portal)<br /> return image, text<br /> end<br /> local portalRow = makeNumberedRow(&#039;portal&#039;, args, portalHeading, portalSubheading, getPortalItemVals)<br /> table.insert(rows, portalRow)<br /> <br /> -- Get the sister projects row text.<br /> local sisters = {<br /> {arg = &#039;commons&#039;, image = &#039;Commons-logo.svg&#039;, prefix = &#039;commons&#039;, display = &#039;Media&#039;, from = &#039;Commons&#039;},<br /> {arg = &#039;species&#039;, image = &#039;Wikispecies-logo.svg&#039;, prefix = &#039;wikispecies&#039;, display = &#039;Species directories&#039;, from = &#039;Wikispecies&#039;},<br /> {arg = &#039;voy&#039;, image = &#039;Wikivoyage-Logo-v3-icon.svg&#039;, prefix = &#039;voy&#039;, display = &#039;Travel guides&#039;, from = &#039;Wikivoyage&#039;},<br /> {arg = &#039;n&#039;, image = &#039;Wikinews-logo.svg&#039;, prefix = &#039;wikinews&#039;, display = &#039;News stories&#039;, from = &#039;Wikinews&#039;},<br /> {arg = &#039;wikt&#039;, image = &#039;Wiktionary-logo-v2.svg&#039;, prefix = &#039;wiktionary&#039;, postfix = &#039;English&#039;, display = &#039;Definitions&#039;, from = &#039;Wiktionary&#039;},<br /> {arg = &#039;b&#039;, image = &#039;Wikibooks-logo.svg&#039;, prefix = &#039;wikibooks&#039;, display = &#039;Textbooks&#039;, from = &#039;Wikibooks&#039;},<br /> {arg = &#039;q&#039;, image = &#039;Wikiquote-logo.svg&#039;, prefix = &#039;wikiquote&#039;, display = &#039;Quotations&#039;, from = &#039;Wikiquote&#039;},<br /> {arg = &#039;s&#039;, image = &#039;Wikisource-logo.svg&#039;, prefix = &#039;wikisource&#039;, display = &#039;Source texts&#039;, from = &#039;Wikisource&#039;},<br /> {arg = &#039;v&#039;, image = &#039;Wikiversity-logo.svg&#039;, prefix = &#039;wikiversity&#039;, display = &#039;Learning resources&#039;, from = &#039;Wikiversity&#039;},<br /> {arg = &#039;d&#039;, image = &#039;Wikidata-logo.svg&#039;, prefix = &#039;wikidata&#039;, display = &#039;Data&#039;, from = &#039;Wikidata&#039;},<br /> {arg = &#039;spoken&#039;, image = &#039;Sound-icon.svg&#039;, prefix = &#039;spoken wikipedia&#039;, display = &#039;Listen to this page&#039;, from = &#039;Spoken Wikipedia&#039;},<br /> }<br /> local sisterItems = {}<br /> for i, t in ipairs(sisters) do<br /> if args[t.arg] then<br /> -- Get the image value.<br /> local image = mw.ustring.format(&#039;[[File:%s|30x30px|alt=|link=]]&#039;, t.image)<br /> -- Get the text value.<br /> local prefix = t.prefix<br /> local search = args[t.arg .. &#039;-search&#039;] or mw.title.getCurrentTitle().text<br /> local postfix = t.postfix<br /> postfix = postfix and (&#039;#&#039; .. postfix) or &#039;&#039;<br /> local display = t.display<br /> local from = t.from<br /> local text = mw.ustring.format(<br /> &#039;[[%s:Special:Search/%s%s|%s]]&lt;br /&gt;from %s&#039;,<br /> prefix, search, postfix, display, from<br /> )<br /> if t.arg == &#039;spoken&#039; then<br /> text = mw.ustring.format(&#039;%s on %s&lt;br /&gt;[[File:%s]]&#039;,<br /> display, from, args[t.arg] <br /> ) <br /> end<br /> -- Add the values to the items table.<br /> table.insert(sisterItems, {image, text})<br /> end<br /> end<br /> local sisterHeading = &quot;Find out more on Wikipedia&#039;s&quot;<br /> local sisterSubheading = &quot;&#039;&#039;&#039;[[Wikipedia:Wikimedia sister projects|Sister projects]]&#039;&#039;&#039;&quot;<br /> local sisterRow = makeRow(sisterItems, sisterHeading, sisterSubheading, {swapHeadingSize = true})<br /> table.insert(rows, sisterRow)<br /> <br /> -- Make the table.<br /> local root = mw.html.create(&#039;table&#039;)<br /> root<br /> :attr(&#039;role&#039;, &#039;presentation&#039;)<br /> :addClass(&#039;noprint&#039;)<br /> :addClass(&#039;metadata&#039;)<br /> :addClass(&#039;plainlist&#039;)<br /> :css(&#039;background-color&#039;, &#039;#f9f9f9&#039;)<br /> :css(&#039;border&#039;, &#039;1px solid #aaa&#039;)<br /> :css(&#039;clear&#039;, &#039;both&#039;)<br /> :css(&#039;margin-bottom&#039;, &#039;0.5em&#039;)<br /> :css(&#039;margin-top&#039;, &#039;0.5em&#039;)<br /> :wikitext(table.concat(rows, makeHorizontalRule()))<br /> <br /> return tostring(root)<br /> end<br /> <br /> function p.main(frame)<br /> -- If called via #invoke, use the args passed into the invoking template, or the args passed to #invoke if any exist. Otherwise<br /> -- assume args are being passed directly in from the debug console or from another Lua module.<br /> local origArgs<br /> if frame == mw.getCurrentFrame() then<br /> origArgs = frame:getParent().args<br /> for k, v in pairs(frame.args) do<br /> origArgs = frame.args<br /> break<br /> end<br /> else<br /> origArgs = frame<br /> end<br /> -- Remove blank arguments.<br /> local args = {}<br /> for k, v in pairs(origArgs) do<br /> if v ~= &#039;&#039; then<br /> args[k] = v<br /> end<br /> end<br /> return p._main(args)<br /> end<br /> <br /> return p</div> Hawkeye7