更改
以“-- This is a meta-module for producing message box templates, including {{mbox}}, {{ambox}}, -- {{imbox}}, {{tmbox}}, {{ombox}}, {{cmbox}} and {{fmbox}}. -- Require...”为内容创建页面
-- This is a meta-module for producing message box templates, including {{mbox}}, {{ambox}}, {{imbox}}, {{tmbox}}, {{ombox}}, {{cmbox}} and {{fmbox}}.
-- This is a meta-module for producing message box templates, including {{mbox}}, {{ambox}},
-- {{imbox}}, {{tmbox}}, {{ombox}}, {{cmbox}} and {{fmbox}}.
-- Require necessary modules.
-- Require necessary modules.
nsVals[i] = format('"%s"', val)
nsVals[i] = format('"%s"', val)
end
end
error(' 無效的ns參數傳送到box:addCat ;有效的數值為' .. mw.text.listToText(nsVals, '、', ' 或'))
error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or '))
end
end
self[tname] = self[tname] or {}
self[tname] = self[tname] or {}
end
end
tinsert(boxTypes, '"mbox"')
tinsert(boxTypes, '"mbox"')
error(format(' 無效的訊息框類型「%s 」;有效的類型為%s', tostring(boxType), mw.text.listToText(boxTypes)), 2)
error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2)
end
end
return cfg
return cfg
local sect
local sect
if args.sect == '' then
if args.sect == '' then
sect = ' 本' .. (cfg.sectionDefault or ' 頁面')
sect = 'This ' .. (cfg.sectionDefault or 'page')
elseif type(args.sect) == 'string' then
elseif type(args.sect) == 'string' then
sect = ' 本' .. args.sect
sect = 'This ' .. args.sect
end
end
local issue = args.issue
local issue = args.issue
tinsert(issues, issue)
tinsert(issues, issue)
tinsert(issues, text)
tinsert(issues, text)
self.issue = tconcat(issues)
self.issue = tconcat(issues, ' ')
end
end
end
end
if talkTitle and talkTitle.exists then
if talkTitle and talkTitle.exists then
local talkText = ' 相關討論可見於'
local talkText = 'Relevant discussion may be found on'
if talkArgIsTalkPage then
if talkArgIsTalkPage then
talkText = format('%s[[%s|%s]].', talkText, talk, talkTitle.prefixedText)
talkText = format('%s [[%s|%s]].', talkText, talk, talkTitle.prefixedText)
else
else
talkText = format('%s[[%s#%s| 討論頁]].', talkText, talkTitle.prefixedText, talk)
talkText = format('%s the [[%s#%s|talk page]].', talkText, talkTitle.prefixedText, talk)
end
end
self.talk = talkText
self.talk = talkText
-- Get other values.
-- Get other values.
self.fix = args.fix ~= '' and args.fix or nil
local date
local date
if args.date and args.date ~= '' then
if args.date and args.date ~= '' then
date = args.date
date = args.date
elseif args.date == '' and self.isTemplatePage then
elseif args.date == '' and self.isTemplatePage then
date = lang:formatDate('Y 年n月j日')
date = lang:formatDate('F Y')
end
end
if date then
if date then
self.date = format("<small> (%s )</small>", date)
self.date = format(" <small>''(%s)''</small>", date)
end
end
self.info = args.info
self.info = args.info
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
local date = args.date
date = type(date) == 'string' and date
date = type(date) == 'string' and date
local preposition = ' 自'
local preposition = 'from'
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)]
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', preposition, date, mainCat)
local catTitle = format('%s %s %s', mainCat, preposition, date)
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', 'Articles with invalid date parameter in template')
end
end
elseif mainCat and (not date or date == '') then
elseif mainCat and (not date or date == '') then
if self.invalidTypeError then
if self.invalidTypeError then
local allSort = (self.nsid == 0 and 'Main:' or '') .. self.title.prefixedText
local allSort = (self.nsid == 0 and 'Main:' or '') .. self.title.prefixedText
self:addCat('all', ' 需要修复的信息框', allSort)
self:addCat('all', 'Wikisource message box parameter needs fixing', allSort)
end
end
if self.isSubstituted then
if self.isSubstituted then
self:addCat('all', ' 錯誤使用替換引用的頁面')
self:addCat('all', 'Pages with incorrectly substituted templates')
end
end
.addClass('error')
.addClass('error')
.wikitext(format(
.wikitext(format(
' 模板<code>%s[[Template:%s|%s]]%s</code> 被錯誤地替代。',
'Template <code>%s[[Template:%s|%s]]%s</code> has been incorrectly substituted.',
mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}')
mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}')
))
))
.tag('span')
.tag('span')
.addClass('hide-when-compact')
.addClass('hide-when-compact')
.wikitext(self.talk and self.talk)
.wikitext(self.talk and ' ' .. self.talk)
.wikitext(self.fix and ' ' .. self.fix)
end
end
textCellSpan
textCellSpan
.wikitext(self.date and self.date)
.wikitext(self.date and ' ' .. self.date)
if not self.isSmall then
if not self.isSmall then
textCellSpan
textCellSpan
.tag('span')
.tag('span')
.addClass('hide-when-compact')
.addClass('hide-when-compact')
.wikitext(self.info and self.info)
.wikitext(self.info and ' ' .. self.info)
end
end
else
else
.tag('div')
.tag('div')
.css('text-align', 'center')
.css('text-align', 'center')
.wikitext(format(' 本訊息框使用無效的「type=%s 」參數,需要修復。', self.type or ''))
.wikitext(format('This message box is using an invalid "type=%s" parameter and needs fixing.', self.type or ''))
end
end