Module:Citation/CS1/Identifiers: Difference between revisions

sync doi() from sandbox to fix minor error because same time fixed lua script error in ~/Date validation;
(sync from sandbox;)
(sync doi() from sandbox to fix minor error because same time fixed lua script error in ~/Date validation;)
Line 417: Line 417:
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode, access=access}) .. (inactive or '')
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode, access=access}) .. (inactive or '')


-- if nil == id:match("^10%.[^%s–]-/[^%s–]-[^%.,]$") or -- doi must begin with '10.', must contain a fwd slash, must not contain spaces or endashes, and must not end with period or comma
-- id: match ('^10.5555') then -- test doi will never resolve
-- cat = ' ' .. set_error ('bad_doi');
-- end
local registrant = id:match ('^10%.([^/]+)/[^%s–]-[^%.,]$'); -- registrant set when doi has the proper basic form
local registrant = id:match ('^10%.([^/]+)/[^%s–]-[^%.,]$'); -- registrant set when doi has the proper basic form
Line 430: Line 425:
'^[^1-9]%d%d%d$', -- 4 digits without subcode (0xxx); accecpts: 1000–9999
'^[^1-9]%d%d%d$', -- 4 digits without subcode (0xxx); accecpts: 1000–9999
'^%d%d%d%d%d%d+', -- 6 or more digits
'^%d%d%d%d%d%d+', -- 6 or more digits
'^%d%d?%d?%.%d%d*$', -- less than 4 digits with subcode
'^%d%d?%d?$', -- less than 4 digits without subcode (with subcode is legitimate)
'^%d%d?%d?$', -- less than 4 digits without subcode
'^5555$', -- test registrant will never resolve
'^5555$', -- test registrant will never resolve
}
}