Module:Official website: Difference between revisions

Content deleted Content added
get Wikidata code working
output an error message if no URL was found
Line 2:
 
local p = {}
 
local function makeCategory(s)
return string.format('[[Category:%s]]', s)
end
 
local fetchWikidataUrl
Line 47 ⟶ 51:
category = 'Official website not in Wikidata'
end
return category and string.formatmakeCategory('[[Category:%s]]', category) or ''
end
 
function p._main(args)
local url = args[1] or args.___URL or fetchWikidataUrl()
if not url then
return '<strong class="error">' ..
'No URL found. Please specify a URL here or add one to Wikidata.' ..
'</strong>' ..
makeCategory('Official website missing URL')
end
local formattedUrl = formatUrl{
url = url,