Jump to content

Module:Citation/CS1/Identifiers and Module:Citation/CS1/Identifiers/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
imported>Deadfire
m 1 revision imported: Things for CS1
 
imported>Deadfire
creation
 
Line 1: Line 1:
--[[
History of changes since last sync: 2024-08-17
2024-08-19: fix extended free doi bug; see Help_talk:Citation_Style_1#module_suite_update_17–18_August_2024
]]
--[[--------------------------< F O R W A R D  D E C L A R A T I O N S >--------------------------------------
--[[--------------------------< F O R W A R D  D E C L A R A T I O N S >--------------------------------------
]]
]]
Line 554: Line 562:
local handler = options.handler;
local handler = options.handler;
local err_flag;
local err_flag;
local function is_extended_free (registrant, suffix) -- local function to check those few registrants that are mixed; identifiable by the doi suffix <incipit>
if cfg.extended_registrants_t[registrant] then -- if this registrant has known free-to-read extentions
for _, incipit in ipairs (cfg.extended_registrants_t[registrant]) do -- loop through the registrant's incipits
if mw.ustring.find (suffix, '^' .. incipit) then -- if found
return true;
end
end
end
end


local text;
local text;
Line 580: Line 598:
end
end


local registrant = mw.ustring.match (id, '^10%.([^/]+)/[^%s–]-[^%.,]$'); -- registrant set when DOI has the proper basic form
local suffix;
local registrant, suffix = mw.ustring.match (id, '^10%.([^/]+)/([^%s–]-[^%.,])$'); -- registrant and suffix set when DOI has the proper basic form


local registrant_err_patterns = { -- these patterns are for code ranges that are not supported  
local registrant_err_patterns = { -- these patterns are for code ranges that are not supported  
Line 612: Line 631:
options.coins_list_t['DOI'] = nil; -- when error, unset so not included in COinS
options.coins_list_t['DOI'] = nil; -- when error, unset so not included in COinS
else
else
if not access and cfg.known_free_doi_registrants_t[registrant] then -- |doi-access=free not set and <registrant> is known to be free
if not access and (cfg.known_free_doi_registrants_t[registrant] or is_extended_free (registrant, suffix)) then -- |doi-access=free not set and <registrant> is known to be free
set_message ('maint_doi_unflagged_free'); -- set a maint cat
set_message ('maint_doi_unflagged_free'); -- set a maint cat
end
end