模块:Message box:修订间差异
imported>Quest for Truth 无编辑摘要 |
imported>Quest for Truth 无编辑摘要 |
||
| 第342行: | 第342行: | ||
self.categoryParamNums = union(self.categoryParamNums, self.allNums) | self.categoryParamNums = union(self.categoryParamNums, self.allNums) | ||
-- The following is roughly equivalent to the old {{Ambox/category}}. | -- The following is roughly equivalent to the old {{Ambox/category}}. | ||
local date = args.date | local date | ||
if args.date and args.date ~= '' then | |||
date = args.date | |||
elseif args.time and args.time ~= '' then | |||
date = lang:formatDate('Y年n月', time) | |||
end | |||
date = type(date) == 'string' and date | date = type(date) == 'string' and date | ||
local preposition = ' | local preposition = '自' | ||
for _, num in ipairs(self.categoryParamNums) do | for _, num in ipairs(self.categoryParamNums) do | ||
local mainCat = args['cat' .. tostring(num)] or args['category' .. tostring(num)] | local mainCat = args['cat' .. tostring(num)] or args['category' .. tostring(num)] | ||
| 第351行: | 第356行: | ||
allCat = type(allCat) == 'string' and allCat | allCat = type(allCat) == 'string' and allCat | ||
if mainCat and date and date ~= '' then | if mainCat and date and date ~= '' then | ||
local catTitle = format('%s %s %s' | local catTitle = format('%s%s%s', preposition, date, mainCat) | ||
self:addCat('main', catTitle) | self:addCat('main', catTitle) | ||
catTitle = getTitleObject('Category:' .. catTitle) | catTitle = getTitleObject('Category:' .. catTitle) | ||
if not catTitle or not catTitle.exists then | if not catTitle or not catTitle.exists then | ||
self:addCat('main', ' | self:addCat('main', '模板中使用无效日期参数的条目') | ||
end | end | ||
elseif mainCat and (not date or date == '') then | elseif mainCat and (not date or date == '') then | ||