Jump to content

Module:Citation/CS1/Identifiers: Difference between revisions

biorxiv cat fix?
(sync from sandbox;)
(biorxiv cat fix?)
Line 408: Line 408:
local function biorxiv(id)
local function biorxiv(id)
local handler = cfg.id_handlers['BIORXIV'];
local handler = cfg.id_handlers['BIORXIV'];
local err_cat = ' ' .. set_error( 'bad_biorxiv'); -- assume that there will be an error
local err_cat = true; -- flag; assume that there will be an error
local patterns = {
local patterns = {
Line 422: Line 422:
if m then -- m is nil when id is the six-digit form
if m then -- m is nil when id is the six-digit form
if not is_valid_biorxiv_date (y .. '-' .. m .. '-' .. d) then -- validate the encoded date; TODO: don't ignore leapyear and actual month lengths ({{#time:}} is a poor date validator)
if not is_valid_biorxiv_date (y .. '-' .. m .. '-' .. d) then -- validate the encoded date; TODO: don't ignore leapyear and actual month lengths ({{#time:}} is a poor date validator)
break; -- break out early so we don't unset the error message
break; -- date fail; break out early so we don't unset the error message
end
end
end
end
err_cat = ''; -- we found a match so unset the error message
err_cat = nil; -- we found a match so unset the error message
break; -- and done
break; -- and done
end
end
Line 432: Line 432:
return external_link_id ({link=handler.link, label=handler.label, q=handler.q, redirect=handler.redirect,
return external_link_id ({link=handler.link, label=handler.label, q=handler.q, redirect=handler.redirect,
prefix=handler.prefix,id=id,separator=handler.separator,
prefix=handler.prefix,id=id,separator=handler.separator,
encode=handler.encode, access=handler.access}) .. err_cat;
encode=handler.encode, access=handler.access}) .. (err_cat and (' ' .. set_error( 'bad_biorxiv')) or '');
end
end


Cookies help us deliver our services. By using our services, you agree to our use of cookies.