Content deleted Content added
No edit summary |
tweaks to clean code while retaining Snævar's performance fix; will restore Nardog's noprint when exact html is decided on talk |
||
Line 2:
-- Icon will be linked to the Wikidata entry for the article where this is placed.
-- 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) then
-- Parameter pid=x uses x as an anchor in the link to the Wikidata entry.
local anchor = trimToNil(args.pid)
▲ -- Named parameter nbsp allows replacing the leading space with
local space
if
space = " "
else
space = " "
end
return
space ..
i18n.message ..
" |link=https://www.wikidata.org/wiki/" ..
(
"|" ..
i18n.message .. "]] end
return ""
end
function p.showMessage(frame)
return p._showMessage(frame.args)
end
|