Module:Citation/CS1/Identifiers: Difference between revisions
sync from sandbox; |
EnWikiAdmin (talk | contribs) m 1 revision imported |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 291: | Line 291: | ||
return lccn; | return lccn; | ||
end | |||
Line 710: | Line 710: | ||
]] | ]] | ||
local function isbn ( | local function isbn (options_t) | ||
local isbn_str = | local isbn_str = options_t.id; | ||
local ignore_invalid = | local ignore_invalid = options_t.accept; | ||
local handler = | local handler = options_t.handler; | ||
local year = options_t.Year; -- when set, valid anchor_year; may have a disambiguator which must be removed | |||
local function return_result (check, err_type) -- local function to handle the various returns | local function return_result (check, err_type) -- local function to handle the various returns | ||
Line 722: | Line 723: | ||
else -- here when not ignoring | else -- here when not ignoring | ||
if not check then -- and there is an error | if not check then -- and there is an error | ||
options_t.coins_list_t['ISBN'] = nil; -- when error, unset so not included in COinS | |||
set_message ('err_bad_isbn', err_type); -- set an error message | set_message ('err_bad_isbn', err_type); -- set an error message | ||
return ISBN; -- return id text | return ISBN; -- return id text | ||
Line 728: | Line 729: | ||
end | end | ||
return ISBN; -- return id text | return ISBN; -- return id text | ||
end | |||
if year and not ignore_invalid then -- | |||
year = year:match ('%d%d%d%d?'); -- strip disambiguator if present | |||
if year and (1965 > tonumber(year)) then | |||
set_message ('err_invalid_isbn_date'); -- set an error message | |||
return internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect, | |||
prefix = handler.prefix, id = isbn_str, separator = handler.separator}); | |||
end | |||
end | end | ||