Module:Citation/CS1/Configuration/sandbox: Difference between revisions

Content deleted Content added
No edit summary
+10.'9778'
 
(38 intermediate revisions by 5 users not shown)
Line 1:
--[[
History of changes since last sync: 20242025-0804-1712
 
2025-04-23: add script-lang tkr;
2024-09-11: update emoji zwj table to v16.0; nothing changed except version and date;
2025-04-27: change maint warning message in preveiw box from #3a3 to #085 to match cs1|2 maint message color;
2024-09-17: +script lang code 'az';
2025-05-01: tweak tabular data fetch; see Help_talk:Citation_Style_1#Lua_error%3F
2024-10-16: Add free DOI registrant 10.18637 - Foundation for Open Access Statistic
2025-05-10: maint cat to track {{cite journal}} templates misusing |page= for |article-number=; see Help_talk:Citation_Style_1#|page=_same_value_as_last_n-digits_of_|doi=
2024-11-15: Add free DOI registrant 10.1016/j.proche - Procedia Chemistry
2025-05-26: add 10.1016/j.patter to free DOI prefix recognition (Patterns)
2024-11-23: convert Category:CS1 maint: unfit URL to properties cat Category:CS1: unfit URL; see Help_talk:Citation_Style_1#clean_up_usurped_%2F_unfit_%2F_deviated
20242025-1106-2307: relaxmaint 'HugeDomains'cat genericfor titlepost search2007 arxiv format without |class=; see Help_talk:Citation_Style_1#HugeDomainsCategory%3ACS1_maint%3A_missing_class_%3F
20242025-1106-2511: +scriptadd lang'updated' code:as chrbad author name; see Help_talk:Citation_Style_1#Requested_edit_to_Module:Citation/CS1/ConfigurationAuthor_check
2025-07-29: fix url access parameter application on wikipedia library url errors; see Help_talk:Citation_Style_1#Wikipedia_Library_errors_on_a_talk_page
2025-08-03: Add 10.9778 to free DOI recognition (CMAJ Open)
 
]]
 
 
local lang_obj = mw.language.getContentLanguage(); -- make a language object for the local language; used here for languages and dates
Line 155 ⟶ 158:
['warning_msg_e'] = '<span style="color:#d33">One or more <code style="color: inherit; background: inherit; border: none; padding: inherit;">&#123;{$1}}</code> templates have errors</span>; messages may be hidden ([[Help:CS1_errors#Controlling_error_message_display|help]]).'; -- $1 is template link
['warning_msg_m'] = '<span style="color:#3a3085">One or more <code style="color: inherit; background: inherit; border: none; padding: inherit;">&#123;{$1}}</code> templates have maintenance messages</span>; messages may be hidden ([[Help:CS1_errors#Controlling_error_message_display|help]]).'; -- $1 is template link
}
 
Line 476 ⟶ 479:
local punct_skip = {};
local url_skip = {};
 
 
--[[--------------------------< U R L _ A C C E S S _ M A P >--------------------------------------------------
 
this table used by the wikipedia library url test, has_twl_url(), which automatically sets a url-access parameter
to 'subscription' when it discovers a wikipedia library url in any of the url-holding paramters used as keys in
this table.
 
translators: if your wiki uses parameter names for these url-holding parameters and their matching -access parameters,
add your wiki's parameters to this list. Leave the English parameters in place.
 
TODO: is there a better way to do this?
 
]]
 
local url_access_map_t = {
['chapter-url'] = 'chapter-url-access',
['contribution-url'] = 'contribution-url-access',
['entry-url'] = 'entry-url-access',
['article-url'] = 'article-url-access',
['section-url'] = 'section-url-access',
['map-url'] = 'map-url-access',
['mapurl'] = 'map-url-access',
['url'] = 'url-access',
['URL'] = 'url-access'
}
 
 
Line 593 ⟶ 622:
{['en'] = {'super.?user', false}, ['local'] = nil},
{['en'] = {'%f['..is_Latn..'][Uu]ser%f[^'..is_Latn..']', false}, ['local'] = nil},
{['en'] = {'updated', true}, ['local'] = nil},
{['en'] = {'verfasser', true}, ['local'] = nil},
}
Line 1,177 ⟶ 1,207:
 
local script_lang_codes = {
'ab', 'am', 'ar', 'az', 'be', 'bg', 'bn', 'bo', 'bs', 'ce', 'chr', 'dv', 'dzcu',
'dv', 'dz', 'el', 'fa', 'grc', 'gu', 'he', 'hi', 'hy', 'ja', 'ka', 'kk', 'km', 'kn', 'ko',
'kukm', 'kykn', 'loko', 'mkku', 'mlky', 'mnlo', 'mnimk', 'mrml', 'mymn', 'nemni', 'ormr', 'otamy',
'pane', 'psor', 'ruota', 'sdpa', 'sips', 'srru', 'sycsd', 'tasi', 'tesr', 'tgsyc', 'thta', 'ti', 'ttte',
'tg', 'th', 'ti', 'tkr', 'tt', 'ug', 'uk', 'ur', 'uz', 'yi', 'yue', 'zh',
'zgh'
};
 
Line 1,263 ⟶ 1,294:
['tracked-param'] = 'CS1 tracked parameter: $1', -- $1 is base (enumerators removed) parameter name
['unfit'] = 'CS1: unfit URL', -- |url-status=unfit or |url-status=usurped; used to be a maint cat
['vanc-accept'] = 'CS1:Vancouver names with accept markup', -- for |vauthors=/|veditors= with accept-as-written markup
['year-range-abbreviated'] = 'CS1: abbreviated year range', -- probably temporary cat to identify scope of |date=, |year= values using YYYY–YY form
}
Line 1,306 ⟶ 1,338:
'5315', '5316', '5317', '5318', '5319', '5320', '5321', '5334', '5402', '5409', '5410', '5411', '5412',
'5492', '5493', '5494', '5495', '5496', '5497', '5498', '5499', '5500', '5501', '5527', '5528', '5662',
'6064', '6219', '7167', '7217', '7287', '7482', '7490', '7554', '7717', '7759', '7766', '9778', '11131', '11569', '11647',
'11648', '12688', '12703', '12715', '12942', '12998', '13105', '14256', '14293', '14303', '15215', '15347', '15412', '15560', '16995',
'17645', '18637', '19080', '19173', '20944', '21037', '21468', '21767', '22261', '22323', '22459', '24105', '24196', '24966',
Line 1,319 ⟶ 1,351:
 
local extended_registrants_t = { -- known free registrants identifiable by the doi suffix incipit
['10161002'] = {'j.heliyonaelm', 'j.procheleap'}, -- HeliyonAdvanced Electronic Materials, ProcediaLearned ChemistryPublishing
['1016'] = {'j.heliyon', 'j.nlp', 'j.patter', 'j.proche'}, -- Heliyon, Natural Language Processing, Patterns, Procedia Chemistry
['1017'] = {'nlp'}, -- Natural Language Processing Journal
['1046'] = {'j.1365-8711', 'j.1365-246x'}, -- MNRAS, GJI
['1093'] = {'mnras', 'mnrasl', 'gji', 'rasti'}, -- MNRAS, MNRAS Letters, GJI, RASTI
Line 1,325 ⟶ 1,359:
['1111'] = {'j.1365-2966', 'j.1745-3933', 'j.1365-246X'}, -- MNRAS, MNRAS Letters, GJI
['1210'] = {'jendso','jcemcr'}, -- Journal of the Endocrine Society, JCEM Case Reports
['4171'] = {'dm','mag'}, -- Documenta Mathematica, EMS Magazine
['14231'] = {'ag'}, -- Algebraic Geometry
}
 
Line 1,755 ⟶ 1,791:
category = 'CS1 errors: generic title',
hidden = false,
},
err_invalid_isbn_date = {
message = 'ISBN / Date incompatibility',
anchor = 'invalid_isbn_date',
category = 'CS1 errors: ISBN date',
hidden = true
},
err_invalid_param_val = {
Line 1,814 ⟶ 1,856:
anchor = 'param_has_ext_link',
category = 'CS1 errors: external links',
hidden = false
},
err_param_has_twl_url = {
message = 'Wikipedia Library link in <code class="cs1-code">$1</code>', -- $1 is parameter name
anchor = 'param_has_twl_url',
category = 'CS1 errors: URL',
hidden = false
},
Line 1,991 ⟶ 2,039:
anchor = '___location',
category = 'CS1 maint: ___location',
hidden = true,
},
maint_missing_class = {
message = nil,
anchor = 'missing_class',
category = 'CS1 maint: missing class',
hidden = true,
},
Line 2,027 ⟶ 2,081:
anchor = 'overridden',
category = 'CS1 maint: overridden setting',
hidden = true,
},
maint_page_art_num = {
message = nil,
anchor = 'page_art_num',
category = 'CS1 maint: article number as page number',
hidden = true,
},
Line 2,045 ⟶ 2,105:
anchor = 'postscript',
category = 'CS1 maint: postscript',
hidden = true,
},
maint_publisher_location = {
message = nil,
anchor = 'publisher_location',
category = 'CS1 maint: publisher ___location',
hidden = true,
},
Line 2,092 ⟶ 2,158:
 
The values from <id_limits_data_t> are used to set handle.id_limit.
 
From 2025-02-21, MediaWiki is broken. Use this link to edit the tablular data file:
https://commons.wikimedia.org/w/index.php?title=Data:CS1/Identifier_limits.tab&action=edit
See Phab:T389105
 
]]
 
local id_limits_data_t = {};
local load_fail_limit = 99999999999; -- very high number to avoid error messages on load failure
local id_limits_data_t = {['OCLC'] = load_fail_limit, ['OSTI'] = load_fail_limit, ['PMC'] = load_fail_limit, ['PMID'] = load_fail_limit, ['RFC'] = load_fail_limit, ['SSRN'] = load_fail_limit, ['S2CID'] = load_fail_limit};
local id_limits_data_load_fail = false; -- flag; assume that we will be successful when loading json id limit tabular data
 
local use_commons_data = true; -- set to false if your wiki does not have access to mediawiki commons; then,
local tab_data_t = mw.ext.data.get ('CS1/Identifier limits.tab').data; -- attempt to load the json limit data from commons into <tab_data_t>
if false == tab_data_tuse_commons_data then -- undocumentedupdate 'feature':this mwtable from https://commons.extwikimedia.dataorg/wiki/Data:CS1/Identifier_limits.get()tab; sometimeslast returnsupdate: false2025-02-21
id_limits_data_t = {['OCLC'] = 10450000000, ['OSTI'] = 23010000, ['PMC'] = 11900000, ['PMID'] = 40400000, ['RFC'] = 9300, ['SSRN'] = 5200000, ['S2CID'] = 276000000}; -- this table must be maintained locally
id_limits_data_load_fail = true; -- set the flag so that Module:Citation/CS1 can create an unannotated maint category
 
else
else -- here for wikis that do have access to mediawiki commons
for _, limit_t in ipairs (tab_data_t) do -- overwrite default <load_fail_limit> values
local load_fail_limit = 99999999999; -- very high number to avoid error messages on load failure
id_limits_data_t[limit_t[1]] = limit_t[2]; -- <limit[1]> is identifier; <limit[2]> is upper limit for that identifier
id_limits_data_t = {['OCLC'] = load_fail_limit, ['OSTI'] = load_fail_limit, ['PMC'] = load_fail_limit, ['PMID'] = load_fail_limit, ['RFC'] = load_fail_limit, ['SSRN'] = load_fail_limit, ['S2CID'] = load_fail_limit};
 
local id_limits_data_load_fail = false; -- flag; assume that we will be successful when loading json id limit tabular data
local tab_data_t = mw.ext.data.get ('CS1/Identifier limits.tab'); -- attempt to load the tabular data from commons into <tab_data_t>
if false == tab_data_t then -- undocumented 'feature': mw.ext.data.get() sometimes returns false
id_limits_data_load_fail = true; -- set the flag so that Module:Citation/CS1 can create an unannotated maint category
else
for _, limit_t in ipairs (tab_data_t.data) do -- overwrite default <load_fail_limit> values from the data table in the tabular data
id_limits_data_t[limit_t[1]] = limit_t[2]; -- <limit[1]> is identifier; <limit[2]> is upper limit for that identifier
end
end
end
Line 2,511 ⟶ 2,590:
vol_iss_pg_patterns = vol_iss_pg_patterns,
single_letter_2nd_lvl_domains_t = single_letter_2nd_lvl_domains_t,
url_access_map_t = url_access_map_t,
inter_wiki_map = inter_wiki_map,