长春有什么特产| 什么品牌的洗衣机最好| 牛的三合和六个合生肖是什么| 杭州落户需要什么条件| 七月十日是什么星座| 什么鸟好养| 氢什么意思| 参片泡水喝有什么功效| psg是什么意思| 宁静是什么民族| 大姐大是什么意思| 谷丙转氨酶是什么| 上海话册那是什么意思| 冲羊煞东是什么意思| 8.5是什么星座| 脾胃伏火是什么意思| 甲状腺弥漫性病变是什么意思| 羊水指数是什么意思| 法式刘海适合什么脸型| 右胸痛什么原因| 一什么秋千| 花开半夏什么意思| 艾叶煮水喝有什么功效| 梅毒查血查什么项目| 发福了是什么意思| 比萨斜塔为什么是斜的| 518是什么星座| 机电一体化学什么| 原始分是什么意思| 疥疮是什么原因造成的| 什么鱼好养| 淀粉和面粉有什么区别| 鼻炎用什么药效果好| 神父和修女是什么关系| 晒背什么时候最佳时间| 卡马西平片是什么药| 圣诞节在什么时候| 欢喜是什么意思| 什么是占有欲| 蜘蛛痣是什么| 下肢水肿吃什么药| 痛风是什么感觉| 前方高能什么意思| 勾芡用什么粉最好| 明年是什么年| 6.29是什么星座| 火棉胶婴儿是什么意思| edt是什么时间| 福寿螺为什么不能吃| 三点水者念什么意思| 999是什么电话| 脚肿腿肿是什么原因引起的| 喉炎用什么药| 猕猴桃什么时候吃最好| 清华校长什么级别| sga是什么意思| 心慌心跳吃什么药| 鸟大了什么林子都有| 什么手机信号最好最强| 流产后吃什么水果好| 优思悦是什么药| 盆浴是什么意思| 嘴苦是什么情况| 范仲淹世称什么| 海子为什么自杀| 茶叶蛋用什么茶叶最好| 锋芒的意思是什么| 禄代表什么生肖| 捉奸什么意思| 喝什么解辣| 什么叫大数据| 乳房结节是什么原因引起的| 桜什么意思| 吃华法林不能吃什么| 书中自有颜如玉是什么意思| 今日什么冲什么生肖| 月经有血块是什么原因| 直率是什么意思| 哺乳期什么东西不能吃| 世界上最长的单词是什么| 报喜鸟属于什么档次| 什么是白噪音| 吃什么东西补气血| 扁桃体发炎是什么症状| 冗长是什么意思| 邪犯少阳证是什么意思| 脾胃不和吃什么药| 肺癌晚期什么症状| 流泪痣是什么意思| 湿气重吃什么能去湿气| 截单是什么意思| 什么水果降火效果最好| 感觉心慌是什么原因| 鼻尖长痘是什么原因| dha是什么| 什么情况需要打破伤风| 4.5是什么星座| 心率低吃什么药好| 口臭是什么原因引起| 胯疼是什么原因| 什么情况下吃救心丸| 逸事是什么意思| 疱疹长什么样子图片| 毒是什么意思| 左侧头疼是什么原因| 什么东西越擦越小| 取保候审是什么意思还会判刑吗| 1991年是什么命| 老死不相往来什么意思| 鞋油自然色是什么颜色| 儿童咳嗽吃什么药| 抗坏血酸是什么| 吃毓婷有什么副作用| 蛇毒有什么用| 天是什么结构的字| 1942年属什么生肖属相| 妩媚是什么意思| 虞是什么意思| 呆呆的笑是什么笑| 什么是纸片人| 水黄是什么原因| 月经不调是什么原因造成的| 网罗是什么意思| 12月10日什么星座| 喉咙长溃疡是什么原因| 五月十二号是什么日子| 甘油三酯高吃什么药最好| 牙龈肿痛用什么药好得快| 唵是什么意思| 戊肝抗体igg阳性是什么意思| 美国的国鸟是什么| 打嗝是什么原因| 黄皮是什么| 呆板是什么意思| 碳素墨水用什么能洗掉| 大人睡觉流口水是什么原因引起的| 小孩几天不大便是什么原因怎么办| 回头是岸是什么生肖| 四个火读什么字| 松香有毒吗对人体有什么危害| 扶苏姓什么| 10月19是什么星座| mc什么意思| 格力空调睡眠模式1234什么意思| 小孩咳嗽挂什么科| 嫩绿的什么| 老是掉头发什么原因| 二月二十三日是什么星座| 12月22号是什么星座| ca199偏高是什么意思| 公鸡蛋是什么| 贲门炎是什么意思| 看情况是什么意思| 干燥剂是什么成分| 一喝水就尿多是什么原因| 什么品牌的奶粉最好| 日皮是什么意思| 拔智齿后吃什么消炎药| 气管疼什么原因引起的| 摧枯拉朽是什么意思| 长裙配什么鞋子好看| mrsa医学上是什么意思| 嘴里起泡是什么原因| 清明节干什么| 伤口发痒是什么原因| 备孕需要检查什么| 因祸得福是什么意思| 吃什么能降血压| 小孩说梦话是什么原因引起的| 海南简称是什么| 胯疼是什么原因| 英语四级是什么水平| 吃什么对眼睛有好处| 为什么心里老是想着死| 婴儿什么时候长牙| 男士皮带什么品牌好| 芦荟有什么好处| 睡觉手麻是什么原因引起的女人| 减肥为什么不让吃茄子| 子宫内膜增厚是什么意思| 藏红花有什么作用和功效| 秋香绿是什么颜色| thc是什么费用| 抑郁症挂什么科室| 肾功能不好吃什么药调理| 一边脸大一边脸小是什么原因| 正常人吃叶酸有什么好处| 小腿灼热感是什么原因| 温暖的近义词是什么| 李世民字什么| 艳阳高照是什么生肖| 补钾吃什么食物| 小水滴会变成什么| aivei是什么品牌| 阳萎吃什么药| 右肺下叶钙化灶是什么意思| 9月24号是什么星座| 什么是氨基酸| 孩子过敏性咳嗽吃什么药好| 常喝枸杞泡水有什么好处| 许莫氏结节是什么意思| IQ是什么| 尿多尿频是什么原因| 月经不停吃什么药止血效果比较好| 甲状腺不均质改变是什么意思| 清宫和刮宫有什么区别| 大圆脸适合什么发型| 肝气不舒有什么症状| 下巴疼是什么原因| 长脚气是什么原因引起的| 提手旁加茶念什么| 鼻子干燥吃什么中成药| 黑猫警长叫什么名字| 规律是什么意思| 大盘是什么意思| 传导阻滞是什么意思| 木字旁与什么有关| 胎盘厚度代表什么| 宫缩是什么感觉| 七十岁老人装什么牙合适| 西瓜虫吃什么| 身体出虚汗是什么原因| 12月13号什么星座| 为什么会有生长纹| 梦见借给别人钱是什么意思| 嘴角长痘痘是什么原因| 冠状动脉肌桥是什么病| 孕妇梦见狗是什么意思| 海带属于什么类| 呢是什么意思| 鼻子毛白了是什么原因| 无冕之王是什么意思| 新加坡用什么货币| 厄瓜多尔说什么语言| 看男科挂什么门诊| 八月初十是什么星座| 什么颜色可以调成紫色| 美尼尔综合症是一种什么病| 五步蛇为什么叫五步蛇| 奥斯卡是什么意思| ood是什么意思| 中国反导弹系统叫什么| 螃蟹一般吃什么| 避孕套是什么材质| 膀胱炎吃什么药好得快| 偷换概念是什么意思| 山药和什么不能一起吃| 苍茫的天涯是我的爱是什么歌| 鑫字代表什么生肖| 欲生欲死是什么意思| 匿名是什么意思| 潜力是什么意思| 饸烙面是什么面| 疱疹是什么病啊| 过期的钙片有什么用途| 什么鱼适合红烧| 70年产权是从什么时候开始算| 床头朝什么方向是正确的| 指导员是什么级别| 不什么不什么的四字词语| 过敏性皮炎吃什么药好| 菠萝蜜吃了有什么好处| 3.1是什么星座| 什么贤什么能| 百度Jump to content

信必可为什么轻微哮喘不能用

Permanently protected module
From mediawiki.org
Module documentation
百度 上场比赛对阵活塞,哈登连续79场有三分球进账的纪录被终结,自己还一度被对手垫脚险些受伤。

This is a meta-module that implements the message box templates {{mbox}}, {{ambox}}, {{cmbox}}, {{fmbox}}, {{imbox}}, {{ombox}} and {{tmbox}}. It is intended to be used from Lua modules, and should not be used directly from wiki pages. If you want to use this module's functionality from a wiki page, please use the individual message box templates instead.

Usage

To use this module from another Lua module, first you need to load it.

local messageBox = require('Module:Message box')

To create a message box, use the main function. It takes two parameters:

  • the first is the box type (as a string).
  • the second is a table containing the message box parameters.
local box = messageBox.main( boxType, {
	param1 = param1,
	param2 = param2,
	-- More parameters...
})

There are seven available box types:

Box type Template Purpose
mbox {{mbox}} For message boxes to be used in multiple namespaces
ambox {{ambox}} For article message boxes
cmbox {{cmbox}} For category message boxes
fmbox {{fmbox}} For interface message boxes
imbox {{imbox}} For file namespace message boxes
tmbox {{tmbox}} For talk page message boxes
ombox {{ombox}} For message boxes in other namespaces

See the template page of each box type for the available parameters.

Usage from #invoke

As well as the main function, this module has separate functions for each box type. They are accessed using the code {{#invoke:Message box|mbox|...}}, {{#invoke:Message box|ambox|...}}, etc. These will work when called from other modules, but they access code used to process arguments passed from {{#invoke:...}}, and so calling them will be less efficient than calling main.

Technical details

The module uses the same basic code for each of the templates listed above; the differences between each of them are configured using the data at Module:Message box/configuration.

-- This is a meta-module for producing message box templates, including
-- {{mbox}}, {{ambox}}, {{imbox}}, {{tmbox}}, {{ombox}}, {{cmbox}} and {{fmbox}}.

-- Load necessary modules.
require('strict')
local getArgs
local yesno = require('Module:Yesno')

-- Get a language object for formatDate and ucfirst.
local lang = mw.language.getContentLanguage()

-- Define constants
local CONFIG_MODULE = 'Module:Message box/configuration'
local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}
local TEMPLATE_STYLES = 'Module:Message box/%s.css'

--------------------------------------------------------------------------------
-- 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 = {}

	obj.boxType = boxType

	-- 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]]
				obj.boxType = DEMOSPACES[demospace]
			elseif string.find( demospace, 'talk' ) then
				-- demo as a talk page
				obj.cfg = cfg.tmbox
				obj.boxType = 'tmbox'
			else
				-- default to ombox
				obj.cfg = cfg.ombox
				obj.boxType = 'ombox'
			end
		elseif ns == 0 then
			obj.cfg = cfg.ambox -- main namespace
			obj.boxType = 'ambox'
		elseif ns == 6 then
			obj.cfg = cfg.imbox -- file namespace
			obj.boxType = 'imbox'
		elseif ns == 14 then
			obj.cfg = cfg.cmbox -- category namespace
			obj.boxType = 'cmbox'
		else
			local nsTable = mw.site.namespaces[ns]
			if nsTable and nsTable.isTalk then
				obj.cfg = cfg.tmbox -- any talk namespace
				obj.boxType = 'tmbox'
			else
				obj.cfg = cfg.ombox -- other namespaces or invalid input
				obj.boxType = 'ombox'
			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
	self.classes[class] = 1
end

function MessageBox:removeClass(class)
	if not class then
		return nil
	end
	self.classes[class] = nil
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
	for _, class in ipairs(cfg.classes or {}) do
		self:addClass(class)
	end
	if self.name then
		self:addClass('box-' .. string.gsub(self.name,' ','_'))
	end
	local plainlinks = yesno(args.plainlinks)
	if plainlinks == true then
		self:addClass('plainlinks')
	elseif plainlinks == false then
		self:removeClass('plainlinks')
	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 = '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
				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(" <small class='date-container'>''(<span class='date'>%s</span>)''</small>", 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
	if cfg.imageEmptyCellStyle then
		self.imageEmptyCellStyle = 'border:none;padding:0px;width:1px'
	end

	-- 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
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.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

	-- Add TemplateStyles
	root:wikitext(mw.getCurrentFrame():extensionTag{
		name = 'templatestyles',
		args = { src = TEMPLATE_STYLES:format(self.boxType) },
	})

	-- Create the box table.
	local boxTable
	-- Check for fmbox because not all interface messages have mw-parser-output
	-- which is necessary for TemplateStyles. Add the wrapper class if it is and
	-- then start the actual mbox, else start the mbox.
	if self.boxType == 'fmbox' then
		boxTable = root:tag('div')
			:addClass('mw-parser-output')
			:tag('table')
	else
		boxTable = root:tag('table')
	end

	boxTable:attr('id', self.id or nil)
	for class, _ in pairs(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'):css('width', '52px')
		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')
			:cssText(self.imageEmptyCellStyle or nil)
	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) and not self.isSmall 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('small')
				: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'):css('width', '52px')
		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')
			:css('text-align', 'center')
			: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)
什么东西抗衰老最好 稀疏是什么意思 首饰是什么意思 st什么意思 夭寿是什么意思
什么是什么的摇篮 属兔带什么招财 增强ct是什么意思 特警是干什么的 咳黄痰吃什么药好得快
细菌性前列腺炎吃什么药 优思明是什么 黑魔鬼烟为什么是禁烟 烟头属于什么垃圾 双肺呼吸音粗是什么意思
喝什么茶可以降尿酸 八月20号是什么星座 乳腺结节低回声是什么意思 香港是什么时候回归的 部分导联st段改变是什么意思
摇花手是什么意思hcv8jop2ns9r.cn 负氧离子是什么hcv8jop6ns9r.cn 从容不迫什么意思sanhestory.com 头部紧绷感是什么原因hcv8jop6ns4r.cn 同房后出血是什么原因hcv8jop6ns6r.cn
血钾低会有什么症状inbungee.com 上眼皮浮肿是什么原因hcv9jop7ns5r.cn 什么人骗别人也骗自己dayuxmw.com 肢体拘挛是什么意思hcv8jop7ns4r.cn 糖醋里脊是什么肉做的weuuu.com
姑奶奶的老公叫什么hcv8jop6ns5r.cn 膝盖痛什么原因hcv9jop0ns6r.cn 葛根是什么东西hcv8jop3ns8r.cn 什么血型容易溶血hcv9jop0ns4r.cn 10月30日是什么星座hcv8jop3ns2r.cn
烤鱼放什么配菜好吃hcv8jop2ns8r.cn hpv56阳性是什么意思hcv9jop7ns4r.cn 粉瘤挂什么科hcv8jop0ns3r.cn 闺房是什么意思hcv9jop0ns2r.cn 交运是什么意思hcv8jop9ns6r.cn
百度