モジュール:Citation/Show date
表示
モジュールの解説[作成]
require('strict')
local cfg
local utilities = require('Module:Citation/CS1/Utilities/sandbox')
local validation = require('Module:Citation/CS1/Date validation/sandbox')
local function show_date(frame, df)
local value = frame.args[1]
local date_parameters_list = { ['date'] = {val = value} }
local error_list = {}
utilities.set_selected_modules(cfg)
validation.set_selected_modules(cfg, utilities)
validation.dates(date_parameters_list, {}, error_list)
if #error_list > 0 then
return value .. frame:expandTemplate{ title = 'Citation/showdateError'}
end
return validation.reformat_dates(date_parameters_list, df)
and date_parameters_list['date'].val
or value
end
local p = {}
function p.show_date_en(frame)
cfg = mw.loadData('Module:Citation/CS1/Configuration/sandbox')
return show_date(frame, 'dmy')
end
function p.show_date_ja(frame)
cfg = mw.loadData('Module:Citation/CS-ja/Configuration/sandbox')
return show_date(frame, 'ja')
end
return p