Module:URL

From Illogicopedia
Jump to navigation Jump to search
local p = {}
local format = mw.ustring.format
local title = mw.title.getCurrentTitle()
local function err(msg)
if title.contentModel == "Scribunto" then
return error(string.format('%s', msg), 2)
else
return string.format('<strong class="error">Error: %s</strong>', msg)
end
end
function p.url(frame)
args = frame.args
display = args[2] or args.display
url = args[1] or args.url
if display then
return format("[%s %s]", url, display)
elseif url == "" then
return err('no url found')
elseif not url then
return err('no url found')
else
return format("[%s %s]", url, url)
end
end
return p