「模組:WikidataIB」:修訂間差異

增加 914 位元組 、​ 2023年1月22日 (星期日)
無編輯摘要
imported>DC
(建立內容為「-- Module to implement use of a blacklist and whitelist for infobox fields -- Can take a named parameter |qid which is the Wikidata ID for the article -- if not supplied, it will use the Wikidata ID associated with the current page. -- Fields in blacklist are never to be displayed, i.e. module must return nil in all circumstances -- Fields in whitelist return local value if it exists or the Wikidata value otherwise -- The name of the field that this function…」的新頁面)
 
imported>DC
無編輯摘要
第2,506行: 第2,506行:
local label = labelOrId(itemID, lang)
local label = labelOrId(itemID, lang)
return label
return label
end
-------------------------------------------------------------------------------
-- label has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
-- if no qid is supplied, it uses the qid associated with the current page.
-- It returns the Wikidata label for the local language as plain text.
-- If there is no label in the local language, it returns nil.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.label = function(frame)
local qid = mw.text.trim(frame.args[1] or frame.args.qid or "")
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return end
local lang = frame.args.lang or ""
if lang == "" then lang = nil end
local label, success = labelOrId(qid, lang)
if success then return label end
end
end


第3,236行: 第3,255行:
getLink
getLink
getLabel
getLabel
label
getAT
getAT
getDescription
getDescription
匿名用戶