From 2c0b7f935fce9f5ce61da3dc547409adae364289 Mon Sep 17 00:00:00 2001 From: Jonathan Harker Date: Mon, 21 Sep 2026 09:40:19 +1200 Subject: [PATCH] Tweak CS1 config load (once per page) --- module_citeq.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/module_citeq.lua b/module_citeq.lua index 0b73d54..65ec733 100644 --- a/module_citeq.lua +++ b/module_citeq.lua @@ -8,7 +8,7 @@ local followQid = wdib._followQid local cite_cfg = mw.loadData ('Module:Cite/config') local cfg = mw.loadData ('Module:Cite_Q/config') local cs1_module = 'Module:Citation/CS1' -- don't load the module yet, may not be needed -local cs1_cfg = 'Module:Citation/CS1/Configuration' +local cs1_cfg = mw.loadData('Module:Citation/CS1/Configuration') -------------------------------------------------------------------------------- -- makeOrdinal needs to be internationalised along with cfg.i18n_t @@ -349,12 +349,11 @@ local function getIdentifierAccess(qid, args, identifier) -- check DOI registrant is known free, using CS1 config -- TODO: this should also be modelled in Wikidata if identifier == 'doi' then - local cs1 = require(cs1_cfg) local registrant, suffix = mw.ustring.match(args.doi:lower(), '^10%.([^/]+)/([^%s–]+)$'); - if registrant and suffix and cs1.known_free_doi_registrants_t[registrant] then + if registrant and suffix and cs1_cfg.known_free_doi_registrants_t[registrant] then return 'free' - elseif registrant and suffix and cs1.extended_registrants_t[registrant] then - for _, incipit in ipairs(cs1.extended_registrants_t[registrant]) do + elseif registrant and suffix and cs1_cfg.extended_registrants_t[registrant] then + for _, incipit in ipairs(cs1_cfg.extended_registrants_t[registrant]) do if mw.ustring.find (suffix, '^' .. incipit:lower()) then return 'free' end