Module:Molarus
Documentation for this module may be created at Module:Molarus/doc
local p = {}
local function tableToString(t)
local key
local value
local result
result = ''
for key, value in pairs(t) do
if (tonumber(key) ~= nil) then
result = result .. ':table[' .. key .. '] is ' .. value .. '\n'
else
result = result .. ':table[\'' .. key .. '\'] is ' .. value .. '\n'
end
end
return result
end
function p.args(frame)
local a
if string.match(frame:getParent():getTitle(), '%a+') == mw.site.namespaces.Template.name then a = frame:getParent().args else a = frame.args end
return frame:getParent():getTitle() .. ';args\n' .. tableToString(a)
end
function p.callParserFunction(frame)
return ';callParserFunction\n:' .. frame:callParserFunction('#time', 'Y-m-d H:i:s') .. '\n'
end
function p.expandTemplate(frame)
return ';expandTemplate\n:' .. frame:expandTemplate({title = 'Template:Sandbox', args = {'arg1', 'arg2'}}) .. '\n'
end
function p.extensionTag(frame)
return ';extensionTag\n:' .. frame:extensionTag('nowiki', '[[text]]', {}) .. '\n'
end
function p.getParent(frame)
frame = frame:getParent()
return ';getParent\n:' .. frame:getTitle() .. '\n'
end
function p.getTitle(frame)
return ';getTitle\n:' .. frame:getTitle() .. '\n'
end
return p