271是什么意思| 49是什么意思| 天高云淡是什么季节| 什么是假性近视眼| 拉尼娜现象是什么| hpf医学是什么意思| 眼睛模糊什么原因| 容五行属什么| 时光荏苒是什么意思| 双子和什么星座最配| 嗓子总有痰吃什么药| 未时左眼跳是什么预兆| 为什么会闪电| 7月30日是什么星座| 宫颈欠光滑是什么意思| 壁虎喜欢吃什么| 噬血细胞综合征是什么病| dob值阳性是什么意思| 君主是什么意思| 你好后面加什么符号| 小孩吃榴莲有什么好处| 果糖是什么糖| 牙松动了还疼用什么方法处理最好| 晚上10点属于什么时辰| 怀孕前有什么征兆| 树欲静而风不止什么意思| 三更是什么生肖| zhr是什么牌子的鞋| 中国第一个不平等条约是什么| 三月有什么节日| 什么是挠脚心| 大连机场叫什么名字| 所什么无什么| 二战时期是什么时候| 晚上睡觉出虚汗是什么原因| 甲减挂什么科| 为什么来姨妈左侧输卵管会痛| 足银999是什么意思| 叫什么| 手腕关节疼痛什么原因引起的| 09属什么生肖| 心慌心悸是什么原因| 头疼做什么检查| 1月16日是什么星座| 铅是什么| 为什么肠道总是咕咕的响| 高祖父的爸爸叫什么| 咽炎吃什么好| 小孩说话不清楚挂什么科| 单核细胞高是什么意思| 血压低有什么危害| ppl什么意思| 流产药叫什么名字| 脑梗吃什么最好| 纳甲是什么意思| 女人跑马是什么意思| 土豪是什么意思| 重阳节是什么生肖| 88年是什么命| 色氨酸是什么| 前列腺炎吃什么药| 顺时针是什么方向| 上面一个山下面一个今读什么| 超敏crp是什么意思| 农历六月十一是什么星座| 庆幸是什么意思| 亚麻色是什么颜色| 下体痒是什么原因| 霉菌是什么东西| 脑供血不足吃什么药效果最好| 肝火旺盛吃什么中成药| 肋骨骨折吃什么食物好得快| 胃下面是什么器官| 回家心切什么意思| 湿气太重吃什么排湿最快| 什么是心悸有什么症状| 医疗保险是什么| 为什么头发会分叉| gg是什么牌子| 尾骨疼是什么原因| 午五行属什么| 过敏性咳嗽用什么药效果好| 肌腱属于什么组织| 胃烧灼感是什么原因| 眼睛红了是什么原因| 三高指什么| 嫦娥住的宫殿叫什么| 霉菌性阴道炎用什么药效果好| 前列腺增大伴钙化是什么意思| 无名指下面的竖线代表什么| 什么是唐氏儿| 数字8五行属什么| 跖疣是什么原因造成的| 什么的寒冷| 手指关节痛挂什么科| 投诉医生打什么电话| 兰桂齐芳是什么意思| 胃食管反流病是什么原因造成的| 生长纹是什么原因| 漫展是什么| 天蝎配什么星座| 乌鸡炖什么好吃| 三岁看小七岁看老是什么意思| 纸上谈兵是什么生肖| 丹参长什么样子图片| 试营业是什么意思| 补铁吃什么| 孕妇吃葡萄对胎儿有什么好处| 端午节什么时候吃粽子| 晚上胃疼是什么原因| 北京摇号什么时候开始的| 龙和什么生肖最配| 男人有腰窝意味着什么| 什么是肝性脑病| 从小一起长大的姐妹叫什么| 重庆是什么地形| 父亲节送什么| 老人流口水是什么原因引起的| 到底是什么意思| 什么的童年| 冗长什么意思| 梦见白事场面什么意思| 男人趴着睡觉说明什么| 长湿疹是什么原因引起的| 基数大是什么意思| 拉肚子吃什么药| 岁月如歌什么意思| 人流后什么叫重体力活| 女人眉心有痣代表什么| 湿疹是什么样的症状| 化疗后吃什么增加白细胞| 什么地问填词语| 下火喝什么茶| 98年属相是什么| 蒜气是什么病| 脚出汗是什么原因| 什么是eb病毒| c是什么单位| 什么是嘌呤| 荤段子是什么意思| 甲胎蛋白是什么| 空洞是什么意思| 今年为什么有两个6月| 辅警是什么| 无大碍是什么意思| 小猫吃什么| 梦见新房子是什么意思| 什么东西补血最快| 孕囊是什么东西| 步履匆匆的意思是什么| 吃什么水果去火| 开方是什么意思| 阑尾炎吃什么药见效快| 扁平苔藓是什么病| 丘疹性荨麻疹吃什么药| 车辙是什么意思| 茧是什么意思| cet是什么意思| 老二是什么意思| 子宫前置是什么意思| 吗啡是什么| 择日是什么意思| 扬州有什么好玩的| 什么的爬| 一个田一个比读什么| 端午节为什么吃粽子| 什么情况下| 身上长癣是什么原因引起的| 脂蛋白是什么| 四个金读什么| 小便疼痛吃什么药| 利妥昔单抗是治什么病| 嘴巴苦什么原因| 不免是什么意思| 水是由什么构成的| 伤口愈合为什么会痒| 腮腺炎吃什么药| 月子中心需要什么资质| 尿酸高可以吃什么水果| 喝酒之前吃什么保护胃| 胆囊切除后需要注意什么| 什么是安全期和排卵期| 什么行业最赚钱| 欧金金什么意思| 铁棍山药有什么功效| tr什么意思| 尿酸高肌酐高是什么原因呢| 合疗和医保有什么区别| 2023年属什么| 猪八戒的武器叫什么| 12月13日是什么纪念日| 孕妇贫血吃什么药| 性行为是什么意思| 孕妇佩戴什么保胎辟邪| 永加日念什么| 怎么查自己五行缺什么| 发泡实验阳性说明什么| 五谷指的是什么| 冬枣是什么季节的水果| 女人出虚汗是什么原因引起的| 脍炙人口是什么意思| 隔应是什么意思| 胆囊炎不能吃什么食物| 什么是质子| 孩子发烧按摩什么部位退烧| 子宫内膜异位症吃什么药| 脚癣用什么药| 一什么树林| gpt什么意思| 钮祜禄氏现在姓什么| 生理期不能吃什么水果| 2005年是什么生肖| atp是什么| 7月12日什么星座| 腺肌瘤是什么病| 卉是什么意思| 阿莫西林治什么病| 试营业是什么意思| 皮草是什么意思| 本家是什么意思| 月经为什么叫大姨妈| 伤食是什么意思| 黄瓜和青瓜有什么区别| 一什么无余| 间歇是什么意思| puma是什么意思| 夏天脸上皮肤痒是什么原因| 脑子里嗡嗡响是什么原因| 翠鸟吃什么| 皮肤一碰就红是什么原因| 什么牌空调好用又省电| 什么东西在倒立之后会增加一半| 什么叫人均可支配收入| 斯里兰卡说什么语言| 阴道镜是检查什么的| 鸡的贵人是什么生肖| 河蚌用什么呼吸| 碧螺春属于什么茶| beginning什么意思| 2017年是属什么年| 肺五行属什么| 26岁属什么生肖| 梦字五行属什么| 凝固酶阳性是什么意思| 女人下面水多是什么原因| 艾草有什么功效| 点状钙化是什么意思| 肚脐眼上面痛是什么原因引起的| 伊始是什么意思| 焦糖色是什么颜色| 弱点是什么意思| 米饭配什么菜好吃| 身上长扁平疣是什么原因| 水奶和奶粉什么区别| 莫代尔是什么面料| 效劳是什么意思| 边界欠清是什么意思| 核心抗体阳性说明什么| 什么是粗粮食物有哪些| 四川有什么烟| 明知故犯的故是什么意思| 腹泻吃什么药最有效| 呦呦是什么意思| 阿司匹林肠溶片治什么病| 百度Jump to content

江西开展“十三五”规划实施情况中期评估

From Outreach Wiki

require('strict')
local getArgs
local yesno = require('Module:Yesno')
local lang = mw.language.getContentLanguage()

local CONFIG_MODULE = 'Module:Message box/configuration'
local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}

--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------

local function getTitleObject(...)
	-- Get the title object, passing the function through pcall
	-- in case we are over the expensive function count limit.
	local success, title = pcall(mw.title.new, ...)
	if success then
		return title
	end
end

local function union(t1, t2)
	-- Returns the union of two arrays.
	local vals = {}
	for i, v in ipairs(t1) do
		vals[v] = true
	end
	for i, v in ipairs(t2) do
		vals[v] = true
	end
	local ret = {}
	for k in pairs(vals) do
		table.insert(ret, k)
	end
	table.sort(ret)
	return ret
end

local function getArgNums(args, prefix)
	local nums = {}
	for k, v in pairs(args) do
		local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$')
		if num then
			table.insert(nums, tonumber(num))
		end
	end
	table.sort(nums)
	return nums
end

--------------------------------------------------------------------------------
-- Box class definition
--------------------------------------------------------------------------------

local MessageBox = {}
MessageBox.__index = MessageBox

function MessageBox.new(boxType, args, cfg)
	args = args or {}
	local obj = {}

	-- Set the title object and the namespace.
	obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()

	-- Set the config for our box type.
	obj.cfg = cfg[boxType]
	if not obj.cfg then
		local ns = obj.title.namespace
		-- boxType is "mbox" or invalid input
		if args.demospace and args.demospace ~= '' then
			-- implement demospace parameter of mbox
			local demospace = string.lower(args.demospace)
			if DEMOSPACES[demospace] then
				-- use template from DEMOSPACES
				obj.cfg = cfg[DEMOSPACES[demospace]]
			elseif string.find( demospace, 'talk' ) then
				-- demo as a talk page
				obj.cfg = cfg.tmbox
			else
				-- default to ombox
				obj.cfg = cfg.ombox
			end
		elseif ns == 0 then
			obj.cfg = cfg.ambox -- main namespace
		elseif ns == 6 then
			obj.cfg = cfg.imbox -- file namespace
		elseif ns == 14 then
			obj.cfg = cfg.cmbox -- category namespace
		else
			local nsTable = mw.site.namespaces[ns]
			if nsTable and nsTable.isTalk then
				obj.cfg = cfg.tmbox -- any talk namespace
			else
				obj.cfg = cfg.ombox -- other namespaces or invalid input
			end
		end
	end

	-- Set the arguments, and remove all blank arguments except for the ones
	-- listed in cfg.allowBlankParams.
	do
		local newArgs = {}
		for k, v in pairs(args) do
			if v ~= '' then
				newArgs[k] = v
			end
		end
		for i, param in ipairs(obj.cfg.allowBlankParams or {}) do
			newArgs[param] = args[param]
		end
		obj.args = newArgs
	end

	-- Define internal data structure.
	obj.categories = {}
	obj.classes = {}
	-- For lazy loading of [[Module:Category handler]].
	obj.hasCategories = false

	return setmetatable(obj, MessageBox)
end

function MessageBox:addCat(ns, cat, sort)
	if not cat then
		return nil
	end
	if sort then
		cat = string.format('[[Category:%s|%s]]', cat, sort)
	else
		cat = string.format('[[Category:%s]]', cat)
	end
	self.hasCategories = true
	self.categories[ns] = self.categories[ns] or {}
	table.insert(self.categories[ns], cat)
end

function MessageBox:addClass(class)
	if not class then
		return nil
	end
	table.insert(self.classes, class)
end

function MessageBox:setParameters()
	local args = self.args
	local cfg = self.cfg

	-- Get type data.
	self.type = args.type
	local typeData = cfg.types[self.type]
	self.invalidTypeError = cfg.showInvalidTypeError
		and self.type
		and not typeData
	typeData = typeData or cfg.types[cfg.default]
	self.typeClass = typeData.class
	self.typeImage = typeData.image

	-- Find if the box has been wrongly substituted.
	self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'

	-- Find whether we are using a small message box.
	self.isSmall = cfg.allowSmall and (
		cfg.smallParam and args.small == cfg.smallParam
		or not cfg.smallParam and yesno(args.small)
	)

	-- Add attributes, classes and styles.
	self.id = args.id
	self.name = args.name
	if self.name then
		self:addClass('box-' .. string.gsub(self.name,' ','_'))
	end
	if yesno(args.plainlinks) ~= false then
		self:addClass('plainlinks')
	end
	for _, class in ipairs(cfg.classes or {}) do
		self:addClass(class)
	end
	if self.isSmall then
		self:addClass(cfg.smallClass or 'mbox-small')
	end
	self:addClass(self.typeClass)
	self:addClass(args.class)
	self.style = args.style
	self.attrs = args.attrs

	-- Set text style.
	self.textstyle = args.textstyle

	-- Find if we are on the template page or not. This functionality is only
	-- used if useCollapsibleTextFields is set, or if both cfg.templateCategory
	-- and cfg.templateCategoryRequireName are set.
	self.useCollapsibleTextFields = cfg.useCollapsibleTextFields
	if self.useCollapsibleTextFields
		or cfg.templateCategory
		and cfg.templateCategoryRequireName
	then
		if self.name then
			local templateName = mw.ustring.match(
				self.name,
				'^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$'
			) or self.name
			templateName = 'Template:' .. templateName
			self.templateTitle = getTitleObject(templateName)
		end
		self.isTemplatePage = self.templateTitle
			and mw.title.equals(self.title, self.templateTitle)
	end
	
	-- Process data for collapsible text fields. At the moment these are only
	-- used in {{ambox}}.
	if self.useCollapsibleTextFields then
		-- Get the self.issue value.
		if self.isSmall and args.smalltext then
			self.issue = args.smalltext
		else
			local sect
			if args.sect == '' then
				sect = 'This ' .. (cfg.sectionDefault or 'page')
			elseif type(args.sect) == 'string' then
				sect = 'This ' .. args.sect
			end
			local issue = args.issue
			issue = type(issue) == 'string' and issue ~= '' and issue or nil
			local text = args.text
			text = type(text) == 'string' and text or nil
			local issues = {}
			table.insert(issues, sect)
			table.insert(issues, issue)
			table.insert(issues, text)
			self.issue = table.concat(issues, ' ')
		end

		-- Get the self.talk value.
		local talk = args.talk
		-- Show talk links on the template page or template subpages if the talk
		-- parameter is blank.
		if talk == ''
			and self.templateTitle
			and (
				mw.title.equals(self.templateTitle, self.title)
				or self.title:isSubpageOf(self.templateTitle)
			)
		then
			talk = '#'
		elseif talk == '' then
			talk = nil
		end
		if talk then
			-- If the talk value is a talk page, make a link to that page. Else
			-- assume that it's a section heading, and make a link to the talk
			-- page of the current page with that section heading.
			local talkTitle = getTitleObject(talk)
			local talkArgIsTalkPage = true
			if not talkTitle or not talkTitle.isTalkPage then
				talkArgIsTalkPage = false
				talkTitle = getTitleObject(
					self.title.text,
					mw.site.namespaces[self.title.namespace].talk.id
				)
			end
			if talkTitle and talkTitle.exists then
                local talkText
                if self.isSmall then
                    local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
                    talkText = string.format('([[%s|talk]])', talkLink)
                else
                    talkText = 'Relevant discussion may be found on'
                    if talkArgIsTalkPage then
                        talkText = string.format(
                            '%s [[%s|%s]].',
                            talkText,
                            talk,
                            talkTitle.prefixedText
                        )
                    else
                        talkText = string.format(
                            '%s the [[%s#%s|talk page]].',
                            talkText,
                            talkTitle.prefixedText,
                            talk
                        )
                    end
                end
				self.talk = talkText
			end
		end

		-- Get other values.
		self.fix = args.fix ~= '' and args.fix or nil
		local date
		if args.date and args.date ~= '' then
			date = args.date
		elseif args.date == '' and self.isTemplatePage then
			date = lang:formatDate('F Y')
		end
		if date then
			self.date = string.format(" <span class='date-container'><i>(<span class='date'>%s</span>)</i></span>", date)
		end
		self.info = args.info
		if yesno(args.removalnotice) then
			self.removalNotice = cfg.removalNotice
		end
	end

	-- Set the non-collapsible text field. At the moment this is used by all box
	-- types other than ambox, and also by ambox when small=yes.
	if self.isSmall then
		self.text = args.smalltext or args.text
	else
		self.text = args.text
	end

	-- Set the below row.
	self.below = cfg.below and args.below

	-- General image settings.
	self.imageCellDiv = not self.isSmall and cfg.imageCellDiv
	self.imageEmptyCell = cfg.imageEmptyCell

	-- Left image settings.
	local imageLeft = self.isSmall and args.smallimage or args.image
	if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none'
		or not cfg.imageCheckBlank and imageLeft ~= 'none'
	then
		self.imageLeft = imageLeft
		if not imageLeft then
			local imageSize = self.isSmall
				and (cfg.imageSmallSize or '30x30px')
				or '40x40px'
			self.imageLeft = string.format('[[File:%s|%s|link=|alt=]]', self.typeImage
				or 'Information icon4.svg', imageSize)
		end
	end

	-- Right image settings.
	local imageRight = self.isSmall and args.smallimageright or args.imageright
	if not (cfg.imageRightNone and imageRight == 'none') then
		self.imageRight = imageRight
	end
	
	-- set templatestyles
	self.base_templatestyles = cfg.templatestyles
	self.templatestyles = args.templatestyles
end

function MessageBox:setMainspaceCategories()
	local args = self.args
	local cfg = self.cfg

	if not cfg.allowMainspaceCategories then
		return nil
	end

	local nums = {}
	for _, prefix in ipairs{'cat', 'category', 'all'} do
		args[prefix .. '1'] = args[prefix]
		nums = union(nums, getArgNums(args, prefix))
	end

	-- The following is roughly equivalent to the old {{Ambox/category}}.
	local date = args.date
	date = type(date) == 'string' and date
	local preposition = 'from'
	for _, num in ipairs(nums) do
		local mainCat = args['cat' .. tostring(num)]
			or args['category' .. tostring(num)]
		local allCat = args['all' .. tostring(num)]
		mainCat = type(mainCat) == 'string' and mainCat
		allCat = type(allCat) == 'string' and allCat
		if mainCat and date and date ~= '' then
			local catTitle = string.format('%s %s %s', mainCat, preposition, date)
			self:addCat(0, catTitle)
			catTitle = getTitleObject('Category:' .. catTitle)
			if not catTitle or not catTitle.exists then
				self:addCat(0, 'Articles with invalid date parameter in template')
			end
		elseif mainCat and (not date or date == '') then
			self:addCat(0, mainCat)
		end
		if allCat then
			self:addCat(0, allCat)
		end
	end
end

function MessageBox:setTemplateCategories()
	local args = self.args
	local cfg = self.cfg

	-- Add template categories.
	if cfg.templateCategory then
		if cfg.templateCategoryRequireName then
			if self.isTemplatePage then
				self:addCat(10, cfg.templateCategory)
			end
		elseif not self.title.isSubpage then
			self:addCat(10, cfg.templateCategory)
		end
	end

	-- Add template error categories.
	if cfg.templateErrorCategory then
		local templateErrorCategory = cfg.templateErrorCategory
		local templateCat, templateSort
		if not self.name and not self.title.isSubpage then
			templateCat = templateErrorCategory
		elseif self.isTemplatePage then
			local paramsToCheck = cfg.templateErrorParamsToCheck or {}
			local count = 0
			for i, param in ipairs(paramsToCheck) do
				if not args[param] then
					count = count + 1
				end
			end
			if count > 0 then
				templateCat = templateErrorCategory
				templateSort = tostring(count)
			end
			if self.categoryNums and #self.categoryNums > 0 then
				templateCat = templateErrorCategory
				templateSort = 'C'
			end
		end
		self:addCat(10, templateCat, templateSort)
	end
end

function MessageBox:setAllNamespaceCategories()
	-- Set categories for all namespaces.
	if self.invalidTypeError then
		local allSort = (self.title.namespace == 0 and 'Main:' or '') .. self.title.prefixedText
		self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort)
	end
	if self.isSubstituted then
		self:addCat('all', 'Pages with incorrectly substituted templates')
	end
end

function MessageBox:setCategories()
	if self.title.namespace == 0 then
		self:setMainspaceCategories()
	elseif self.title.namespace == 10 then
		self:setTemplateCategories()
	end
	self:setAllNamespaceCategories()
end

function MessageBox:renderCategories()
	if not self.hasCategories then
		-- No categories added, no need to pass them to Category handler so,
		-- if it was invoked, it would return the empty string.
		-- So we shortcut and return the empty string.
		return ""
	end
	-- Convert category tables to strings and pass them through
	-- [[Module:Category handler]].
	return require('Module:Category handler')._main{
		main = table.concat(self.categories[0] or {}),
		template = table.concat(self.categories[10] or {}),
		all = table.concat(self.categories.all or {}),
		nocat = self.args.nocat,
		page = self.args.page
	}
end

function MessageBox:export()
	local root = mw.html.create()

	-- Add the subst check error.
	if self.isSubstituted and self.name then
		root:tag('b')
			:addClass('error')
			:wikitext(string.format(
				'Template <code>%s[[Template:%s|%s]]%s</code> has been incorrectly substituted.',
				mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}')
			))
	end

	local frame = mw.getCurrentFrame()
	root:wikitext(frame:extensionTag{
		name = 'templatestyles',
		args = { src = self.base_templatestyles },
	})
	-- Add support for a single custom templatestyles sheet. Undocumented as
	-- need should be limited and many templates using mbox are substed; we
	-- don't want to spread templatestyles sheets around to arbitrary places
	if self.templatestyles then
		root:wikitext(frame:extensionTag{
			name = 'templatestyles',
			args = { src = self.templatestyles },
		})
	end

	-- Create the box table.
	local boxTable = root:tag('table')
	boxTable:attr('id', self.id or nil)
	for i, class in ipairs(self.classes or {}) do
		boxTable:addClass(class or nil)
	end
	boxTable
		:cssText(self.style or nil)
		:attr('role', 'presentation')

	if self.attrs then
		boxTable:attr(self.attrs)
	end

	-- Add the left-hand image.
	local row = boxTable:tag('tr')
	if self.imageLeft then
		local imageLeftCell = row:tag('td'):addClass('mbox-image')
		if self.imageCellDiv then
			-- If we are using a div, redefine imageLeftCell so that the image
			-- is inside it. Divs use style="width: 52px;", which limits the
			-- image width to 52px. If any images in a div are wider than that,
			-- they may overlap with the text or cause other display problems.
			imageLeftCell = imageLeftCell:tag('div'):addClass('mbox-image-div')
		end
		imageLeftCell:wikitext(self.imageLeft or nil)
	elseif self.imageEmptyCell then
		-- Some message boxes define an empty cell if no image is specified, and
		-- some don't. The old template code in templates where empty cells are
		-- specified gives the following hint: "No image. Cell with some width
		-- or padding necessary for text cell to have 100% width."
		row:tag('td')
			:addClass('mbox-empty-cell')
	end

	-- Add the text.
	local textCell = row:tag('td'):addClass('mbox-text')
	if self.useCollapsibleTextFields then
		-- The message box uses advanced text parameters that allow things to be
		-- collapsible. At the moment, only ambox uses this.
		textCell:cssText(self.textstyle or nil)
		local textCellDiv = textCell:tag('div')
		textCellDiv
			:addClass('mbox-text-span')
			:wikitext(self.issue or nil)
		if (self.talk or self.fix) then
			textCellDiv:tag('span')
				:addClass('hide-when-compact')
				:wikitext(self.talk and (' ' .. self.talk) or nil)
				:wikitext(self.fix and (' ' .. self.fix) or nil)
		end
		textCellDiv:wikitext(self.date and (' ' .. self.date) or nil)
		if self.info and not self.isSmall then
			textCellDiv
				:tag('span')
				:addClass('hide-when-compact')
				:wikitext(self.info and (' ' .. self.info) or nil)
		end
		if self.removalNotice then
			textCellDiv:tag('span')
				:addClass('hide-when-compact')
				:tag('i')
					:wikitext(string.format(" (%s)", self.removalNotice))
		end
	else
		-- Default text formatting - anything goes.
		textCell
			:cssText(self.textstyle or nil)
			:wikitext(self.text or nil)
	end

	-- Add the right-hand image.
	if self.imageRight then
		local imageRightCell = row:tag('td'):addClass('mbox-imageright')
		if self.imageCellDiv then
			-- If we are using a div, redefine imageRightCell so that the image
			-- is inside it.
			imageRightCell = imageRightCell:tag('div'):addClass('mbox-image-div')
		end
		imageRightCell
			:wikitext(self.imageRight or nil)
	end

	-- Add the below row.
	if self.below then
		boxTable:tag('tr')
			:tag('td')
				:attr('colspan', self.imageRight and '3' or '2')
				:addClass('mbox-text')
				:cssText(self.textstyle or nil)
				:wikitext(self.below or nil)
	end

	-- Add error message for invalid type parameters.
	if self.invalidTypeError then
		root:tag('div')
			:addClass('mbox-invalid-type')
			:wikitext(string.format(
				'This message box is using an invalid "type=%s" parameter and needs fixing.',
				self.type or ''
			))
	end

	-- Add categories.
	root:wikitext(self:renderCategories() or nil)

	return tostring(root)
end

--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------

local p, mt = {}, {}

function p._exportClasses()
	-- For testing.
	return {
		MessageBox = MessageBox
	}
end

function p.main(boxType, args, cfgTables)
	local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE))
	box:setParameters()
	box:setCategories()
	return box:export()
end

function mt.__index(t, k)
	return function (frame)
		if not getArgs then
			getArgs = require('Module:Arguments').getArgs
		end
		return t.main(k, getArgs(frame, {trim = false, removeBlanks = false}))
	end
end

return setmetatable(p, mt)
prp是什么意思 什么一笑 三句半是什么意思 晚上两点是什么时辰 mic是什么意思
蜱虫长什么样子 中暑头晕吃什么药 例假量少是什么原因 饮片是什么意思 裹粉是什么粉
rfc是什么意思 慰问金是什么意思 头疼挂什么科室 鹿角有什么功效和作用 四川的耗儿鱼是什么鱼
红眼病什么症状 精神洁癖是什么意思 麻醉科属于什么科室 粗钢是什么 车票改签是什么意思
孕妇吸二手烟对胎儿有什么影响fenrenren.com 有心火是什么症状hcv7jop5ns3r.cn 女性胆固醇高吃什么好hcv8jop9ns1r.cn 什么是粳米hcv9jop4ns8r.cn 长痣是什么原因hcv7jop7ns1r.cn
一什么永什么成语hcv9jop1ns3r.cn 电子厂是做什么的hcv8jop5ns0r.cn 七月十六号是什么星座hcv8jop8ns9r.cn 知了幼虫叫什么hcv7jop9ns6r.cn 漆皮是什么皮hcv7jop5ns5r.cn
什么药护肝效果最好hcv9jop3ns1r.cn 尿多尿频是什么原因hcv7jop6ns2r.cn 北极熊的毛是什么颜色的inbungee.com haccp是什么认证hcv8jop5ns1r.cn 蓝加红是什么颜色hcv8jop2ns2r.cn
不在服务区是什么意思hcv8jop1ns5r.cn 什么是鸡眼hcv8jop0ns4r.cn 三岁宝宝喝什么奶粉比较好hcv8jop7ns3r.cn 早上起来心慌是什么原因hcv8jop4ns6r.cn 词又被称为什么hcv9jop2ns6r.cn
百度