Module:Su: Difference between revisions
Jump to navigation
Jump to search
Richardpruen (talk | contribs) m 1 revision imported |
adding entry point for using direct invoke of module. A separate entry point means all other functioning of the module is unaffected |
||
Line 8: | Line 8: | ||
-- uses named arguments, and whitespace is trimmed from them automatically. | -- uses named arguments, and whitespace is trimmed from them automatically. | ||
local origArgs = frame:getParent().args | local origArgs = frame:getParent().args | ||
local args = {} | |||
for k, v in pairs(origArgs) do | |||
if v ~= '' then | |||
args[k] = v | |||
end | |||
end | |||
-- Define the variables to pass to luaMain. | |||
local sup = args.p | |||
local sub = args.b | |||
local options = { | |||
align = args.a, | |||
fontSize = args.w, | |||
lineHeight = args.lh, | |||
verticalAlign = args.va | |||
} | |||
return p._main(sup, sub, options) | |||
end | |||
function p.invoke_main(frame) | |||
-- entry point for invocation using frame arguments | |||
local origArgs = frame.args | |||
local args = {} | local args = {} | ||
for k, v in pairs(origArgs) do | for k, v in pairs(origArgs) do |