Module:Citation/CS1/Configuration: Difference between revisions

m
1 revision imported
(username removed)
m (1 revision imported)
m (1 revision imported)
 
(One intermediate revision by one other user not shown)
Line 219: Line 219:


['ext-link-access-signal'] = '<span class="$1" title="$2">$3</span>', -- external link with appropriate lock icon
['ext-link-access-signal'] = '<span class="$1" title="$2">$3</span>', -- external link with appropriate lock icon
['free'] = {class='cs1-lock-free', title='Freely accessible'}, -- classes defined in Module:Citation/CS1/styles.css
['free'] = {class='id-lock-free', title='Freely accessible'}, -- classes defined in Module:Citation/CS1/styles.css
['registration'] = {class='cs1-lock-registration', title='Free registration required'},
['registration'] = {class='id-lock-registration', title='Free registration required'},
['limited'] = {class='cs1-lock-limited', title='Free access subject to limited trial, subscription normally required'},
['limited'] = {class='id-lock-limited', title='Free access subject to limited trial, subscription normally required'},
['subscription'] = {class='cs1-lock-subscription', title='Paid subscription required'},
['subscription'] = {class='id-lock-subscription', title='Paid subscription required'},


['interwiki-icon'] = '<span class="$1" title="$2">$3</span>',
['interwiki-icon'] = '<span class="$1" title="$2">$3</span>',
Line 345: Line 345:
['ScriptChapter'] = {'script-chapter', 'script-contribution', 'script-entry',
['ScriptChapter'] = {'script-chapter', 'script-contribution', 'script-entry',
'script-article', 'script-section'},
'script-article', 'script-section'},
['ScriptEncyclopedia'] = {'script-encyclopedia', 'script-encyclopaedia'}, -- cite encyclopedia only
['ScriptMap'] = 'script-map',
['ScriptMap'] = 'script-map',
['ScriptPeriodical'] = {'script-journal', 'script-magazine', 'script-newspaper',
['ScriptPeriodical'] = {'script-journal', 'script-magazine', 'script-newspaper',
Line 369: Line 370:
['TranscriptFormat'] = 'transcript-format',
['TranscriptFormat'] = 'transcript-format',
['TranscriptURL'] = 'transcript-url', -- Used by InternetArchiveBot
['TranscriptURL'] = 'transcript-url', -- Used by InternetArchiveBot
['TransEncyclopedia'] = {'trans-encyclopedia', 'trans-encyclopaedia'}, -- cite encyclopedia only
['TransMap'] = 'trans-map', -- cite map only
['TransMap'] = 'trans-map', -- cite map only
['TransPeriodical'] = {'trans-journal', 'trans-magazine', 'trans-newspaper',
['TransPeriodical'] = {'trans-journal', 'trans-magazine', 'trans-newspaper',
Line 481: Line 483:


]]
]]
local is_Latn = 'A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143';
local is_Latn = 'A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143\225\184\128-\225\187\191';
local special_case_translation = {
local special_case_translation = {
['AuthorList'] = 'authors list', -- used to assemble maintenance category names
['AuthorList'] = 'authors list', -- used to assemble maintenance category names
Line 599: Line 601:


local_date_names_from_mediawiki is a boolean.  When set to:
local_date_names_from_mediawiki is a boolean.  When set to:
true – module will fetch local month names from MediaWiki for both date_names['local']['long'] and date_names['local']['short']
true – module will fetch local month names from MediaWiki for both date_names['local']['long'] and date_names['local']['short']; this will unconditionally overwrite manual translations
false – module will *not* fetch local month names from MediaWiki
false – module will *not* fetch local month names from MediaWiki


Line 611: Line 613:
]]
]]


local local_date_names_from_mediawiki = true; -- when false, manual translation required for date_names['local']['long'] and date_names['local']['short']
local local_date_names_from_mediawiki = true; -- when false, manual translation required for date_names['local']['long'] and date_names['local']['short']; overwrites manual translations
-- when true, module fetches long and short month names from MediaWiki
-- when true, module fetches long and short month names from MediaWiki
local date_names = {
local date_names = {
Line 754: Line 756:
'^[Pp]gs.?',
'^[Pp]gs.?',
},
},
vpatterns = { -- patterns for |volume=
vi_patterns_t = { -- combined to catch volume-like text in |issue= and issue-like text in |volume=
'^volumes?',
'^volumes?', -- volume-like text
'^vols?[%.:=]?'
'^vols?[%.:=]?',
},
 
ipatterns = { -- patterns for |issue=
'^issues?', --issue-like text
'^issues?',
'^iss[%.:=]?',
'^iss[%.:=]?',
'^numbers?',
'^numbers?',
'^nos?%A', -- don't match 'november' or 'nostradamus'
'^nos?%A', -- don't match 'november' or 'nostradamus'
'^nr[%.:=]?',
'^nr[%.:=]?',
'^n[%.:= ]' -- might be a valid issue without separator (space char is sep char here)
'^n[%.:= ]', -- might be a valid issue without separator (space char is sep char here)
}
'^n°', -- 'n' with degree sign (U+00B0)
'^№', -- precomposed unicode numero character (U+2116)
},
}
}


Line 1,230: Line 1,233:
['foreign-lang-source'] = 'CS1 $1-language sources ($2)', -- |language= categories; $1 is foreign-language name, $2 is ISO639-1 code
['foreign-lang-source'] = 'CS1 $1-language sources ($2)', -- |language= categories; $1 is foreign-language name, $2 is ISO639-1 code
['foreign-lang-source-2'] = 'CS1 foreign language sources (ISO 639-2)|$1', -- |language= category; a cat for ISO639-2 languages; $1 is the ISO 639-2 code used as a sort key
['foreign-lang-source-2'] = 'CS1 foreign language sources (ISO 639-2)|$1', -- |language= category; a cat for ISO639-2 languages; $1 is the ISO 639-2 code used as a sort key
['jul-greg-uncertainty'] = 'CS1: Julian–Gregorian uncertainty', -- probably temporary cat to identify scope of template with dates 1 October 1582 – 1 January 1926
['local-lang-source'] = 'CS1 $1-language sources ($2)', -- |language= categories; $1 is local-language name, $2 is ISO639-1 code; not emitted when local_lang_cat_enable is false
['local-lang-source'] = 'CS1 $1-language sources ($2)', -- |language= categories; $1 is local-language name, $2 is ISO639-1 code; not emitted when local_lang_cat_enable is false
['location-test'] = 'CS1 location test',
['location-test'] = 'CS1 location test',
Line 1,265: Line 1,267:
build a table of doi registrants known to be free-to-read  In a doi, the registrant ID is the series of digits
build a table of doi registrants known to be free-to-read  In a doi, the registrant ID is the series of digits
between the '10.' and the first '/': in doi 10.1100/sommat, 1100 is the registrant ID
between the '10.' and the first '/': in doi 10.1100/sommat, 1100 is the registrant ID
see §3.2.2 DOI prefix of the Doi Handbook p. 43
https://www.doi.org/doi-handbook/DOI_Handbook_Final.pdf#page=43


]]
]]
Line 1,271: Line 1,276:
local registrants_t = {};
local registrants_t = {};
for _, v in ipairs ({
for _, v in ipairs ({
'1100', '1155', '1186', '1371', '1629', '1989', '1999', '2147', '2196', '3285', '3389', '3390', '3410',
'1045', '1074', '1096', '1100', '1155', '1186', '1194', '1371', '1629', '1989', '1999', '2147', '2196', '3285', '3389', '3390',
'3748', '3814', '3847', '3897', '4061', '4089', '4103', '4172', '4175', '4236', '4239', '4240', '4251',
'3748', '3814', '3847', '3897', '4061', '4089', '4103', '4172', '4175', '4249', '4236', '4239', '4240', '4251',
'4252', '4253', '4254', '4291', '4292', '4329', '4330', '4331', '5194', '5306', '5312', '5313', '5314',
'4252', '4253', '4254', '4291', '4292', '4329', '4330', '4331', '5194', '5210', '5306', '5312', '5313', '5314',
'5315', '5316', '5317', '5318', '5319', '5320', '5321', '5334', '5402', '5409', '5410', '5411', '5412',
'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',
'5492', '5493', '5494', '5495', '5496', '5497', '5498', '5499', '5500', '5501', '5527', '5528', '5662',
'6064', '6219', '7167', '7217', '7287', '7482', '7490', '7554', '7717', '7766', '11131', '11569', '11647',
'6064', '6219', '7167', '7217', '7287', '7482', '7490', '7554', '7717', '7759', '7766', '11131', '11569', '11647',
'11648', '12688', '12703', '12715', '12998', '13105', '14293', '14303', '15215', '15412', '15560', '16995',
'11648', '12688', '12703', '12715', '12998', '13105', '14256', '14293', '14303', '15215', '15347', '15412', '15560', '16995',
'17645', '19080', '19173', '20944', '21037', '21468', '21767', '22261', '22459', '24105', '24196', '24966',
'17645', '19080', '19173', '20944', '21037', '21468', '21767', '22261', '22323', '22459', '24105', '24196', '24966',
'26775', '30845', '32545', '35711', '35712', '35713', '35995', '36648', '37126', '37532', '37871', '47128',
'26775', '30845', '32545', '35711', '35712', '35713', '35995', '36648', '37126', '37532', '37871', '47128',
'47622', '47959', '52437', '52975', '53288', '54081', '54947', '55667', '55914', '57009', '58647', '59081',
'47622', '47959', '52437', '52975', '53288', '54081', '54947', '55667', '55914', '57009', '58647', '59081',
Line 2,039: Line 2,044:
},
},
}
}
--[[--------------------------< I D _ L I M I T S _ D A T A _ T >----------------------------------------------
fetch id limits for certain identifiers from c:Data:CS1/Identifier limits.tab.  This source is a json tabular
data file maintained at wikipedia commons.  Convert the json format to a table of k/v pairs.
The values from <id_limits_data_t> are used to set handle.id_limit.
]]
local id_limits_data_t = {};
for _, limit_t in ipairs (mw.ext.data.get ("CS1/Identifier limits.tab").data) do
id_limits_data_t[limit_t[1]] = limit_t[2]; -- <limit[1]> is identifier; <limit[2]> is upper limit for that identifier
end




Line 2,266: Line 2,286:
encode = true,
encode = true,
separator = '&nbsp;',
separator = '&nbsp;',
id_limit = 10100000000,
id_limit = id_limits_data_t.OCLC or 0,
},
},
['OL'] = {
['OL'] = {
Line 2,290: Line 2,310:
encode = true,
encode = true,
separator = '&nbsp;',
separator = '&nbsp;',
id_limit = 23010000,
id_limit = id_limits_data_t.OSTI or 0,
custom_access = 'osti-access',
custom_access = 'osti-access',
},
},
Line 2,304: Line 2,324:
encode = true,
encode = true,
separator = '&nbsp;',
separator = '&nbsp;',
id_limit = 10900000,
id_limit = id_limits_data_t.PMC or 0,
access = 'free', -- free to read
access = 'free', -- free to read
},
},
Line 2,317: Line 2,337:
encode = false,
encode = false,
separator = '&nbsp;',
separator = '&nbsp;',
id_limit = 38400000,
id_limit = id_limits_data_t.PMID or 0,
},
},
['RFC'] = {
['RFC'] = {
Line 2,329: Line 2,349:
encode = false,
encode = false,
separator = '&nbsp;',
separator = '&nbsp;',
id_limit = 9300,
id_limit = id_limits_data_t.RFC or 0,
access = 'free', -- free to read
access = 'free', -- free to read
},
},
Line 2,351: Line 2,371:
encode = true,
encode = true,
separator = '&nbsp;',
separator = '&nbsp;',
id_limit = 4700000,
id_limit = id_limits_data_t.SSRN or 0,
custom_access = 'ssrn-access',
custom_access = 'ssrn-access',
},
},
Line 2,364: Line 2,384:
encode = false,
encode = false,
separator = '&nbsp;',
separator = '&nbsp;',
id_limit = 268000000,
id_limit = id_limits_data_t.S2CID or 0,
custom_access = 's2cid-access',
custom_access = 's2cid-access',
},
},