FANDOM


p = {}
 
function p.subst (frame)
    local args = frame.args or frame --for testing purposes
    local name = args['1'] or args[1] or ''
    if name == '' then
        return ''
    end
    local title = mw.title.new(name)
    local content = ''
    if type(title) ~= 'nil' then
        content = title:getContent()
    else
        content = frame:expandTemplate{ title=':' .. name }
    end
    if frame.preprocess then
        return frame:preprocess(content)
    else
        return content
    end
end
 
return p