Module:EditAtWikidata
Appearance
Documentation for this module may be created at Module:EditAtWikidata/doc
function p._showMessage(args)
local local_parm = trimToNil(args[1])
if local_parm then return "" end
local qid
if mw and mw.wikibase and mw.wikibase.getEntityIdForCurrentPage then
qid = trimToNil(args.qid) or mw.wikibase.getEntityIdForCurrentPage()
else
qid = trimToNil(args.qid)
end
if not qid then
-- Show a message when no Wikidata entity exists, or return empty string to show nothing
return "[No Wikidata entity found for this page]"
end
if qid and mw and mw.wikibase and mw.wikibase.entityExists and mw.wikibase.entityExists(qid) then
local anchor = trimToNil(args.pid)
local space = trimToNil(args.nbsp) and " " or " "
return
space ..
"[[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px" ..
"|alt=" .. i18n.message ..
"|link=https://www.wikidata.org/wiki/" .. qid ..
(anchor and ("#" .. anchor) or "") ..
"|class=noprint" ..
"|" .. i18n.message ..
"]]"
end
return ""
end