ページ「モジュール:Citation/CS1」と「モジュール:Citation/CS1/sandbox」の間の差分

(ページ間の差分)
ページ 1
ページ 2
削除された内容 追加された内容
m 外部リンクの修正 RFC -> {{IETF RFC}} (Botによる編集)
 
修正
 
2,570行目: 2,570行目:
elseif 3 == selected then
elseif 3 == selected then
Authors = A['Authors']; -- use content of |authors=
Authors = A['Authors']; -- use content of |authors=
if 'authors' == A:ORIGIN('Authors') then -- but add a maint cat if the parameter is |authors=
utilities.set_message ('maint_authors'); -- because use of this parameter is discouraged; what to do about the aliases is a TODO:
end
end
end
if utilities.is_set (Collaboration) then
if utilities.is_set (Collaboration) then
2,583行目: 2,580行目:


do -- to limit scope of selected
do -- to limit scope of selected
local selected = select_author_editor_source (A['Veditors'], nil, args, 'EditorList'); -- support for |editors= withdrawn
local selected = select_author_editor_source (A['Veditors'], A['Editors'], args, 'EditorList'); -- 日本語版では|editors=のサポートを当面の間継続する
if 1 == selected then
if 1 == selected then
e, editor_etal = extract_names (args, 'EditorList'); -- fetch editor list from |editorn= / |editor-lastn= / |editor-firstn=, |editor-linkn=, and |editor-maskn=
e, editor_etal = extract_names (args, 'EditorList'); -- fetch editor list from |editorn= / |editor-lastn= / |editor-firstn=, |editor-linkn=, and |editor-maskn=
2,589行目: 2,586行目:
NameListStyle = 'vanc'; -- override whatever |name-list-style= might be
NameListStyle = 'vanc'; -- override whatever |name-list-style= might be
e, editor_etal = parse_vauthors_veditors (args, args.veditors, 'EditorList'); -- fetch editor list from |veditors=, |editor-linkn=, and |editor-maskn=
e, editor_etal = parse_vauthors_veditors (args, args.veditors, 'EditorList'); -- fetch editor list from |veditors=, |editor-linkn=, and |editor-maskn=
elseif 3 == selected then
Editors = A['Editors']; -- |editors=の値を使用する
end
end
end
end
3,082行目: 3,081行目:
else
else
Date_origin = A:ORIGIN('Date'); -- not a promotion; name required for error messaging
Date_origin = A:ORIGIN('Date'); -- not a promotion; name required for error messaging
end

-- 日本語版独自: month引数に暫定対応
do
local Month = A['Month'];
if utilities.is_set (Month) then
local m = mw.ustring.match(Month, '^(%d%d?)月?$');
utilities.set_message ('maint_month'); -- メンテナンスカテゴリを付与する
if utilities.is_set (m) and utilities.is_set (Date) then
local y, suffix = mw.ustring.match(Date, '^(%d%d%d%d?)([a-zA-Z年]?)$');
if utilities.is_set (y) then
if suffix:match('^[a-zA-Z]$') then -- Dateの末尾にアルファベットの接尾辞があれば
Year = Date; -- Dateを上書きする前に、Yearにコピーする
end
Date = y .. '年' .. m ..'月';
end
end
end
end
end


3,093行目: 3,110行目:
]]
]]


local DF = is_valid_parameter_value (A['DF'], A:ORIGIN('DF'), cfg.keywords_lists['df'], '');
local DF = is_valid_parameter_value (A['DF'], A:ORIGIN('DF'), cfg.keywords_lists['df'], 'dmy'); -- 日本語版独自仕様: |df=の指定がなければdmy形式で表示する
if not utilities.is_set (DF) then
--if not utilities.is_set (DF) then
DF = cfg.global_df; -- local |df= if present overrides global df set by {{use xxx date}} template
-- DF = cfg.global_df; -- local |df= if present overrides global df set by {{use xxx date}} template
end
--end


local ArchiveURL;
local ArchiveURL;
3,145行目: 3,162行目:
local modified = false; -- flag
local modified = false; -- flag


-- 日本語版独自: validation.date_hyphen_to_dash()をvalidation.reformat_dates()より先に呼び出す
if utilities.is_set (DF) then -- if we need to reformat dates
modified = validation.reformat_dates (date_parameters_list, DF);-- reformat to DF format, use long month names if appropriate
else -- 日本語版独自:常に日付の書式を整える
modified = validation.reformat_dates (date_parameters_list, '');
end

if true == validation.date_hyphen_to_dash (date_parameters_list) then -- convert hyphens to dashes where appropriate
if true == validation.date_hyphen_to_dash (date_parameters_list) then -- convert hyphens to dashes where appropriate
modified = true;
modified = true;
utilities.set_message ('maint_date_format'); -- hyphens were converted so add maint category
utilities.set_message ('maint_date_format'); -- hyphens were converted so add maint category
end

if utilities.is_set (DF) then -- if we need to reformat dates
modified = validation.reformat_dates (date_parameters_list, DF);-- reformat to DF format, use long month names if appropriate
end
end
3,403行目: 3,419行目:
if cfg.global_cs1_config_t['DisplayAuthors'] and utilities.is_set (A['DisplayAuthors']) then -- when template has |display-authors=<something> which global setting has overridden
if cfg.global_cs1_config_t['DisplayAuthors'] and utilities.is_set (A['DisplayAuthors']) then -- when template has |display-authors=<something> which global setting has overridden
utilities.set_message ('maint_overridden_setting'); -- set a maint message
utilities.set_message ('maint_overridden_setting'); -- set a maint message
end

do -- 日本語版独自処理
local Coauthors = A['Coauthors'];
if utilities.is_set (Coauthors) then
Coauthors, author_etal = name_has_etal (Coauthors, author_etal, true);
table.insert(a, { last = Coauthors });
end
end
end


4,123行目: 4,147行目:
options_t.class = cite_class_attribute_make (config.CitationClass, Mode);
options_t.class = cite_class_attribute_make (config.CitationClass, Mode);


-- 日本語版独自: 当面の間|ref=harvを許可する
local Ref = is_valid_parameter_value (A['Ref'], A:ORIGIN('Ref'), cfg.keywords_lists['ref'], nil, true); -- nil when |ref=harv; A['Ref'] else
--local Ref = is_valid_parameter_value (A['Ref'], A:ORIGIN('Ref'), cfg.keywords_lists['ref'], nil, true); -- nil when |ref=harv; A['Ref'] else
local Ref = nil;

if utilities.in_array (A['Ref'], cfg.keywords_lists['ref']) then -- |ref=harvが指定されていれば
utilities.set_message ('maint_ref_harv'); -- メンテナンスカテゴリを付与する
elseif utilities.is_set (A['Ref']) then
Ref = A['Ref'];
end


if 'none' ~= cfg.keywords_xlate[(Ref and Ref:lower()) or ''] then
if 'none' ~= cfg.keywords_xlate[(Ref and Ref:lower()) or ''] then
4,146行目: 4,178行目:
end
end
options_t.id = Ref or citeref_id;
options_t.id = Ref or citeref_id;
-- 日本語版独自処理: |date=や|year=に「YYYY年」形式の日付を指定していた場合に、
-- 自動生成するidにも「年」が含まれるバグが存在した。
-- このバグを修正することでアンカーのリンク切れが生じる可能性があるため、
-- 調査が終わるまではプロパティカテゴリで追跡するようにする。
if (not Ref) and utilities.is_set (citeref_id) then
if mw.ustring.match(first_set ({A['Date'], A['Year']}, 2) or '', '%d%d%d%d?年$') then
utilities.add_prop_cat ('year-ja');
end
end
end
end
4,218行目: 4,260行目:
table.insert (render_t, utilities.substitute (cfg.messages['cat wikilink'], v));
table.insert (render_t, utilities.substitute (cfg.messages['cat wikilink'], v));
end
end
for _, v in ipairs (z.prop_cats_t) do -- append properties categories
-- 日本語版独自:properties categoryを導入しない
table.insert (render_t, utilities.substitute (cfg.messages['cat wikilink'], v));
--for _, v in ipairs (z.prop_cats_t) do -- append properties categories
end
--table.insert (render_t, utilities.substitute (cfg.messages['cat wikilink'], v));
--end
end
end


4,484行目: 4,525行目:
if 0 ~= #empty_unknowns then -- create empty unknown error message
if 0 ~= #empty_unknowns then -- create empty unknown error message
utilities.set_message ('err_param_unknown_empty', {
utilities.set_message ('err_param_unknown_empty', {
utilities.make_sep_list (#empty_unknowns, empty_unknowns) -- 日本語版のerr_param_unknown_emptyにはプレースホルダーが1つだけ存在する
1 == #empty_unknowns and '' or 's',
utilities.make_sep_list (#empty_unknowns, empty_unknowns)
});
});
end
end