Jump to content

Module:Citation/CS1/Identifiers: Difference between revisions

no edit summary
m>Trappist the monk
No edit summary
m>Trappist the monk
No edit summary
Line 148: Line 148:


if false == valid_ismn then
if false == valid_ismn then
text = text .. ' ' .. set_error( 'bad_ismn' ) -- add an error message if the issn is invalid
text = text .. ' ' .. set_error( 'bad_ismn' ) -- add an error message if the ismn is invalid
end  
end  
Line 170: Line 170:
]]
]]


local function issn(id)
local function issn(id, e)
local issn_copy = id; -- save a copy of unadulterated issn; use this version for display if issn does not validate
local issn_copy = id; -- save a copy of unadulterated issn; use this version for display if issn does not validate
local handler = cfg.id_handlers['ISSN'];
local handler;
local text;
local text;
local valid_issn = true;
local valid_issn = true;
if e then
handler = cfg.id_handlers['EISSN'];
else
handler = cfg.id_handlers['ISSN'];
end


id=id:gsub( "[%s-–]", "" ); -- strip spaces, hyphens, and endashes from the issn
id=id:gsub( "[%s-–]", "" ); -- strip spaces, hyphens, and endashes from the issn
Line 194: Line 200:
   
   
if false == valid_issn then
if false == valid_issn then
text = text .. ' ' .. set_error( 'bad_issn' ) -- add an error message if the issn is invalid
text = text .. ' ' .. set_error( 'bad_issn', e and 'e' or '' ) -- add an error message if the issn is invalid
end  
end  
Line 642: Line 648:
elseif k == 'ISSN' then
elseif k == 'ISSN' then
table.insert( new_list, {handler.label, issn( v ) } );
table.insert( new_list, {handler.label, issn( v ) } );
elseif k == 'EISSN' then
table.insert( new_list, {handler.label, issn( v, true ) } ); -- true distinguishes eissn from issn
elseif k == 'ISBN' then
elseif k == 'ISBN' then
local ISBN = internal_link_id( handler );
local ISBN = internal_link_id( handler );
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.