Jump to content
Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:FBI QR code: Difference between revisions

From Hacks Guide Wiki
No edit summary
hope I did this right
Line 35: Line 35:
end
end


function p.makeSections()
function p.makeSections(frame)
local sections = {}
local sections = {}
local nums = union(getArgNums('name'), getArgNums('url'))
local nums = union(getArgNums('name'), getArgNums('url'))
Line 43: Line 43:
local url = args['name' .. tostring(num)]
local url = args['name' .. tostring(num)]
if name and url then
if name and url then
table.insert(sections)
local qr = frame:callParserFunction('#qrlite', {url, format = 'svg', margin = '3'})
table.insert(sections, {name, qr..frame:preprocess('<br>['..url..' '..url..']')})
end
end
end
end
end
function p.makeTabber(sections)
local tabber = mw.html.create('tabber')
for k, v in ipairs(sections) do
tabber:wikitext('|-|'..v[1]..'=\n\n', v[2])
end
return tabber
end
end


function p.main(frame)
function p.main(frame)
local parent = frame:getParent()
-- adapted from [[Module:Infobox]]
-- adapted from [[Module:Infobox]]
if frame == mw.getCurrentFrame() then
if frame == mw.getCurrentFrame() then
Line 56: Line 69:
end
end


local sections = p.makeSections()
local sections = p.makeSections(parent)
end
return p.makeTabber(sections)
 
function p.test(frame)
return frame:callParserFunction('#qrlite', frame.args['1'])
end
end


return p
return p