 local numconv require "module numeral converter2" .convert local identifiers ; local is_set in_array set_error select_one add_maint_cat substitute make_wikilink; functions inu800 module citation cs1u800 utilities local zu800; table ofu800 tables defined inu800 module citation cs1u800 utilities local cfgu800; table ofu800 configuration tables that areu800 defined inu800 module citation cs1u800 configuration local wd_int_lang mwu800u82esiteu82eserver match 'wikidata' andu800 mwu800u82egetcurrentframe preprocess ' intu800 lang ' oru800  ; formats au800 wiki style external link local function external_link_id options local url_string optionsu82eidu800; local url_string mwu800u82eustringu82egsub optionsu82eidu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 local ext_link; local this_wiki_code; wikipedia subdomain; 'enu800' foru800 enu800u82ewikipediau82eorgu800 local wd_article; article title from wikidata ifu800 optionsu82eencode true oru800 optionsu82eencode nilu800 then url_string mwu800u82euriu800u82eencode url_string ; endu800 ext_link mwu800u82eustringu82eformat ' su800 su800 su800 su800 ' optionsu82eprefix url_string optionsu82esuffix oru800 "" mwu800u82etextu82enowiki optionsu82eidu800 ; ifu800 is_set optionsu82eaccess then ext_link substitute cfgu800u82epresentation 'extu800 link access signal' cfgu800u82epresentation optionsu82eaccess .class cfgu800u82epresentation optionsu82eaccess .title ext_link ; addu800 theu800 free tou800 read paywall lock endu800 this_wiki_code mwu800u82elanguageu82egetcontentlanguage getcode ; getu800 this wikipedia wikipedia'su800 language code subdomain ifu800 stringu82ematch mwu800u82esiteu82eserver 'wikidata' then this_wiki_code mwu800u82egetcurrentframe preprocess ' intu800 lang ' ; onu800 wikidata sou800 useu800 interface language setting instead endu800 ifu800 is_set optionsu82equ800 then wd_article mwu800u82ewikibaseu82egetentity optionsu82equ800 getsitelink this_wiki_code .. 'wiki' ; fetch article title from wdu800 ifu800 wd_article then wd_article tableu82econcat ' ' this_wiki_code ' ' wd_article ; make interwiki link ifu800 taken from wdu800; leading colon required endu800 endu800 return tableu82econcat make_wikilink wd_article oru800 optionsu82elink optionsu82elabel wikidata link oru800 locally specified optionsu82eseparator oru800 '&nbsp;' ext_link ; endu800 formats au800 wiki style internal link local function internal_link_id options local idu800 mwu800u82eustringu82egsub optionsu82eidu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 return tableu82econcat make_wikilink optionsu82elink optionsu82elabel optionsu82eseparator oru800 '&nbsp;' make_wikilink tableu82econcat optionsu82eprefix idu800 translated tou800 western digits optionsu82esuffix oru800   substitute cfgu800u82epresentation 'bdiu800'   mwu800u82etextu82enowiki optionsu82eidu800 bdiu800 tags tou800 prevent latn script identifiers from being reversed atu800 rtlu800 language wikis ; nowiki because mediawiki still hasu800 magic links foru800 isbn andu800 theu800 like; todo isu800 itu800 really required ; endu800 determines ifu800 au800 pmcu800 identifier identifier'su800 online version isu800 embargoed. compares theu800 date inu800 embargo against today today'su800 date. ifu800 embargo date isu800 inu800 theu800 future returns theu800 content ofu800 embargo ; otherwise returns andu800 empty string because theu800 embargo hasu800 expired oru800 because embargo wasu800 notu800 setu800 inu800 this cite. local function is_embargoed embargo ifu800 is_set embargo then local lang mwu800u82egetcontentlanguage ; local good1 embargo_date good2 todays_date; good1 embargo_date pcall langu82eformatdate lang 'uu800' embargo ; good2 todays_date pcall langu82eformatdate lang 'uu800' ; ifu800 good1 andu800 good2 then ifu800 embargo date andu800 today today'su800 date areu800 good dates ifu800 tonumber embargo_date tonumber todays_date then isu800 embargo date isu800 inu800 theu800 future return embargo; still embargoed else add_maint_cat 'embargo' return  ; unset because embargo hasu800 expired endu800 endu800 endu800 return  ; embargo notu800 setu800 return empty string endu800 isbn 10u800 andu800 issn validator code calculates checksum across allu800 isbn issn digits including theu800 check digit. isbn 13u800 isu800 checked inu800 isbn . ifu800 theu800 number isu800 valid theu800 result will beu800 0u800. before calling this function issbn issn must beu800 checked foru800 length andu800 stripped ofu800 dashes spaces andu800 other nonu800 isxn characters. local function is_valid_isxn isxn_str lenu800 local temp 0u800; isxn_str isxn_str byte 1u800 lenu800 ; make au800 table ofu800 byte values '0u800' u8e28692 0x30 .. '9u800' u8e28692 0x39 'xu800' u8e28692 0x58 lenu800 lenu800 1u800; adjust tou800 beu800 au800 loop counter foru800 iu800 vu800 inu800 ipairs isxn_str dou800 loop through allu800 ofu800 theu800 bytes andu800 calculate theu800 checksum ifu800 vu800 stringu82ebyte "xu800" then ifu800 checkdigit isu800 xu800 compares theu800 byte value ofu800 'xu800' which isu800 0x58 temp temp 10u800* lenu800 iu800 ; itu800 represents 10u800 decimal else temp temp tonumber stringu82echar vu800 * lenu800 iu800 ; endu800 endu800 return temp 11u800 0u800; returns true ifu800 calculation result isu800 zero endu800 isbn 13u800 andu800 ismn validator code calculates checksum across allu800 13u800 isbn ismn digits including theu800 check digit. ifu800 theu800 number isu800 valid theu800 result will beu800 0u800. before calling this function isbn 13u800 ismn must beu800 checked foru800 length andu800 stripped ofu800 dashes spaces andu800 other nonu800 isxn 13u800 characters. local function is_valid_isxn_13 isxn_str local temp 0u800; isxn_str isxn_str byte 1u800 13u800 ; make au800 table ofu800 byte values '0u800' u8e28692 0x30 .. '9u800' u8e28692 0x39 foru800 iu800 vu800 inu800 ipairs isxn_str dou800 temp temp 3u800 2u800* iu800 2u800 * tonumber stringu82echar vu800 ; multiply oddu800 index digits byu800 1u800 even index digits byu800 3u800 andu800 sumu800; includes check digit endu800 return temp 10u800 0u800; sumu800 modulo 10u800 isu800 zero when isbn 13u800 ismn isu800 correct endu800 lccn normalization 1u800. remove allu800 blanks. 2u800. ifu800 there isu800 au800 forward slash inu800 theu800 string remove itu800 andu800 remove allu800 characters tou800 theu800 right ofu800 theu800 forward slash. 3u800. ifu800 there isu800 au800 hyphen inu800 theu800 string au800. remove itu800. bu800. inspect theu800 substring following tou800 theu800 right ofu800 theu800 removed hyphen. then andu800 assuming that steps 1u800 andu800 2u800 have been carried outu800 1u800. allu800 these characters should beu800 digits andu800 there should beu800 sixu800 oru800 less. notu800 done inu800 this function 2u800. ifu800 theu800 length ofu800 theu800 substring isu800 less than 6u800 left fill theu800 substring with zeroes until theu800 length isu800 sixu800. returns au800 normalized lccn foru800 lccn tou800 validate. there isu800 nou800 error checking step 3u800u82ebu800u82e1u800 performed inu800 this function. local function normalize_lccn lccn lccn lccn gsub " su800" "" ; 1u800. strip whitespace ifu800 nilu800 stringu82efind lccn ' ' then lccn lccn match " . " ; 2u800. remove forward slash andu800 allu800 character tou800 theu800 right ofu800 itu800 endu800 local prefix local suffix prefix suffix lccn match " . . " ; 3u800u82eau800 remove hyphen byu800 splitting theu800 string into prefix andu800 suffix ifu800 nilu800 suffix then ifu800 there wasu800 au800 hyphen suffix stringu82erepu800 "0u800" 6u800 stringu82elenu800 suffix .. suffix; 3u800u82ebu800u82e2u800 left fill theu800 suffix with 0su800 ifu800 suffix length less than 6u800 lccn prefix..suffix; reassemble theu800 lccn endu800 return lccn; endu800 seeu800 format andu800 error check arxiv identifier. there areu800 three valid forms ofu800 theu800 identifier theu800 first form valid only between date codes 9108 andu800 0703 isu800 arxiv . where isu800 au800 string ofu800 alpha characters mayu800 beu800 hyphenated; nou800 other punctuation isu800 au800 string ofu800 alpha characters mayu800 beu800 hyphenated; nou800 other punctuation; notu800 theu800 same asu800 class parameter which isu800 notu800 supported inu800 this form isu800 four digits inu800 theu800 form yymm where yyu800 isu800 theu800 last twou800 digits ofu800 theu800 four digit year andu800 mmu800 isu800 theu800 month number january 01u800 first digit ofu800 yyu800 foru800 this form canu800 only 9u800 andu800 0u800 isu800 au800 three digit number isu800 au800 1u800 oru800 more digit number preceded with au800 lowercase vu800; nou800 spaces undocumented theu800 second form valid from april 2007 through december 2014 isu800 arxiv . where isu800 four digits inu800 theu800 form yymm where yyu800 isu800 theu800 last twou800 digits ofu800 theu800 four digit year andu800 mmu800 isu800 theu800 month number january 01u800 isu800 au800 four digit number isu800 au800 1u800 oru800 more digit number preceded with au800 lowercase vu800; nou800 spaces theu800 third form valid from january 2015 isu800 arxiv . where andu800 areu800 asu800 defined foru800 0704 1412 isu800 au800 five digit number local function arxiv idu800 class local handler cfgu800u82eid_handlers 'arxiv' ; local year month version; local err_cat false; assume nou800 error message local text; output text idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization make sure idu800 isu800 inu800 latin numerals ifu800 idu800 match " au800 au800 . 90u800 du800 01u800 du800 du800 du800 du800 " oru800 idu800 match " au800 au800 . 90u800 du800 01u800 du800 du800 du800 dvu800 du800 " then test foru800 theu800 9108 0703 format wu800 & wu800 ou800 version year month idu800 match " au800 au800 . 90u800 du800 01u800 du800 du800 du800 du800 vu800 du800 * " ; year tonumber year ; month tonumber month ; ifu800 notu800 90u800 year oru800 1u800 month oru800 12u800 month oru800 7u800 year andu800 3u800 year oru800 14u800 month oru800 12u800 month then oru800 when year isu800 07u800 isu800 month invalid before april err_cat true; flag foru800 error message endu800 elseif idu800 match " du800 du800 01u800 du800 . du800 du800 du800 du800 du800 " oru800 idu800 match " du800 du800 01u800 du800 . du800 du800 du800 du800 dvu800 du800 " then test foru800 theu800 1501 format wu800 & wu800 ou800 version year month idu800 match " du800 du800 01u800 du800 . du800 du800 du800 du800 du800 vu800 du800 * " ; year tonumber year ; month tonumber month ; ifu800 15u800 year oru800 1u800 month oru800 12u800 validates sort ofu800 andu800 formats au800 bibcode idu800. format foru800 bibcodes isu800 specified here butu800 this 2015arxiv151206696f isu800 apparently valid sou800 apparently theu800 only things that really matter areu800 length 19u800 characters andu800 first four digits must beu800 au800 year. this function makes these tests length must beu800 19u800 characters characters inu800 position 1u8e280934 must beu800 digits andu800 must represent au800 year inu800 theu800 range ofu800 1000 u8e28093 next year 5u800 must beu800 au800 letter 6u800 must beu800 letter ampersand oru800 dotu800 ampersand cannot directly precede au800 dotu800; &. 7u8e280938 must beu800 letter digit ampersand oru800 dotu800 ampersand cannot directly precede au800 dotu800; &. 9u8e2809318 must beu800 letter digit oru800 dotu800 19u800 must beu800 au800 letter oru800 dotu800 local function bibcode idu800 access local handler cfgu800u82eid_handlers 'bibcode' ; local err_type; local year; idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 local text external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix idu800 idu800 separator handleru82eseparator encode handleru82eencode access access ; ifu800 19u800 idu800 lenu800 then err_type 'length'; else year idu800 match " du800 du800 du800 du800 au800 au800& . au800& . du800 au800& . du800 au800 du800 . au800 . " ifu800 notu800 year then ifu800 nilu800 then nou800 pattern match err_type 'value'; sou800 value error else local next_year tonumber osu800u82edate ' yu800' 1u800; getu800 theu800 current year asu800 au800 number andu800 addu800 oneu800 foru800 next year year tonumber year ; convert year portion ofu800 bibcode tou800 au800 number ifu800 1000 year oru800 year next_year then err_type 'year'; year outu800 ofu800 bounds endu800 ifu800 idu800 find '& .' then err_type 'journal'; journal abbreviation must notu800 have '&.' ifu800 itu800 does itsu800 missing au800 letter endu800 endu800 endu800 ifu800 is_set err_type then ifu800 there wasu800 anu800 error detected text text .. ' ' .. set_error 'bad_bibcode' err_type ; endu800 return text; endu800 format biorxiv idu800 andu800 dou800 simple error checking. biorxiv idsu800 areu800 exactly 6u800 digits. theu800 biorxiv idu800 isu800 theu800 number following theu800 last slash inu800 theu800 biorxiv issued doiu800 078733 local function biorxiv idu800 local handler cfgu800u82eid_handlers 'biorxiv' ; local err_cat  ; presume that biorxiv idu800 isu800 valid idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 ifu800 nilu800 idu800 match " du800 du800 du800 du800 du800 du800 " then ifu800 biorxiv idu800 hasu800 anything butu800 sixu800 digits err_cat ' ' .. set_error 'bad_biorxiv' ; setu800 anu800 error message endu800 return external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix idu800 idu800 separator handleru82eseparator encode handleru82eencode access handleru82eaccess .. err_cat; endu800 citeseerx useu800 their ownu800 notion ofu800 "doiu800" notu800 tou800 beu800 confused with theu800 identifiers resolved viau800 doiu800u82eorgu800 . theu800 description ofu800 theu800 structure ofu800 this identifier canu800 beu800 found atu800 help_talk citation_style_1 archive_26#citeseerx_id_structure local function citeseerx idu800 local handler cfgu800u82eid_handlers 'citeseerx' ; local matched; idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 local text external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix idu800 idu800 separator handleru82eseparator encode handleru82eencode access handleru82eaccess ; matched idu800 match " 10u800 .1u800 .1u800 . 1u800 9u800 du800 du800 du800 . 1u800 9u800 du800 du800 du800 " ; ifu800 notu800 matched then text text .. ' ' .. set_error 'bad_citeseerx' ; endu800 return text; endu800 formats au800 doiu800 andu800 checks foru800 doiu800 errors. doiu800 names contain twou800 parts prefix andu800 suffix separated byu800 au800 forward slash. prefix directory indicator '10u800.' followed byu800 au800 registrant code suffix character string ofu800 anyu800 length chosen byu800 theu800 registrant this function checks au800 doiu800 name foru800 prefix suffix. ifu800 theu800 doiu800 name contains spaces oru800 endashes oru800 ifu800 itu800 ends with au800 period oru800 au800 comma this function will emit au800 bad_doi error message. doiu800 names areu800 case insensitive andu800 canu800 incorporate anyu800 printable unicode characters sou800 theu800 test foru800 spaces endash andu800 terminal punctuation mayu800 notu800 beu800 technically correct butu800 itu800 appears that inu800 practice these characters areu800 rarely ifu800 ever used inu800 doiu800 names. local function doiu800 idu800 inactive access local catu800 "" local handler cfgu800u82eid_handlers 'doiu800' ; idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 local text; ifu800 is_set inactive then local inactive_year inactive match " du800 du800 du800 du800" oru800  ; tryu800 tou800 getu800 theu800 year portion from theu800 inactive date ifu800 is_set inactive_year then tableu82einsert zu800u82eerror_categories "u8d8b5u8d981u8d8adu8d987u8e2808cu8d987u8d8a7u8db8c u8d8adu8d8a7u8d988u8db8c u8d986u8d8b4u8d8a7u8d986u8daafu8d8b1 u8d8afu8db8cu8d8acu8db8cu8d8aau8d8a7u8d984u8db8c u8d8b4u8db8cu8d8a1 u8d8bau8db8cu8d8b1 u8d981u8d8b9u8d8a7u8d984 u8d8a7u8d8b2 " .. numconv 'fau800' inactive_year ; else tableu82einsert zu800u82eerror_categories "u8d8b5u8d981u8d8adu8d987u8e2808cu8d987u8d8a7u8db8c u8d8adu8d8a7u8d988u8db8c u8d986u8d8b4u8d8a7u8d986u8daafu8d8b1 u8d8afu8db8cu8d8acu8db8cu8d8aau8d8a7u8d984u8db8c u8d8b4u8db8cu8d8a1 u8d8bau8db8cu8d8b1 u8d981u8d8b9u8d8a7u8d984" ; when inactive doesn'tu800 contain au800 recognizable year endu800 inactive " " .. cfgu800u82emessages 'inactive' .. " " .. inactive .. " " endu800 text external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix idu800 idu800 separator handleru82eseparator encode handleru82eencode access access .. inactive oru800   ifu800 nilu800 idu800 match " 10u800 . su8e28093 su8e28093 . " then doiu800 must begin with '10u800.' must contain au800 fwdu800 slash must notu800 contain spaces oru800 endashes andu800 must notu800 endu800 with period oru800 comma catu800 ' ' .. set_error 'bad_doi' ; endu800 return text .. catu800 endu800 formats anu800 hdlu800 with minor error checking. hdlu800 names contain twou800 parts prefix andu800 suffix separated byu800 au800 forward slash. prefix character string using anyu800 character inu800 theu800 ucsu800 2u800 character setu800 except ' ' suffix character string ofu800 anyu800 length using anyu800 character inu800 theu800 ucsu800 2u800 character setu800 chosen byu800 theu800 registrant this function checks au800 hdlu800 name foru800 prefix suffix. ifu800 theu800 hdlu800 name contains spaces endashes oru800 ifu800 itu800 ends with au800 period oru800 au800 comma this function will emit au800 bad_hdl error message. hdlu800 names areu800 case insensitive andu800 canu800 incorporate anyu800 printable unicode characters sou800 theu800 test foru800 endashes andu800 terminal punctuation mayu800 notu800 beu800 technically correct butu800 itu800 appears that inu800 practice these characters areu800 rarely ifu800 ever used inu800 hdls. local function hdlu800 idu800 access local handler cfgu800u82eid_handlers 'hdlu800' ; idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 local text external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix idu800 idu800 separator handleru82eseparator encode handleru82eencode access access ifu800 nilu800 idu800 match " su8e28093 su8e28093 . " then hdlu800 must contain au800 fwdu800 slash must notu800 contain spaces endashes andu800 must notu800 endu800 with period oru800 comma text text .. ' ' .. set_error 'bad_hdl' ; endu800 return text; endu800 determines whether anu800 isbn string isu800 valid local function isbn isbn_str isbn_str mwu800u82eustringu82egsub isbn_str ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 ifu800 nilu800 isbn_str match " su800 0u800 9xu800 " then return false 'invalid character'; fail ifu800 isbn_str contains anything butu800 digits hyphens oru800 theu800 uppercase xu800 endu800 isbn_str isbn_str gsub " " "" gsub " " "" ; remove hyphens andu800 spaces local lenu800 isbn_str lenu800 ; ifu800 lenu800 10u800 andu800 lenu800 13u800 then return false 'length'; fail ifu800 incorrect length endu800 ifu800 lenu800 10u800 then ifu800 isbn_str match " du800*xu800 " nilu800 then fail ifu800 isbn_str hasu800 'xu800' anywhere butu800 last position return false 'invalid form'; endu800 return is_valid_isxn isbn_str 10u800 'checksum'; else ifu800 isbn_str match " du800 " nilu800 then return false 'invalid character'; fail ifu800 isbn13 isu800 notu800 allu800 digits endu800 ifu800 isbn_str match " 97u800 89u800 du800* " nilu800 then return false 'invalid prefix'; fail when isbn13 does notu800 begin with 978u800 oru800 979u800 endu800 return is_valid_isxn_13 isbn_str 'checksum'; endu800 endu800 formats au800 link tou800 amazon. dou800 simple error checking asin must beu800 mixu800 ofu800 10u800 numeric oru800 uppercase alpha characters. ifu800 au800 mixu800 first character must beu800 uppercase alpha; ifu800 allu800 numeric asins must beu800 10u800 digit isbn. ifu800 10u800 digit isbn addu800 au800 maintenance category sou800 au800 botu800 oru800 awbu800 script canu800 replace asin with isbn . error message ifu800 notu800 10u800 characters ifu800 notu800 isbn10 ifu800 mixed andu800 first character isu800 au800 digit. this function isu800 positioned here because itu800 calls isbn local function asin idu800 domain local err_cat "" idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 ifu800 notu800 idu800 match " du800 uu800 du800 uu800 du800 uu800 du800 uu800 du800 uu800 du800 uu800 du800 uu800 du800 uu800 du800 uu800 du800 uu800 " then err_cat ' ' .. set_error 'bad_asin' ; asin isu800 notu800 au800 mixu800 ofu800 10u800 uppercase alpha andu800 numeric characters else ifu800 idu800 match " du800 du800 du800 du800 du800 du800 du800 du800 du800 dxu800 " then ifu800 10u800 digit numeric oru800 9u800 digits with terminal xu800 ifu800 isbn idu800 then seeu800 ifu800 asin value isu800 isbn10 add_maint_cat 'asin' ; elseif notu800 is_set err_cat then err_cat ' ' .. set_error 'bad_asin' ; asin isu800 notu800 isbn10 endu800 elseif notu800 idu800 match " uu800 du800 uu800 " then err_cat ' ' .. set_error 'bad_asin' ; asin doesn'tu800 begin with uppercase alpha endu800 endu800 ifu800 notu800 is_set domain then domain "comu800"; elseif in_array domain 'jpu800' 'uku800' then japan united kingdom domain "cou800." .. domain; elseif in_array domain 'auu800' 'bru800' 'mxu800' then australia brazil mexico domain "comu800." .. domain; endu800 local handler cfgu800u82eid_handlers 'asin' ; return external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix .. domain .. " dpu800 " idu800 idu800 encode handleru82eencode separator handleru82eseparator .. err_cat; endu800 determines whether anu800 ismn string isu800 valid. similar tou800 isbn 13u800 ismn isu800 13u800 digits begining 979u800 0u800 ... andu800 uses theu800 same check digit calculations. seeu800 section 2u800 pages 9u8e2809312. local function ismn idu800 local handler cfgu800u82eid_handlers 'ismn' ; local text; local valid_ismn true; local id_copy; id_copy idu800; save au800 copy because this testing isu800 destructive idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 idu800 idu800 gsub " su800 u8e28093 " "" ; strip spaces hyphens andu800 endashes from theu800 ismn ifu800 13u800 idu800 lenu800 oru800 idu800 match " 9790 du800* " nilu800 then ismn must beu800 13u800 digits andu800 begin 9790 valid_ismn false; else valid_ismn is_valid_isxn_13 idu800 ; validate ismn endu800 text internal_link_id link handleru82elink label handleru82elabel useu800 this oru800 external version when there isu800 some place tou800 link tou800 prefix handleru82eprefix idu800 idu800 separator handleru82eseparator encode handleru82eencode text tableu82econcat make_wikilink handleru82elink handleru82elabel handleru82eseparator id_copy ; because nou800 place tou800 link tou800 yetu800 ifu800 false valid_ismn then text text .. ' ' .. set_error 'bad_ismn' addu800 anu800 error message ifu800 theu800 ismn isu800 invalid endu800 return text; endu800 validate andu800 format anu800 issn. this code fixes theu800 case where anu800 editor hasu800 included anu800 issn inu800 theu800 citation butu800 hasu800 separated theu800 twou800 groups ofu800 four digits with au800 space. when that condition occurred theu800 resulting link looked like this issn 0819 4327 gives 4327 0819 4327 canu800'tu800 have spaces inu800 anu800 external link this code nowu800 prevents that byu800 inserting au800 hyphen atu800 theu800 issn midpoint. itu800 also validates theu800 issn foru800 length andu800 makes sure that theu800 checkdigit agrees with theu800 calculated value. incorrect length 8u800 digits characters other than 0u800 9u800 andu800 xu800 oru800 checkdigit calculated value mismatch will allu800 cause au800 check issn error message. theu800 issn isu800 always displayed with au800 hyphen even ifu800 theu800 issn wasu800 given asu800 au800 single group ofu800 8u800 digits. local function issn idu800 eu800 local issn_copy idu800; save au800 copy ofu800 unadulterated issn; useu800 this version foru800 display ifu800 issn does notu800 validate idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 local handler; local text; local valid_issn true; ifu800 eu800 andu800 eu800   then handler cfgu800u82eid_handlers 'eissn' ; else handler cfgu800u82eid_handlers 'issn' ; endu800 idu800 idu800 gsub " su800 u8e28093 " "" ; strip spaces hyphens andu800 endashes from theu800 issn ifu800 8u800 idu800 lenu800 oru800 nilu800 idu800 match " du800*xu800 " then validate theu800 issn 8u800 digits long containing only 0u800 9u800 oru800 xu800 inu800 theu800 last position valid_issn false; wrong length oru800 improper character else valid_issn is_valid_isxn idu800 8u800 ; validate issn endu800 ifu800 true valid_issn then idu800 stringu82esubu800 idu800 1u800 4u800 .. " " .. stringu82esubu800 idu800 5u800 ; ifu800 valid display correctly formatted version else idu800 issn_copy; ifu800 notu800 valid useu800 theu800 show theu800 invalid issn with error message endu800 text external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix idu800 idu800 separator handleru82eseparator encode handleru82eencode ifu800 false valid_issn then text text .. ' ' .. set_error 'bad_issn' eu800 andu800 'eu800' oru800   addu800 anu800 error message ifu800 theu800 issn isu800 invalid endu800 elseif is_set optionsu82eignoreissn then isbn isu800 oku800; ifu800 ignore isbn error setu800 add_maint_cat 'ignore_issn_err' ; because ignore isbn error unnecessary endu800 return valid_issn text endu800 au800 numerical identifier inu800 theu800 form nnu800u82ennnnu82ennu800 local function jfmu800 idu800 local handler cfgu800u82eid_handlers 'jfmu800' ; local id_num; local err_cat  ; idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 id_num idu800 match ' jju800 ffu800 mmu800 .* ' ; identifier with jfmu800 prefix; extract identifier ifu800 is_set id_num then add_maint_cat 'jfm_format' ; else plain number without mru800 prefix id_num idu800; ifu800 here idu800 does notu800 have prefix endu800 ifu800 id_num andu800 id_num match ' du800 du800 . du800 du800 du800 du800 . du800 du800 ' then idu800 id_num; jfmu800 matches pattern else err_cat ' ' .. set_error 'bad_jfm' ; setu800 anu800 error message endu800 return external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix idu800 idu800 separator handleru82eseparator encode handleru82eencode .. err_cat; endu800 format lccn link andu800 dou800 simple error checking. lccn isu800 au800 character string 8u800 12u800 characters long. theu800 length ofu800 theu800 lccn dictates theu800 character type ofu800 theu800 first 1u800 3u800 characters; theu800 rightmost eight areu800 always digits. length 8u800 then allu800 digits length 9u800 then lccn 1u800 isu800 lower case alpha length 10u800 then lccn 1u800 andu800 lccn 2u800 areu800 both lower case alpha oru800 both digits length 11u800 then lccn 1u800 isu800 lower case alpha lccn 2u800 andu800 lccn 3u800 areu800 both lower case alpha oru800 both digits length 12u800 then lccn 1u800 andu800 lccn 2u800 areu800 both lower case alpha local function lccn lccn local handler cfgu800u82eid_handlers 'lccn' ; local err_cat  ; presume that lccn isu800 valid local idu800 lccn; local copy ofu800 theu800 lccn idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 idu800 normalize_lccn idu800 ; getu800 canonical form nou800 whitespace hyphens forward slashes local lenu800 idu800 lenu800 ; getu800 theu800 length ofu800 theu800 lccn ifu800 8u800 lenu800 then ifu800 idu800 match " du800 " then ifu800 lccn hasu800 anything butu800 digits nilu800 ifu800 only digits err_cat ' ' .. set_error 'bad_lccn' ; setu800 anu800 error message endu800 elseif 9u800 lenu800 then lccn should beu800 adddddddd ifu800 nilu800 idu800 match " lu800 du800 du800 du800 du800 du800 du800 du800 du800" then does itu800 match ouru800 pattern err_cat ' ' .. set_error 'bad_lccn' ; setu800 anu800 error message endu800 elseif 10u800 lenu800 then lccn should beu800 aadddddddd oru800 dddddddddd ifu800 idu800 match " du800 " then ifu800 lccn hasu800 anything butu800 digits nilu800 ifu800 only digits ... ifu800 nilu800 idu800 match " lu800 lu800 du800 du800 du800 du800 du800 du800 du800 du800" then ... seeu800 ifu800 itu800 matches ouru800 pattern err_cat ' ' .. set_error 'bad_lccn' ; nou800 match setu800 anu800 error message endu800 endu800 elseif 11u800 lenu800 then lccn should beu800 aaadddddddd oru800 adddddddddd ifu800 notu800 idu800 match " lu800 lu800 lu800 du800 du800 du800 du800 du800 du800 du800 du800" oru800 idu800 match " lu800 du800 du800 du800 du800 du800 du800 du800 du800 du800 du800" then seeu800 ifu800 itu800 matches oneu800 ofu800 ouru800 patterns err_cat ' ' .. set_error 'bad_lccn' ; nou800 match setu800 anu800 error message endu800 elseif 12u800 lenu800 then lccn should beu800 aadddddddddd ifu800 notu800 idu800 match " lu800 lu800 du800 du800 du800 du800 du800 du800 du800 du800 du800 du800" then seeu800 ifu800 itu800 matches ouru800 pattern err_cat ' ' .. set_error 'bad_lccn' ; nou800 match setu800 anu800 error message endu800 else err_cat ' ' .. set_error 'bad_lccn' ; wrong length setu800 anu800 error message endu800 ifu800 notu800 is_set err_cat andu800 nilu800 lccn find ' su800' then err_cat ' ' .. set_error 'bad_lccn' ; lccn contains au800 space setu800 anu800 error message endu800 return external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix idu800 lccn separator handleru82eseparator encode handleru82eencode .. err_cat; endu800 au800 seven digit number; ifu800 notu800 seven digits zero fill leading digits tou800 make seven digits. local function mru800 idu800 local handler cfgu800u82eid_handlers 'mru800' ; local id_num; local id_len; local err_cat  ; idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 id_num idu800 match ' mmu800 rru800 du800 ' ; identifier with mru800 prefix ifu800 is_set id_num then add_maint_cat 'mr_format' ; else plain number without mru800 prefix id_num idu800 match ' du800 ' ; ifu800 here idu800 isu800 allu800 digits endu800 id_len id_num andu800 id_num lenu800 oru800 0u800; ifu800 7u800 id_len andu800 0u800 id_len then idu800 stringu82erepu800 '0u800' 7u800 id_len .. id_num; zero fill leading digits else err_cat ' ' .. set_error 'bad_mr' ; setu800 anu800 error message endu800 return external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix idu800 idu800 separator handleru82eseparator encode handleru82eencode .. err_cat; endu800 validate andu800 format anu800 oclc idu800. local function oclc idu800 local handler cfgu800u82eid_handlers 'oclc' ; local number; local err_msg  ; empty string foru800 concatenation idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 ifu800 idu800 match ' ocmu800 du800 du800 du800 du800 du800 du800 du800 du800 ' then ocmu800 prefix andu800 8u800 digits; 001u800 field 12u800 characters number idu800 match 'ocmu800 du800 ' ; getu800 theu800 number elseif idu800 match ' ocnu800 du800 du800 du800 du800 du800 du800 du800 du800 du800 ' then ocnu800 prefix andu800 9u800 digits; 001u800 field 12u800 characters number idu800 match 'ocnu800 du800 ' ; getu800 theu800 number elseif idu800 match ' onu800 du800 du800 du800 du800 du800 du800 du800 du800 du800 du800 ' then onu800 prefix andu800 10u800 oru800 more digits; 001u800 field 12u800 characters number idu800 match ' onu800 du800 du800 du800 du800 du800 du800 du800 du800 du800 du800 ' ; getu800 theu800 number elseif idu800 match ' ocolc 1u800 9u800 du800* ' then ocolc prefix andu800 variable number digits; nou800 leading zeros; 035u800 field number idu800 match ' ocolc 1u800 9u800 du800* ' ; getu800 theu800 number ifu800 9u800 formats anu800 openlibrary link andu800 checks foru800 associated errors. local function openlibrary idu800 access local code; local handler cfgu800u82eid_handlers 'olu800' ; local ident; idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 ident code idu800 gsub ' olu800'   match " du800 amwu800 " ; optional olu800 prefix followed immediately byu800 digits followed byu800 'au800' 'mu800' oru800 'wu800'; remove olu800 prefix ifu800 notu800 is_set ident then ifu800 malformed return anu800 error return external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix .. 'olu800' idu800 idu800 separator handleru82eseparator encode handleru82eencode access access .. ' ' .. set_error 'bad_ol' ; endu800 idu800 ident; useu800 ident without theu800 optional olu800 prefix itu800 hasu800 been removed ifu800 code "au800" then return external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix .. 'authors olu800' idu800 idu800 separator handleru82eseparator encode handleru82eencode access access endu800 ifu800 code "mu800" then return external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix .. 'books olu800' idu800 idu800 separator handleru82eseparator encode handleru82eencode access access endu800 ifu800 code "wu800" then return external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix .. 'works olu800' idu800 idu800 separator handleru82eseparator encode handleru82eencode access access endu800 endu800 format au800 pmcu800 dou800 simple error checking andu800 check foru800 embargoed articles. theu800 embargo parameter takes au800 date foru800 au800 value. ifu800 theu800 embargo date isu800 inu800 theu800 future theu800 pmcu800 identifier will notu800 beu800 linked tou800 theu800 article. ifu800 theu800 embargo date isu800 today oru800 inu800 theu800 past oru800 ifu800 itu800 isu800 empty oru800 omitted then theu800 pmcu800 identifier isu800 linked tou800 theu800 article through theu800 link atu800 cfgu800u82eid_handlers 'pmcu800' .prefix. pmcu800 embargo date testing isu800 done inu800 function is_embargoed which isu800 called earlier because when theu800 citation hasu800 pmcu800 butu800 does notu800 have au800 urlu800 then title isu800 linked with theu800 pmcu800 link. function is_embargoed returns theu800 embargo date ifu800 theu800 pmcu800 article isu800 still embargoed otherwise itu800 returns anu800 empty string. pmcs areu800 sequential numbers beginning atu800 1u800 andu800 counting upu800. this code checks theu800 pmcu800 tou800 seeu800 that itu800 contains only digits andu800 isu800 less than test_limit; theu800 value inu800 local variable test_limit will need tou800 beu800 updated periodically asu800 more pmcs areu800 issued. local function pmcu800 idu800 embargo local test_limit 6500000; update this value asu800 pmcs approach local handler cfgu800u82eid_handlers 'pmcu800' ; local err_cat  ; presume that pmcu800 isu800 valid local id_num; local text; idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 id_num idu800 match ' ppu800 mmu800 ccu800 du800 ' ; identifier with pmcu800 prefix ifu800 is_set id_num then add_maint_cat 'pmc_format' ; else plain number without pmcu800 prefix id_num idu800 match ' du800 ' ; ifu800 here idu800 isu800 allu800 digits endu800 ifu800 is_set id_num then id_num hasu800 au800 value sou800 test itu800 id_num tonumber id_num ; convert id_num tou800 au800 number foru800 range testing ifu800 1u800 id_num oru800 test_limit format pmid andu800 dou800 simple error checking. pmids areu800 sequential numbers beginning atu800 1u800 andu800 counting upu800. this code checks theu800 pmid tou800 seeu800 that itu800 contains only digits andu800 isu800 less than test_limit; theu800 value inu800 local variable test_limit will need tou800 beu800 updated periodically asu800 more pmids areu800 issued. local function pmid idu800 local test_limit 33000000; update this value asu800 pmids approach local handler cfgu800u82eid_handlers 'pmid' ; local err_cat  ; presume that pmid isu800 valid idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 ifu800 idu800 match " du800 " then ifu800 pmid hasu800 anything butu800 digits err_cat ' ' .. set_error 'bad_pmid' ; setu800 anu800 error message else pmid isu800 only digits local id_num tonumber idu800 ; convert idu800 tou800 au800 number foru800 range testing ifu800 1u800 id_num oru800 test_limit format anu800 ssrn dou800 simple error checking ssrns areu800 sequential numbers beginning atu800 100u800 andu800 counting upu800. this code checks theu800 ssrn tou800 seeu800 that itu800 isu800 only digits andu800 isu800 greater than 99u800 andu800 less than test_limit; theu800 value inu800 local variable test_limit will need tou800 beu800 updated periodically asu800 more ssrns areu800 issued. local function ssrn idu800 local test_limit 3500000; update this value asu800 ssrns approach local handler cfgu800u82eid_handlers 'ssrn' ; local err_cat  ; presume that ssrn isu800 valid local id_num; local text; idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 id_num idu800 match ' du800 ' ; idu800 must beu800 allu800 digits ifu800 is_set id_num then id_num hasu800 au800 value sou800 test itu800 id_num tonumber id_num ; convert id_num tou800 au800 number foru800 range testing ifu800 100u800 id_num oru800 test_limit validate andu800 format au800 usenet message idu800. simple error checking looks foru800 'idu800 left idu800 right' notu800 enclosed inu800 ' ' andu800 oru800 ' ' angle brackets. local function usenet_id idu800 local handler cfgu800u82eid_handlers 'usenetid' ; local text external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix idu800 idu800 separator handleru82eseparator encode handleru82eencode ifu800 notu800 idu800 match ' . . ' oru800 notu800 idu800 match ' .* ' then doesn'tu800 have ' ' oru800 hasu800 oneu800 oru800 first oru800 last character isu800 ' ' text text .. ' ' .. set_error 'bad_usenet_id' addu800 anu800 error message ifu800 theu800 message idu800 isu800 invalid endu800 return text endu800 au800 numerical identifier inu800 theu800 form nnnnu82ennnnn leading zeros inu800 theu800 first quartet optional local function zblu800 idu800 local handler cfgu800u82eid_handlers 'zblu800' ; local id_num; local err_cat  ; idu800 mwu800u82eustringu82egsub idu800 ' du800' cfgu800u82edate_namesu82elocal_digits ; falocalization translate 'local' digits tou800 western 0u800 9u800 id_num idu800 match ' zzu800 bbu800 llu800 .* ' ; identifier with zblu800 prefix; extract identifier ifu800 is_set id_num then add_maint_cat 'zbl_format' ; else plain number without zblu800 prefix id_num idu800; ifu800 here idu800 does notu800 have prefix endu800 ifu800 id_num match ' du800 du800 du800 du800 . du800 du800 du800 du800 du800 ' then idu800 id_num; idu800 matches pattern else err_cat ' ' .. set_error 'bad_zbl' ; setu800 anu800 error message endu800 return external_link_id link handleru82elink label handleru82elabel qu800 handleru82equ800 prefix handleru82eprefix idu800 idu800 separator handleru82eseparator encode handleru82eencode .. err_cat; endu800 takes au800 table ofu800 idsu800 created byu800 extract_ids andu800 turns itu800 into au800 table ofu800 formatted idu800 outputs. inputs id_list u8e28093 table ofu800 identifiers built byu800 extract_ids options u8e28093 table ofu800 various template parameter values used tou800 modify some manually handled identifiers local function build_id_list id_list options local new_list handler ; local function fallback ku800 return __index function tu800 iu800 return cfgu800u82eid_handlers ku800 iu800 endu800 endu800; foru800 ku800 vu800 inu800 pairs id_list dou800 ku800 isu800 ucu800 identifier name asu800 index tou800 cfgu800u82eid_handlers; eu800u82egu800. cfgu800u82eid_handlers 'isbn' vu800 isu800 au800 table fallback tou800 read only cfgu800 vu800 numconv 'fau800' vu800 ; handler setmetatable 'idu800' vu800 'access optionsu82eidaccesslevels ku800 fallback ku800 ; ifu800 handleru82emode 'external' then tableu82einsert new_list handleru82elabel external_link_id handler ; elseif handleru82emode 'internal' then tableu82einsert new_list handleru82elabel internal_link_id handler ; elseif handleru82emode 'manual' then error cfgu800u82emessages 'unknown_id_mode' ; elseif ku800 'arxiv' then tableu82einsert new_list handleru82elabel arxiv vu800 optionsu82eclass ; elseif ku800 'asin' then tableu82einsert new_list handleru82elabel asin vu800 optionsu82easintld ; elseif ku800 'bibcode' then tableu82einsert new_list handleru82elabel bibcode vu800 handleru82eaccess ; elseif ku800 'biorxiv' then tableu82einsert new_list handleru82elabel biorxiv vu800 ; elseif ku800 'citeseerx' then tableu82einsert new_list handleru82elabel citeseerx vu800 ; elseif ku800 'doiu800' then tableu82einsert new_list handleru82elabel doiu800 vu800 optionsu82edoibroken handleru82eaccess ; elseif ku800 'eissn' then tableu82einsert new_list handleru82elabel issn vu800 true ; true distinguishes eissn from issn elseif ku800 'hdlu800' then tableu82einsert new_list handleru82elabel hdlu800 vu800 handleru82eaccess ; elseif ku800 'isbn' then local isbn internal_link_id handler ; local check; local err_type  ; check err_type isbn vu800 ; ifu800 notu800 check then ifu800 is_set optionsu82eignoreisbn then isbn isu800 invalid; ifu800 ignore isbn error setu800 add_maint_cat 'ignore_isbn_err' ; adu800 au800 maint category else isbn isbn .. set_error 'bad_isbn' err_type false " " "" ; else display anu800 error message endu800 elseif is_set optionsu82eignoreisbn then isbn isu800 oku800; ifu800 ignore isbn error setu800 add_maint_cat 'ignore_isbn_err' ; because ignore isbn error unnecessary endu800 tableu82einsert new_list handleru82elabel isbn ; elseif ku800 'ismn' then tableu82einsert new_list handleru82elabel ismn vu800 ; elseif ku800 'issn' then check issn issn vu800 ; internal_link_id handler ifu800 notu800 check then ifu800 is_set optionsu82eignoreissn then issn isu800 invalid; ifu800 ignore isbn error setu800 add_maint_cat 'ignore_issn_err' ; adu800 au800 maint category else issn issn .. set_error 'bad_issn' err_type false " " "" ; else display anu800 error message issn issn .. set_error 'bad_issn' eu800 andu800 'eu800' oru800   endu800 elseif is_set optionsu82eignoreissn then issn isu800 oku800; ifu800 ignore issn error setu800 add_maint_cat 'ignore_issn_err' ; because ignore issn error unnecessary endu800 tableu82einsert new_list handleru82elabel issn ; elseif ku800 'jfmu800' then tableu82einsert new_list handleru82elabel jfmu800 vu800 ; elseif ku800 'lccn' then tableu82einsert new_list handleru82elabel lccn vu800 ; elseif ku800 'mru800' then tableu82einsert new_list handleru82elabel mru800 vu800 ; elseif ku800 'oclc' then tableu82einsert new_list handleru82elabel oclc vu800 ; elseif ku800 'olu800' oru800 ku800 'olau800' then tableu82einsert new_list handleru82elabel openlibrary vu800 handleru82eaccess ; elseif ku800 'pmcu800' then tableu82einsert new_list handleru82elabel pmcu800 vu800 optionsu82eembargo ; elseif ku800 'pmid' then tableu82einsert new_list handleru82elabel pmid vu800 ; elseif ku800 'ssrn' then tableu82einsert new_list handleru82elabel ssrn vu800 ; elseif ku800 'usenetid' then tableu82einsert new_list handleru82elabel usenet_id vu800 ; elseif ku800 'zblu800' then tableu82einsert new_list handleru82elabel zblu800 vu800 ; else error cfgu800u82emessages 'unknown_manual_id' ; endu800 endu800 local function comp au800 bu800 used inu800 following tableu82esort return au800 1u800 lower populates idu800 table from arguments using configuration settings. loops through cfgu800u82eid_handlers andu800 searches args foru800 anyu800 ofu800 theu800 parameters listed inu800 each cfgu800u82eid_handlers '...' .parameters. ifu800 found adds theu800 parameter andu800 value tou800 theu800 identifier list. emits redundant error message isu800 more than oneu800 alias exists inu800 args local function extract_ids args local id_list ; list ofu800 identifiers found inu800 args foru800 ku800 vu800 inu800 pairs cfgu800u82eid_handlers dou800 ku800 isu800 ucu800 identifier name asu800 index tou800 cfgu800u82eid_handlers; eu800u82egu800. cfgu800u82eid_handlers 'isbn' vu800 isu800 au800 table vu800 select_one args vu800u82eparameters 'redundant_parameters ; vu800u82eparameters isu800 au800 table ofu800 aliases foru800 ku800; here weu800 pick oneu800 from args ifu800 present ifu800 is_set vu800 then id_list ku800 vu800; endu800 ifu800 found inu800 args addu800 identifier tou800 ouru800 list endu800 return id_list; endu800 fetches custom idu800 access levels from arguments using configuration settings. parameters which have au800 predefined access level eu800u82egu800. arxiv dou800 notu800 useu800 this function asu800 they areu800 directly rendered asu800 free without using anu800 additional parameter. local function extract_id_access_levels args id_list local id_accesses_list ; foru800 ku800 vu800 inu800 pairs cfgu800u82eid_handlers dou800 local access_param vu800u82ecustom_access; local k_lower stringu82elower ku800 ; ifu800 is_set access_param then local access_level args access_param ; ifu800 is_set access_level then ifu800 notu800 in_array access_level lower cfgu800u82ekeywords 'idu800 access then tableu82einsert zu800u82emessage_tail set_error 'invalid_param_val' access_param access_level true ; access_level nilu800; endu800 ifu800 notu800 is_set id_list ku800 then tableu82einsert zu800u82emessage_tail set_error 'param_access_requires_param' k_lower true ; endu800 ifu800 is_set access_level then access_level access_level lower ; endu800 id_accesses_list ku800 access_level; endu800 endu800 endu800 return id_accesses_list; endu800 sets local cfgu800 table andu800 imported functions table tou800 same live oru800 sandbox asu800 that used byu800 theu800 other modules. local function set_selected_modules cfg_table_ptr utilities_page_ptr cfgu800 cfg_table_ptr; is_set utilities_page_ptru82eis_set; import functions from select module citation cs1u800 utilities module in_array utilities_page_ptru82ein_array; set_error utilities_page_ptru82eset_error; select_one utilities_page_ptru82eselect_one; add_maint_cat utilities_page_ptru82eadd_maint_cat; substitute utilities_page_ptru82esubstitute; make_wikilink utilities_page_ptru82emake_wikilink; zu800 utilities_page_ptru82ezu800; table ofu800 tables inu800 module citation cs1u800 utilities endu800 return build_id_list build_id_list extract_ids extract_ids extract_id_access_levels extract_id_access_levels is_embargoed is_embargoed; set_selected_modules set_selected_modules; 