Module:WikidataIB: Difference between revisions
m
1 revision imported
(ensure that _getPropOfProp never returns an empty string) |
m (1 revision imported) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1:
-- Version:
-- 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
Line 11:
-- whitelist is passed in named parameter |fetchwikidata (or |fwd)
require("strict")
local p = {}
Line 18 ⟶ 19:
-- Module:ISOdate
-- Module:DateI18n
-- Module:I18n/complex date
-- Module:Ordinal
Line 160:
langobj = mw.language.new( langcode )
else
langcode = mw.getCurrentFrame():
if mw.language.isKnownLanguageTag(langcode) then
langobj = mw.language.new( langcode )
Line 586:
local postfix = (args.postfix or ""):gsub('"', '')
local dtxt = args.dtxt
local shortname = args.shortname or args.sn
local lang = args.lang or "en" -- fallback to default if missing
local uselbl = args.uselabel or args.uselbl
Line 3,067:
-------------------------------------------------------------------------------
p.siteID = function(frame)
local txtlang = frame:
-- This deals with specific exceptions: be-tarask -> be-x-old
if txtlang == "be-tarask" then
Line 3,091:
-------------------------------------------------------------------------------
p.projID = function(frame)
local txtlang = frame:
-- This deals with specific exceptions: be-tarask -> be-x-old
if txtlang == "be-tarask" then
Line 3,250:
local url = frame.args.url or ""
if url:upper() == "NONE" then return nil end
local urls = {}▼
local quals = {}▼
local qid = frame.args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end▼
urls[1] = url▼
if not qid then return nil end▼
else▼
▲ local urls = {}
▲ local quals = {}
▲ if url == "" then
local prop856 = mw.wikibase.getBestStatements(qid, "P856")
for k, v in pairs(prop856) do
Line 3,271 ⟶ 3,272:
end -- test for website having a value
end -- loop through website(s)
▲ else
▲ urls[1] = url
end
if #urls == 0 then return nil end
|