https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3ASandbox%2FHawkeye7Module:Sandbox/Hawkeye7 - Revision history2025-06-02T14:50:45ZRevision history for this page on the wikiMediaWiki 1.45.0-wmf.3https://en.wikipedia.org/w/index.php?title=Module:Sandbox/Hawkeye7&diff=890830731&oldid=prevAnthony 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&action=edit&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&type=revision&diff=861798418&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 Appleyardhttps://en.wikipedia.org/w/index.php?title=Module:Sandbox/Hawkeye7&diff=886878904&oldid=prevPppery: Pppery moved page Module:User/Hawkeye7 to Module:User:Hawkeye7 without leaving a redirect: Make this not a subpage of an entirely unrelated page2019-03-09T03:33:07Z<p>Pppery moved page <a href="/w/index.php?title=Module:User/Hawkeye7&action=edit&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&action=edit&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>Ppperyhttps://en.wikipedia.org/w/index.php?title=Module:Sandbox/Hawkeye7&diff=886832954&oldid=prevHawkeye7: xxxx2019-03-08T20:48:49Z<p>xxxx</p>
<p><b>New page</b></p><div>local getPortalImage = require('Module:Portal').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 'data', and 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}.<br />
local nums = {}<br />
for k, v in pairs(args) do<br />
local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$')<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('tr')<br />
row<br />
:tag('td')<br />
:attr('colspan', '2')<br />
:tag('hr', {selfClosing = true})<br />
return tostring(row)<br />
end<br />
<br />
local function makeItem(image, text)<br />
local root = mw.html.create('li')<br />
root<br />
:css('float', 'left')<br />
:css('margin-left', '0.3em')<br />
:css('height', '3.6em')<br />
:tag('span')<br />
:css('display', 'inline-block')<br />
:css('margin-right', '0.3em')<br />
:css('width', '30px')<br />
:css('line-height', '3.6em')<br />
:css('text-align', 'center')<br />
:wikitext(image)<br />
:done()<br />
:tag('span')<br />
:css('display', 'inline-block')<br />
:css('width', '11em')<br />
:css('vertical-align', 'middle')<br />
:wikitext(text)<br />
return tostring(root)<br />
end<br />
<br />
local function makeRow(items, heading, subheading, options)<br />
if #items < 1 then return end<br />
local swapHeadingSize = type(options) == 'table' and options.swapHeadingSize or false<br />
local row = mw.html.create('tr')<br />
row<br />
:tag('td')<br />
:css('width', '175px')<br />
:tag('span')<br />
:css('font-size', swapHeadingSize and '90%' or '125%')<br />
:wikitext(heading)<br />
:done()<br />
:tag('br', {selfClosing = true})<br />
:done()<br />
:tag('span')<br />
:css('font-size', swapHeadingSize and '125%' or '90%')<br />
:wikitext(subheading)<br />
local list = row:tag('td'):css('text-align', 'left'):tag('ul')<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 .. '1'] = 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 = "'''[[Wikipedia:Books|Books]]'''"<br />
local bookSubheading = 'View or order collections of articles'<br />
local function getBookItemVals(book)<br />
local image = '[[File:Office-book.svg|30px|alt=|link=]]'<br />
local text = mw.ustring.format("'''''[[Book:%s|%s]]'''''", book, book)<br />
return image, text<br />
end<br />
local bookRow = makeNumberedRow('book', args, bookHeading, bookSubheading, getBookItemVals)<br />
table.insert(rows, bookRow)<br />
<br />
-- Get the portal row text<br />
local portalHeading = "'''[[Portal:Contents/Portals|Portals]]'''"<br />
local portalSubheading = 'Access related topics'<br />
local function getPortalItemVals(portal)<br />
local image = mw.ustring.format('[[File:%s|30x30px]]', getPortalImage{portal})<br />
local text = mw.ustring.format("'''''[[Portal:%s|%s portal]]'''''", portal, portal)<br />
return image, text<br />
end<br />
local portalRow = makeNumberedRow('portal', args, portalHeading, portalSubheading, getPortalItemVals)<br />
table.insert(rows, portalRow)<br />
<br />
-- Get the sister projects row text.<br />
local sisters = {<br />
{arg = 'commons', image = 'Commons-logo.svg', prefix = 'commons', display = 'Media', from = 'Commons'},<br />
{arg = 'species', image = 'Wikispecies-logo.svg', prefix = 'wikispecies', display = 'Species directories', from = 'Wikispecies'},<br />
{arg = 'voy', image = 'Wikivoyage-Logo-v3-icon.svg', prefix = 'voy', display = 'Travel guides', from = 'Wikivoyage'},<br />
{arg = 'n', image = 'Wikinews-logo.svg', prefix = 'wikinews', display = 'News stories', from = 'Wikinews'},<br />
{arg = 'wikt', image = 'Wiktionary-logo-v2.svg', prefix = 'wiktionary', postfix = 'English', display = 'Definitions', from = 'Wiktionary'},<br />
{arg = 'b', image = 'Wikibooks-logo.svg', prefix = 'wikibooks', display = 'Textbooks', from = 'Wikibooks'},<br />
{arg = 'q', image = 'Wikiquote-logo.svg', prefix = 'wikiquote', display = 'Quotations', from = 'Wikiquote'},<br />
{arg = 's', image = 'Wikisource-logo.svg', prefix = 'wikisource', display = 'Source texts', from = 'Wikisource'},<br />
{arg = 'v', image = 'Wikiversity-logo.svg', prefix = 'wikiversity', display = 'Learning resources', from = 'Wikiversity'},<br />
{arg = 'd', image = 'Wikidata-logo.svg', prefix = 'wikidata', display = 'Data', from = 'Wikidata'},<br />
{arg = 'spoken', image = 'Sound-icon.svg', prefix = 'spoken wikipedia', display = 'Listen to this page', from = 'Spoken Wikipedia'},<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('[[File:%s|30x30px|alt=|link=]]', t.image)<br />
-- Get the text value.<br />
local prefix = t.prefix<br />
local search = args[t.arg .. '-search'] or mw.title.getCurrentTitle().text<br />
local postfix = t.postfix<br />
postfix = postfix and ('#' .. postfix) or ''<br />
local display = t.display<br />
local from = t.from<br />
local text = mw.ustring.format(<br />
'[[%s:Special:Search/%s%s|%s]]<br />from %s',<br />
prefix, search, postfix, display, from<br />
)<br />
if t.arg == 'spoken' then<br />
text = mw.ustring.format('%s on %s<br />[[File:%s]]',<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 = "Find out more on Wikipedia's"<br />
local sisterSubheading = "'''[[Wikipedia:Wikimedia sister projects|Sister projects]]'''"<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('table')<br />
root<br />
:attr('role', 'presentation')<br />
:addClass('noprint')<br />
:addClass('metadata')<br />
:addClass('plainlist')<br />
:css('background-color', '#f9f9f9')<br />
:css('border', '1px solid #aaa')<br />
:css('clear', 'both')<br />
:css('margin-bottom', '0.5em')<br />
:css('margin-top', '0.5em')<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 ~= '' then<br />
args[k] = v<br />
end<br />
end<br />
return p._main(args)<br />
end<br />
<br />
return p</div>Hawkeye7