From WikiChip
Difference between revisions of "Module:ic family"
(Created page with "local p = {} local origArgs function p.add_file_prefix(str) if string.match(string.lower(str), '^file:') then return str else return 'File:' .. str end end fun...") |
(No difference)
|
Latest revision as of 09:27, 15 July 2017
Documentation for this module may be created at Module:ic family/doc
local p = {}
local origArgs
function p.add_file_prefix(str)
if string.match(string.lower(str), '^file:') then
return str
else
return 'File:' .. str
end
end
function p.add_separator(box, title)
box:tag('tr')
:tag('td')
:attr('class', 'header')
:attr('colspan', '2')
:wikitext(title)
end
function p.add_entry(value, right)
local e = mw.html.create('tr')
e:tag('td')
:attr('class', 'label')
:wikitext(value)
e:node(right)
return e
end
function has_arg(name)
-- The argument can exist and be empty or not exist at all
return string.len(origArgs[name] or '') > 0
end
function arg(name)
return origArgs[name]
end
function p.chip(frame)
if frame == mw.getCurrentFrame() then
origArgs = frame:getParent().args
else
origArgs = frame.args
end
local infobox = mw.html.create('table')
infobox
:attr('class', 'infobox')
return infobox
end
return p