Content deleted Content added
m Changed protection level for "Module:EditAtWikidata": Highly visible template: 1MM+ usage ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite)) |
update from Module:EditAtWikidata/sandbox per talk: tweaks + greatly reduce memory usage + class=noprint |
||
(One intermediate revision by one other user not shown) | |||
Line 1:
-- Module to display an icon with a tooltip such as "Edit this at Wikidata".
-- Icon
-- This message is only displayed if a local_parameter is not supplied
-- i.e. when called from a template, it can be coded not to display the message.
-- The qid of a Wikidata entry can optionally be supplied for testing outside the article.
-- Usage:
Line 16 ⟶ 15:
}
-- Return trimmed non-empty text, or nil.
if type(text) == 'string' then
return text:match('(%S.-)%s*$')
end
end
function p._showMessage(args)
if local_parm then return "" end
--
-- This
local qid =
if qid and mw.wikibase.entityExists(qid
-- Parameter pid=x uses x as an anchor in the link to the Wikidata entry.
local anchor = trimToNil(args.pid)
-- Parameter nbsp replaces the leading space with
return
"
i18n.message ..▼
"
"|link=https://www.wikidata.org/wiki/" .. qid ..
▲ thisQid ..
(
"|class=noprint" ..
▲ "|" .. i18n.message ..
"]]"
end
return ""
end
function p.showMessage(frame)
return p._showMessage(frame.args)
end
|