ページ「モジュール:Citation/CS1/Identifiers」と「モジュール:Citation/CS1/Identifiers/sandbox」の間の差分
(ページ間の差分)
削除された内容 追加された内容
en:Module:Citation/CS1/Identifiers oldid=1170046896 より更新、および 利用者:本日晴天 による2022年12月28日 (水) 15:59 (UTC)、2023年8月19日 (土) 03:34 (UTC)、2023年9月10日 (日) 03:23 (UTC)の編集を移入 |
|doi-broken-date=に日本語の日付を指定した場合でも月名を取得できるようにする |
||
529行目: | 529行目: | ||
--[[--------------------------< C R I D >---------------------------------------------------------------------- |
--[[--------------------------< C R I D >---------------------------------------------------------------------- |
||
Format an CRID, do simple error checking. CRID must be nineteen digits. |
Format an CRID, do simple error checking. CRID must be nineteen digits starts with '1'. |
||
]] |
]] |
||
536行目: | 536行目: | ||
local id = options.id; |
local id = options.id; |
||
local handler = options.handler; |
local handler = options.handler; |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
options.coins_list_t['CRID'] = nil; -- when error, unset so not included in COinS |
options.coins_list_t['CRID'] = nil; -- when error, unset so not included in COinS |
||
end |
end |
||
⚫ | |||
return text; |
|||
⚫ | |||
end |
end |
||
587行目: | 584行目: | ||
local lang_obj = mw.getContentLanguage(); -- get a language object for this wiki |
local lang_obj = mw.getContentLanguage(); -- get a language object for this wiki |
||
good, inactive_month = pcall (lang_obj.formatDate, lang_obj, 'F', inactive); -- try to get the month name from the inactive date |
good, inactive_month = pcall (lang_obj.formatDate, lang_obj, 'F', inactive); -- try to get the month name from the inactive date |
||
if not good then -- 日本語版独自処理ここから |
|||
inactive_month = mw.ustring.match(inactive, '(1?[0-9]月)'); -- 日本語の月名が含まれていれば取り出す |
|||
if inactive_month and cfg.date_names['local']['long'][inactive_month] then -- 有効な月名であるか検査 |
|||
good = true; |
|||
end |
|||
end -- 日本語版独自処理ここまで |
|||
if not good then |
if not good then |
||
inactive_month = nil; -- something went wrong so make sure this is unset |
inactive_month = nil; -- something went wrong so make sure this is unset |
||
593行目: | 596行目: | ||
end -- otherwise, |doi-broken-date= has something but it isn't a date |
end -- otherwise, |doi-broken-date= has something but it isn't a date |
||
-- 日本語版独自: maint_doi_inactive_datedは使わずに、常にmaint_doi_inactiveを使う |
|||
⚫ | |||
set_message ('maint_doi_inactive'); |
|||
--if is_set (inactive_year) and is_set (inactive_month) then |
|||
set_message ('maint_doi_inactive_dated', {inactive_year, |
-- set_message ('maint_doi_inactive_dated', {inactive_year, inactive_month, ' '}); |
||
⚫ | |||
⚫ | |||
set_message (' |
-- set_message ('maint_doi_inactive_dated', {inactive_year, '', ''}); |
||
--else |
|||
-- set_message ('maint_doi_inactive'); |
|||
inactive = " (" .. cfg.messages['inactive'] .. ' ' .. inactive .. ')'; |
|||
--end |
|||
inactive = substitute (cfg.messages['inactive'], { inactive }); -- 日本語版独自: 日本語にする都合でsubstitute()を使う |
|||
end |
end |
||
811行目: | 816行目: | ||
end |
end |
||
end |
end |
||
if is_set (options.CS_ja) and (not is_set (domain)) then -- 日本語版独自: CS-ja向けに処理を追加 |
|||
domain = "co.jp"; -- CS-jaではデフォルトでamazon.co.jpにリンクする |
|||
end -- ここまで日本語版独自 |
|||
if (not is_set (domain)) or in_array (domain, {'us'}) then -- default: United States |
if (not is_set (domain)) or in_array (domain, {'us'}) then -- default: United States |
||
domain = "com"; |
domain = "com"; |
||
1,138行目: | 1,146行目: | ||
local id = options.id; |
local id = options.id; |
||
local handler = options.handler; |
local handler = options.handler; |
||
local matched; |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
if not matched then |
|||
⚫ | |||
options.coins_list_t['NAID'] = nil; -- when error, unset so not included in COinS |
options.coins_list_t['NAID'] = nil; -- when error, unset so not included in COinS |
||
end |
end |
||
⚫ | |||
return text; |
|||
⚫ | |||
end |
end |
||
1,155行目: | 1,160行目: | ||
NCID must be two uppercase alphabets + seven digits + X or a digit. |
NCID must be two uppercase alphabets + seven digits + X or a digit. |
||
検査方法については https://catill.bitbucket.io/CM/furoku2_1.html の「ID及びBHNT(前後誌データID)」の項を参照 |
|||
]] |
]] |
||
1,161行目: | 1,167行目: | ||
local id = options.id; |
local id = options.id; |
||
local handler = options.handler; |
local handler = options.handler; |
||
⚫ | |||
⚫ | |||
⚫ | |||
if not id:match('^[AB][A-DN]%d%d%d%d%d%d%d[%dX]$') then |
|||
err_flag = true; |
|||
else |
|||
local c1, c2 = id:byte(1, 2); -- 最初の2文字を文字コードに変換 |
|||
if c1 == 65 and (c2 == 67 or c2 == 68) then |
|||
err_flag = true; -- 'AC'もしくは'AD'で始まるidは無効 |
|||
⚫ | |||
local work = (c1 - 64) % 10 * 9 + (c2 - 64) % 10 * 8; -- 規則に従って最初の2文字を数値に変換し、作業用変数に加算する |
|||
for i= 3, 9 do |
|||
work = work + tonumber(id:sub(i, i)) * (10 - i); -- 3文字目から9文字目までを数値に変換し、規則に従って作業用変数に加算する |
|||
end |
|||
local c = id:sub(10, 10); -- 末尾の文字(チェックディジット) |
|||
if work % 11 ~= (c == 'X' and 10 or tonumber(c)) then |
|||
err_flag = true; -- チェックディジットが合わなければエラー |
|||
end |
|||
end |
|||
end |
|||
⚫ | |||
if not require('Module:Check ncid').check_ncid(id) then -- if NCID is not valid |
|||
set_message ('err_bad_ncid'); -- set an error message |
|||
options.coins_list_t['NCID'] = nil; -- when error, unset so not included in COinS |
options.coins_list_t['NCID'] = nil; -- when error, unset so not included in COinS |
||
end |
end |
||
⚫ | |||
return text; |
|||
⚫ | |||
end |
end |
||