Module:WikidataIB: Difference between revisions
Richardpruen (talk | contribs) m 1 revision imported: Templates and CSS files |
Richardpruen (talk | contribs) m 1 revision imported: templates |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
-- Version: | -- Version: 2023-07-10 | ||
-- Module to implement use of a blacklist and whitelist for infobox fields | -- 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 | -- Can take a named parameter |qid which is the Wikidata ID for the article | ||
Line 11: | Line 11: | ||
-- whitelist is passed in named parameter |fetchwikidata (or |fwd) | -- whitelist is passed in named parameter |fetchwikidata (or |fwd) | ||
require("strict") | |||
local p = {} | local p = {} | ||
Line 18: | Line 19: | ||
-- Module:ISOdate | -- Module:ISOdate | ||
-- Module:DateI18n | -- Module:DateI18n | ||
-- Module:I18n/complex date | -- Module:I18n/complex date | ||
-- Module:Ordinal | -- Module:Ordinal | ||
Line 160: | Line 160: | ||
langobj = mw.language.new( langcode ) | langobj = mw.language.new( langcode ) | ||
else | else | ||
langcode = mw.getCurrentFrame(): | langcode = mw.getCurrentFrame():callParserFunction('int', {'lang'}) | ||
if mw.language.isKnownLanguageTag(langcode) then | if mw.language.isKnownLanguageTag(langcode) then | ||
langobj = mw.language.new( langcode ) | langobj = mw.language.new( langcode ) | ||
Line 586: | Line 586: | ||
local postfix = (args.postfix or ""):gsub('"', '') | local postfix = (args.postfix or ""):gsub('"', '') | ||
local dtxt = args.dtxt | local dtxt = args.dtxt | ||
local shortname = args.shortname | local shortname = args.shortname or args.sn | ||
local lang = args.lang or "en" -- fallback to default if missing | local lang = args.lang or "en" -- fallback to default if missing | ||
local uselbl = args.uselabel or args.uselbl | local uselbl = args.uselabel or args.uselbl | ||
Line 3,067: | Line 3,067: | ||
------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ||
p.siteID = function(frame) | p.siteID = function(frame) | ||
local txtlang = frame: | local txtlang = frame:callParserFunction('int', {'lang'}) or "" | ||
-- This deals with specific exceptions: be-tarask -> be-x-old | -- This deals with specific exceptions: be-tarask -> be-x-old | ||
if txtlang == "be-tarask" then | if txtlang == "be-tarask" then | ||
Line 3,091: | Line 3,091: | ||
------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ||
p.projID = function(frame) | p.projID = function(frame) | ||
local txtlang = frame: | local txtlang = frame:callParserFunction('int', {'lang'}) or "" | ||
-- This deals with specific exceptions: be-tarask -> be-x-old | -- This deals with specific exceptions: be-tarask -> be-x-old | ||
if txtlang == "be-tarask" then | if txtlang == "be-tarask" then |