17,548
回編集
bsd>Trappist the monk (sync from sandbox;) |
細 (1版 をインポートしました) |
||
| (2人の利用者による、間の3版が非表示) | |||
| 291行目: | 291行目: | ||
return lccn; | return lccn; | ||
end | |||
| 710行目: | 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 | ||
| 722行目: | 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 | ||
| 728行目: | 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 | ||