Content deleted Content added
No edit summary |
fix omitted word |
||
(3 intermediate revisions by the same 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
function p._showMessage(args)
if local_parm then return "" end
--
-- This
local qid =
if qid and mw.wikibase.entityExists(qid) then
-- Parameter pid=x uses x as an anchor in the link to the Wikidata entry.
local anchor = trimToNil(args.pid)
local space = trimToNil(args.nbsp) and " " or " "
▲ -- Named parameter nbsp allows replacing the leading space with
space = " "▼
▲ end
return
i18n.message ..▼
"
"|link=https://www.wikidata.org/wiki/" .. qid ..
(
"|class=noprint" ..
▲ "|" .. i18n.message ..
"]]"
end
return ""
end
function p.showMessage(frame)
return p._showMessage(frame.args)
end
|