Jump to content

Module:Citation/CS1/Identifiers: Difference between revisions

m
ssrn limit -> 3500000;
m (1 revision imported: CITATION NEEDED)
m (ssrn limit -> 3500000;)
Line 29:
ext_link = mw.ustring.format ('[%s%s%s %s]', options.prefix, url_string, options.suffix or "", mw.text.nowiki(options.id));
if is_set(options.access) then
ext_link = substitute (cfg.presentation[options.'access-signal'], {ext_link, cfg.presentation[options.access]}); -- add the free-to-read / paywall lock
end
return mw.ustring.format( '[[%s|%s]]%s%s', options.link, options.label, options.separator or " ", ext_link);
 
-- return mw.ustring.format( '[[%s|%s]]%s[%s%s%s %s]',
-- options.link, options.label, options.separator or " ",
-- options.prefix, url_string, options.suffix or "",
-- mw.text.nowiki(options.id)
-- );
end
 
Line 335 ⟶ 329:
return text .. class;
end
 
 
--[[--------------------------< B I O R X I V >-----------------------------------------------------------------
Line 340 ⟶ 335:
Format bioRxiv id and do simple error checking. BiorXiv ids are exactly 6 digits.
The bioRxiv id is the number following the last slash in the bioRxiv-issued DOI:
httphttps://dx.doi.org/10.1101/078733 -> 078733
 
]]
Line 356 ⟶ 351:
encode=handler.encode, access=handler.access}) .. err_cat;
end
 
 
--[[--------------------------< N O R M A L I Z E _ L C C N >--------------------------------------------------
Line 521 ⟶ 517:
 
local function pmc(id, embargo)
local test_limit = 6000000; -- update this value as PMCs approach
local handler = cfg.id_handlers['PMC'];
local err_cat = ''; -- presume that PMC is valid
local id_num;
local text;
id_num = id:match ('^[Pp][Mm][Cc](%d+)$'); -- identifier with pmc prefix
 
if is_set (id_num) then
if id:match("[^%d]") then -- if PMC has anything but digits
add_maint_cat ('pmc_format');
err_cat = ' ' .. set_error( 'bad_pmc' ); -- set an error message
else -- PMCplain number iswithout onlypmc digitsprefix
local id_num = tonumber(id:match ('^%d+$'); -- convertif idhere to a numberid foris rangeall testingdigits
end
if 1 > id_num or test_limit < id_num then -- if PMC is outside test limit boundaries
 
err_cat = ' ' .. set_error( 'bad_pmc' ); -- set an error message
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber(id_num); -- convert id_num to a number for range testing
if 1 > id_num or test_limit < id_num then -- if PMC is outside test limit boundaries
err_cat = ' ' .. set_error( 'bad_pmc' ); -- set an error message
else
id = tostring (id_num); -- make sure id is a string
end
else -- when id format incorrect
err_cat = ' ' .. set_error( 'bad_pmc' ); -- set an error message
end
Line 539 ⟶ 545:
text="[[" .. handler.link .. "|" .. handler.label .. "]]" .. handler.separator .. id .. err_cat; -- still embargoed so no external link
else
text = external_link_id({link = handler.link, label = handler.label, -- no embargo date or embargo has expired, ok to link to article
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode, access=handler.access}) .. err_cat;
end
Line 768 ⟶ 774:
return text;
end
 
 
--[[--------------------------< C I T E S E E R X >------------------------------------------------------------
Line 773 ⟶ 780:
CiteSeerX use their own notion of "doi" (not to be confused with the identifiers resolved via doi.org).
 
The description of the structure of this identifier can be found at Help_talk:Citation_Style_1/Archive_26#CiteSeerX_id_structure
]]
 
Line 790 ⟶ 797:
return text;
end
 
 
--[[--------------------------< S S R N >----------------------------------------------------------------------
 
Format an ssrn, do simple error checking
 
SSRNs are sequential numbers beginning at 100? and counting up. This code checks the ssrn to see that it is
only digits and is greater than 99 and less than test_limit; the value in local variable test_limit will need
to be updated periodically as more SSRNs are issued.
 
]]
 
local function ssrn (id)
local test_limit = 3500000; -- update this value as SSRNs approach
local handler = cfg.id_handlers['SSRN'];
local err_cat = ''; -- presume that SSRN is valid
local id_num;
local text;
ifid_num = id:match ("['^%d]"+$') then; -- if PMCid hasmust anythingbe butall digits
 
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber(id_num); -- convert id_num to a number for range testing
if 100 > id_num or test_limit < id_num then -- if SSRN is outside test limit boundaries
err_cat = ' ' .. set_error( 'bad_ssrn' ); -- set an error message
-- end
else -- when id format incorrect
err_cat = ' ' .. set_error( 'bad_ssrn' ); -- set an error message
end
text = external_link_id({link = handler.link, label = handler.label,
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode, access=handler.access}) .. err_cat;
 
return text;
end
 
 
--[[--------------------------< B U I L D _ I D _ L I S T >--------------------------------------------------------
Line 841 ⟶ 884:
elseif k == 'OCLC' then
table.insert( new_list, {handler.label, oclc( v ) } );
elseif k == 'SSRN' then
table.insert( new_list, {handler.label, ssrn( v ) } );
elseif k == 'ISMN' then
table.insert( new_list, {handler.label, ismn( v ) } );
Line 851 ⟶ 896:
local check;
local err_type = '';
-- if not check_isbn( v ) and not is_set(options.IgnoreISBN) then
-- ISBN = ISBN .. set_error( 'bad_isbn', {}, false, " ", "" );
-- end
check, err_type = check_isbn( v );
if not check then
Line 901 ⟶ 943:
return id_list;
end
 
 
--[[--------------------------< E X T R A C T _ I D _ A C C E S S _ L E V E L S >--------------------------------------
Line 954 ⟶ 997:
z = utilities_page_ptr.z; -- table of tables in Module:Citation/CS1/Utilities
end
 
 
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.