| Line 29: |
Line 29: |
| | ext_link = mw.ustring.format ('[%s%s%s %s]', options.prefix, url_string, options.suffix or "", mw.text.nowiki(options.id)); | | 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 | | if is_set(options.access) then |
| − | ext_link = substitute (cfg.presentation[options.access], ext_link); -- add the free-to-read / paywall lock | + | ext_link = substitute (cfg.presentation['access-signal'], {ext_link, cfg.presentation[options.access]}); -- add the free-to-read / paywall lock |
| | end | | 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', 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 | | end |
| | | | |
| Line 335: |
Line 329: |
| | return text .. class; | | return text .. class; |
| | end | | end |
| | + | |
| | | | |
| | --[[--------------------------< B I O R X I V >----------------------------------------------------------------- | | --[[--------------------------< B I O R X I V >----------------------------------------------------------------- |
| Line 340: |
Line 335: |
| | Format bioRxiv id and do simple error checking. BiorXiv ids are exactly 6 digits. | | 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: | | The bioRxiv id is the number following the last slash in the bioRxiv-issued DOI: |
| − | http://dx.doi.org/10.1101/078733 -> 078733
| + | https://doi.org/10.1101/078733 -> 078733 |
| | | | |
| | ]] | | ]] |
| Line 356: |
Line 351: |
| | encode=handler.encode, access=handler.access}) .. err_cat; | | encode=handler.encode, access=handler.access}) .. err_cat; |
| | end | | end |
| | + | |
| | | | |
| | --[[--------------------------< N O R M A L I Z E _ L C C N >-------------------------------------------------- | | --[[--------------------------< N O R M A L I Z E _ L C C N >-------------------------------------------------- |
| Line 521: |
Line 517: |
| | | | |
| | local function pmc(id, embargo) | | local function pmc(id, embargo) |
| − | local test_limit = 6000000; -- update this value as PMCs approach | + | local test_limit = 6000000; -- update this value as PMCs approach |
| | local handler = cfg.id_handlers['PMC']; | | local handler = cfg.id_handlers['PMC']; |
| − | local err_cat = ''; -- presume that PMC is valid | + | local err_cat = ''; -- presume that PMC is valid |
| | + | local id_num; |
| | + | local text; |
| | | | |
| − | local text; | + | id_num = id:match ('^[Pp][Mm][Cc](%d+)$'); -- identifier with pmc prefix |
| | + | |
| | + | if is_set (id_num) then |
| | + | add_maint_cat ('pmc_format'); |
| | + | else -- plain number without pmc prefix |
| | + | id_num = id:match ('^%d+$'); -- if here id is all digits |
| | + | end |
| | | | |
| − | if id:match("[^%d]") then -- if PMC has anything but digits | + | if is_set (id_num) then -- id_num has a value so test it |
| − | err_cat = ' ' .. set_error( 'bad_pmc' ); -- set an error message
| + | id_num = tonumber(id_num); -- convert id_num to a number for range testing |
| − | else -- PMC is only digits
| + | if 1 > id_num or test_limit < id_num then -- if PMC is outside test limit boundaries |
| − | local id_num = tonumber(id); -- convert id to a number for range testing | + | err_cat = ' ' .. set_error( 'bad_pmc' ); -- set an error message |
| − | if 1 > id_num or test_limit < id_num then -- if PMC is outside test limit boundaries | + | else |
| − | err_cat = ' ' .. set_error( 'bad_pmc' ); -- set an error message | + | id = tostring (id_num); -- make sure id is a string |
| | end | | end |
| | + | else -- when id format incorrect |
| | + | err_cat = ' ' .. set_error( 'bad_pmc' ); -- set an error message |
| | end | | end |
| | | | |
| Line 539: |
Line 545: |
| | text="[[" .. handler.link .. "|" .. handler.label .. "]]" .. handler.separator .. id .. err_cat; -- still embargoed so no external link | | text="[[" .. handler.link .. "|" .. handler.label .. "]]" .. handler.separator .. id .. err_cat; -- still embargoed so no external link |
| | else | | else |
| − | text = external_link_id({link = handler.link, label = handler.label, -- no embargo date or embargo has expired, ok to link to article | + | 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; | | prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode, access=handler.access}) .. err_cat; |
| | end | | end |
| Line 768: |
Line 774: |
| | return text; | | return text; |
| | end | | end |
| | + | |
| | | | |
| | --[[--------------------------< C I T E S E E R X >------------------------------------------------------------ | | --[[--------------------------< C I T E S E E R X >------------------------------------------------------------ |
| Line 773: |
Line 780: |
| | CiteSeerX use their own notion of "doi" (not to be confused with the identifiers resolved via doi.org). | | 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#CiteSeerX_id_structure | + | The description of the structure of this identifier can be found at Help_talk:Citation_Style_1/Archive_26#CiteSeerX_id_structure |
| | ]] | | ]] |
| | | | |
| Line 790: |
Line 797: |
| | return text; | | return text; |
| | end | | 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 = 3000000; -- 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; |
| | + | |
| | + | id_num = id:match ('^%d+$'); -- id must be all 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 >-------------------------------------------------------- | | --[[--------------------------< B U I L D _ I D _ L I S T >-------------------------------------------------------- |
| Line 841: |
Line 884: |
| | elseif k == 'OCLC' then | | elseif k == 'OCLC' then |
| | table.insert( new_list, {handler.label, oclc( v ) } ); | | table.insert( new_list, {handler.label, oclc( v ) } ); |
| | + | elseif k == 'SSRN' then |
| | + | table.insert( new_list, {handler.label, ssrn( v ) } ); |
| | elseif k == 'ISMN' then | | elseif k == 'ISMN' then |
| | table.insert( new_list, {handler.label, ismn( v ) } ); | | table.insert( new_list, {handler.label, ismn( v ) } ); |
| Line 851: |
Line 896: |
| | local check; | | local check; |
| | local err_type = ''; | | 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 ); | | check, err_type = check_isbn( v ); |
| | if not check then | | if not check then |
| Line 901: |
Line 943: |
| | return id_list; | | return id_list; |
| | end | | end |
| | + | |
| | | | |
| | --[[--------------------------< E X T R A C T _ I D _ A C C E S S _ L E V E L S >-------------------------------------- | | --[[--------------------------< E X T R A C T _ I D _ A C C E S S _ L E V E L S >-------------------------------------- |
| Line 954: |
Line 997: |
| | z = utilities_page_ptr.z; -- table of tables in Module:Citation/CS1/Utilities | | z = utilities_page_ptr.z; -- table of tables in Module:Citation/CS1/Utilities |
| | end | | end |
| − |
| |
| | | | |
| | | | |