Module:Wd: Difference between revisions
Content deleted Content added
m Minor simplification |
Johnrdorazio (talk | contribs) m 1 revision imported |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 653:
function Config:getLabel(id, raw, link, short)
local label = nil
local
if not id then
Line 670 ⟶ 669:
if mw.wikibase.isValidEntityId(id) and mw.wikibase.entityExists(id) then
label = id
end
prefix, title = "d:Special:EntityPage/", label -- may
else
-- try short name first if requested
Line 691 ⟶ 684:
-- get label
if not label then
label = mw.wikibase.getLabelByLang(id, self.langCode) -- XXX: should use fallback labels?
end
end
Line 704 ⟶ 697:
elseif id:sub(1,1) == "P" then
-- properties have no sitelink, link to Wikidata instead
prefix, title = "d:Special:EntityPage/", id
end
end
label = mw.text.nowiki(label) -- escape raw label text so it cannot be wikitext markup
if title then
label = buildWikilink(prefix .. title, label)
Line 2,541 ⟶ 2,534:
-- main function that is supposed to be used by wrapper templates
function p.main(frame)
if not mw.wikibase then return nil end
local f, args
|