无限极是干什么的| 碘化银什么颜色| 尿频尿急尿不尽吃什么药最快见效| 耳仓为什么是臭的| 谁与争锋是什么意思| 脾胃是什么意思| 身份证后面有个x是什么意思| 失败是成功之母是什么意思| 杂面是什么面| 失眠是什么原因导致的| 尿糖弱阳性是什么意思| 血常规五项能检查出什么病| 阁字五行属什么| 银屑病用什么药最好| 原研药是什么意思| 表情是什么意思| 小猫呕吐吃什么药| 1993年属鸡是什么命| 头抖动是什么病| 胃癌低分化是什么意思| 什么叫私人会所| ebohr手表什么牌子多少钱| 孕酮低什么原因造成的| 626什么意思| 十二月二十三是什么星座| 如饥似渴是什么意思| 何以是什么意思| 什么是人生格言| 梦见情人是什么意思啊| 喝咖啡胃疼是什么原因| 女性解脲支原体阳性吃什么药| 梵高是什么画派| 什么是力量训练| 打嗝是什么原因| 沙果是什么水果| 高血糖挂什么科室的号| 九朵玫瑰花代表什么意思| 甲状腺双叶回声欠均匀是什么意思| 腰脱是什么症状| aape是什么牌子| 吃什么可以补黑色素| 舌头发麻是什么原因引起的| 心脏积液吃什么药最好| 什么东西能吃能喝又能坐| 喉咙痛鼻塞吃什么药| 舌头挂什么科| 嗯哼的爸爸叫什么| cps是什么意思啊| 玖字五行属什么| 童子是什么| 性功能减退吃什么药| 代言是什么意思| 没有味觉是什么病| 小青柑属于什么茶| 什么叫便秘| 女生排卵是什么意思| 贫血吃什么药补血最快| 玉米须加什么治痛风| 怀孕小肚子疼是什么原因| 灯塔是什么意思| 黄芪不适合什么人吃| 舍什么为什么| 提上日程是什么意思| 低血糖是什么| 吃什么降胆固醇| 梦见打牌是什么意思| 甲炎是什么病| 吝啬什么意思| 跑业务是什么工作| 口干舌燥是什么意思| 六味地黄丸治什么病| 紫米是什么米| 强势的人有什么特点| 性激素六项什么时候查最准确| 汪星是什么意思| 性激素是什么意思| 破伤风针什么时候打| 结石有什么症状| hpv低危型是什么意思| 张柏芝和谢霆锋为什么离婚| 生蚝和牡蛎有什么区别| 肌酐升高是什么原因| 骨髓抑制什么意思| 头面是什么| 南方元旦吃什么| 白油是什么油| 梦见自己嫁人了预示着什么| 黑色素痣看什么科| 米字五行属什么| 脚底板疼是什么原因| 尾牙宴是什么意思| hpc是什么意思| 大头虾是什么意思| 2月15号是什么星座| 下午2点是什么时辰| 杨颖原名叫什么| 肝火是什么原因引起的| 女性排卵期一般是什么时候| 三叶香是什么菜| 牙杀完神经为什么还疼| 什么是发物| 什么叫阴虱| 眼镜发黄是什么原因| 今天生日什么星座| 93年是什么年| 频繁小便是什么原因| 化疗后白细胞低吃什么补得快| 陈赫开的火锅店叫什么| 大腿肿胀是什么原因| 游弋是什么意思| 10月19日什么星座| 盆腔b超检查什么| 薏苡仁是什么| 澈字五行属什么| 膝盖痛吃什么药| 庖丁是什么意思| 高密度脂蛋白是什么| 巨蟹座男和什么座最配对| 什么是帽子戏法| 平板支撑练什么| 花木兰姓什么| 疣是什么样子图片| 淋巴细胞低是什么原因| 禅师是什么意思| 杂合突变型是什么意思| 民营和私营有什么区别| 吃什么食物补肾最快| 刚怀孕吃什么水果对胎儿好| 眩晕症是什么原因引起| 欢喜是什么意思| 喘息性支气管炎吃什么药| 和田玉对身体有什么好处| mint什么颜色| 什么品种的西瓜最好吃| 黑胡椒和白胡椒有什么区别| 珙桐属于什么植物| 内什么外什么成语| 9月18日是什么日子| 眼睛干痒用什么眼药水比较好| 乳腺疼挂什么科| 喉咙痛吃什么水果| vc是什么| 梦见大水是什么意思| 化疗后吃什么药| 回绝是什么意思| 什么叫自负| 麦冬不能和什么一起吃| 苒字五行属什么| 阿西是什么意思| 艾灸什么时候做最好| 揶揄什么意思| 连麦是什么意思| 井底之蛙的寓意是什么| 怀孕不能吃什么| 3月25日是什么星座| 耳朵前面有痣代表什么| 为什么会得人乳头瘤病毒| 择日是什么意思| 阴道有灼热感是什么原因| 吃多了拉肚子是什么原因| 疏肝解郁喝什么茶| 什么叫双开| 碟鱼是什么鱼| 礼拜是什么意思| 正月二十九是什么星座| 脑癌是什么原因引起的| 下肢动脉闭塞吃什么药| 基础医学是什么| 什么是高血脂| 九加虎念什么| 火华念什么| 高是什么意思| 9月9号是什么星座| 唇系带断了有什么影响| 过期的酸奶有什么用| 岐黄是什么意思| 手背发麻是什么原因| 农历10月22日是什么星座| 梦见发大水是什么意思| 高血压可以吃什么水果| 气短咳嗽是什么原因引起的| 野人是什么意思| 朱砂是什么| 什么时候洗头最好| 2029是什么年| 生殖疱疹用什么药效果好| 青蛙吃什么食物| 什么是糖皮质激素| 什么是溃疡| 一箭双雕是指什么生肖| in77是什么意思| 广西属于什么方向| 产假什么时候开始休| 颈椎反弓是什么意思| 3ph是什么意思| 马赛克什么意思| 不在服务区是什么意思| 拔罐颜色深浅代表什么| 多吃洋葱有什么好处| 梦见杀人了是什么意思| 意外是什么意思| 棕色短裤配什么颜色上衣| 为什么一直睡不着| 梦见自己怀孕大肚子是什么预兆| 什么是人大代表| 怀挺是什么意思| 怀孕周期是从什么时候开始算的| 隔离和防晒有什么区别| 维生素b2吃多了有什么副作用| fb是什么意思| 三金片治什么病| 健身有什么好处| 氟利昂是什么味道| 血小板低是什么问题| 晚上睡觉多梦是什么原因| 六味地黄丸有什么作用| 浑身乏力吃什么药| 肚子胀气是什么原因引起的| 鹅蛋炒香菜治什么病| 尽性是什么意思| 36d什么意思| 巨蟹座喜欢什么星座| 流口水是什么病| 常吃阿司匹林有什么副作用| 晕轮效应是什么意思| 64年出生属什么| 阑尾切除后有什么影响和后遗症| 大智若愚什么意思| 来月经期间吃什么最好| 吃什么补脑增强记忆力| 脸上长黑痣是什么原因| 4月13日是什么星座| 拜观音菩萨有什么讲究| 犟驴是什么意思| 凉皮加什么才柔软筋道| 出汗多什么原因| 急性呼吸道感染是什么引起的| 合肥为什么叫合肥| ect是什么意思| 尿素是什么意思| 什么是抗体| 吃什么才能减肥最快| 胃痛吃什么药好| 边缘是什么意思| 小孩手上脱皮是什么原因| 宫腔积液排出什么颜色| 消化内科主要看什么病| 射手男喜欢什么样的女生| 风湿性心脏病吃什么药| 虚热吃什么药| 蓝加黄是什么颜色| 欠缺是什么意思| 微笑是什么意思| 高血压吃什么药最好| 盆腔炎吃什么消炎药效果好| 心脾两虚是什么意思| 人为什么会缺钾| 早期教育是什么| 散光轴位是什么| 蟑螂卵什么样| 天狼星在什么位置| 孕吐一般从什么时候开始| 玫瑰糠疹什么原因引起的| 前列腺液是什么样子| 百度Jump to content

Википедиа — Ч?л??т нэвтэрхий толь
百度 近日,一名山西网友在人民网《地方领导留言板》发帖表示,希望执法部门可以整顿“黑车”市场,“黑车”不仅扰乱了市场,而且导致正规车辆无法运营,对乘客的生命安全也有潜在的风险。
local p = {}
local args = {}
local origArgs = {}
local root
local empty_row_categories = {}
local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]'
local has_rows = false
local lists = {
	plainlist_t = {
		patterns = {
			'^plainlist$',
			'%splainlist$',
			'^plainlist%s',
			'%splainlist%s'
		},
		found = false,
		styles = 'Plainlist/styles.css'
	},
	hlist_t = {
		patterns = {
			'^hlist$',
			'%shlist$',
			'^hlist%s',
			'%shlist%s'
		},
		found = false,
		styles = 'Hlist/styles.css'
	}
}

local function has_list_class(args_to_check)
	for _, list in pairs(lists) do
		if not list.found then
			for _, arg in pairs(args_to_check) do
				for _, pattern in ipairs(list.patterns) do
					if mw.ustring.find(arg or '', pattern) then
						list.found = true
						break
					end
				end
				if list.found then break end
			end
		end
	end
end

local function fixChildBoxes(sval, tt)
	local function notempty( s ) return s and s:match( '%S' ) end
	
	if notempty(sval) then
		local marker = '<span class=special_infobox_marker>'
		local s = sval
		-- start moving templatestyles and categories inside of table rows
		local slast = ''
		while slast ~= s do
			slast = s
			s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1')
			s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1')
		end
		-- end moving templatestyles and categories inside of table rows
		s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1')
		s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker)
		if s:match(marker) then
			s = mw.ustring.gsub(s, marker .. '%s*' .. marker, '')
			s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1')
			s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1')
			s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1')
			s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1')
			s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1')
			s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1')
			s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1')
			s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1')
		end
		if s:match(marker) then
			local subcells = mw.text.split(s, marker)
			s = ''
			for k = 1, #subcells do
				if k == 1 then
					s = s .. subcells[k] .. '</' .. tt .. '></tr>'
				elseif k == #subcells then
					local rowstyle = ' style="display:none"'
					if notempty(subcells[k]) then rowstyle = ''	end
					s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' ..
						subcells[k]
				elseif notempty(subcells[k]) then
					if (k % 2) == 0 then
						s = s .. subcells[k]
					else
						s = s .. '<tr><' .. tt .. ' colspan=2>\n' ..
							subcells[k] .. '</' .. tt .. '></tr>'
					end
				end
			end
		end
		-- the next two lines add a newline at the end of lists for the PHP parser
		-- [[Special:Diff/849054481]]
		-- remove when [[:phab:T191516]] is fixed or OBE
		s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n')
		s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n')
		s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1')
		s = mw.ustring.gsub(s, '^(%{%|)', '\n%1')
		return s
	else
		return sval
	end
end

-- Cleans empty tables
local function cleanInfobox()
	root = tostring(root)
	if has_rows == false then
		root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', '')
	end
end

-- Returns the union of the values of two tables, as a sequence.
local function union(t1, t2)

	local vals = {}
	for k, v in pairs(t1) do
		vals[v] = true
	end
	for k, v in pairs(t2) do
		vals[v] = true
	end
	local ret = {}
	for k, v in pairs(vals) do
		table.insert(ret, k)
	end
	return ret
end

-- Returns a table containing the numbers of the arguments that exist
-- for the specified prefix. For example, if the prefix was 'data', and
-- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}.
local function getArgNums(prefix)
	local nums = {}
	for k, v in pairs(args) do
		local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$')
		if num then table.insert(nums, tonumber(num)) end
	end
	table.sort(nums)
	return nums
end

-- Adds a row to the infobox, with either a header cell
-- or a label/data cell combination.
local function addRow(rowArgs)
	
	if rowArgs.header and rowArgs.header ~= '_BLANK_' then
		has_rows = true
		has_list_class({ rowArgs.rowclass, rowArgs.class, args.headerclass })
		
		root
			:tag('tr')
				:addClass(rowArgs.rowclass)
				:cssText(rowArgs.rowstyle)
				:tag('th')
					:attr('colspan', '2')
					:addClass('infobox-header')
					:addClass(rowArgs.class)
					:addClass(args.headerclass)
					-- @deprecated next; target .infobox-<name> .infobox-header
					:cssText(args.headerstyle)
					:cssText(rowArgs.rowcellstyle)
					:wikitext(fixChildBoxes(rowArgs.header, 'th'))
		if rowArgs.data then
			root:wikitext(
				'[[Category:Pages using infobox templates with ignored data cells]]'
			)
		end
	elseif rowArgs.data and rowArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then
		has_rows = true
		has_list_class({ rowArgs.rowclass, rowArgs.class })
		
		local row = root:tag('tr')
		row:addClass(rowArgs.rowclass)
		row:cssText(rowArgs.rowstyle)
		if rowArgs.label then
			row
				:tag('th')
					:attr('scope', 'row')
					:addClass('infobox-label')
					-- @deprecated next; target .infobox-<name> .infobox-label
					:cssText(args.labelstyle)
					:cssText(rowArgs.rowcellstyle)
					:wikitext(rowArgs.label)
					:done()
		end

		local dataCell = row:tag('td')
		dataCell
			:attr('colspan', not rowArgs.label and '2' or nil)
			:addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data')
			:addClass(rowArgs.class)
			-- @deprecated next; target .infobox-<name> .infobox(-full)-data
			:cssText(rowArgs.datastyle)
			:cssText(rowArgs.rowcellstyle)
			:wikitext(fixChildBoxes(rowArgs.data, 'td'))
	else
		table.insert(empty_row_categories, rowArgs.data or '')
	end
end

local function renderTitle()
	if not args.title then return end

	has_rows = true
	has_list_class({args.titleclass})
	
	root
		:tag('caption')
			:addClass('infobox-title')
			:addClass(args.titleclass)
			-- @deprecated next; target .infobox-<name> .infobox-title
			:cssText(args.titlestyle)
			:wikitext(args.title)
	
end

local function renderAboveRow()
	if not args.above then return end

	has_rows = true
	has_list_class({ args.aboveclass })
	
	root
		:tag('tr')
			:tag('th')
				:attr('colspan', '2')
				:addClass('infobox-above')
				:addClass(args.aboveclass)
				-- @deprecated next; target .infobox-<name> .infobox-above
				:cssText(args.abovestyle)
				:wikitext(fixChildBoxes(args.above,'th'))
end

local function renderBelowRow()
	if not args.below then return end

	has_rows = true
	has_list_class({ args.belowclass })
	
	root
		:tag('tr')
			:tag('td')
				:attr('colspan', '2')
				:addClass('infobox-below')
				:addClass(args.belowclass)
				-- @deprecated next; target .infobox-<name> .infobox-below
				:cssText(args.belowstyle)
				:wikitext(fixChildBoxes(args.below,'td'))
end

local function addSubheaderRow(subheaderArgs)
	if subheaderArgs.data and
		subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then
		has_rows = true
		has_list_class({ subheaderArgs.rowclass, subheaderArgs.class })
		
		local row = root:tag('tr')
		row:addClass(subheaderArgs.rowclass)

		local dataCell = row:tag('td')
		dataCell
			:attr('colspan', '2')
			:addClass('infobox-subheader')
			:addClass(subheaderArgs.class)
			:cssText(subheaderArgs.datastyle)
			:cssText(subheaderArgs.rowcellstyle)
			:wikitext(fixChildBoxes(subheaderArgs.data, 'td'))
	else
		table.insert(empty_row_categories, subheaderArgs.data or '')
	end
end

local function renderSubheaders()
	if args.subheader then
		args.subheader1 = args.subheader
	end
	if args.subheaderrowclass then
		args.subheaderrowclass1 = args.subheaderrowclass
	end
	local subheadernums = getArgNums('subheader')
	for k, num in ipairs(subheadernums) do
		addSubheaderRow({
			data = args['subheader' .. tostring(num)],
			-- @deprecated next; target .infobox-<name> .infobox-subheader
			datastyle = args.subheaderstyle,
			rowcellstyle = args['subheaderstyle' .. tostring(num)],
			class = args.subheaderclass,
			rowclass = args['subheaderrowclass' .. tostring(num)]
		})
	end
end

local function addImageRow(imageArgs)

	if imageArgs.data and
		imageArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then

		has_rows = true
		has_list_class({ imageArgs.rowclass, imageArgs.class })
		
		local row = root:tag('tr')
		row:addClass(imageArgs.rowclass)

		local dataCell = row:tag('td')
		dataCell
			:attr('colspan', '2')
			:addClass('infobox-image')
			:addClass(imageArgs.class)
			:cssText(imageArgs.datastyle)
			:wikitext(fixChildBoxes(imageArgs.data, 'td'))
	else
		table.insert(empty_row_categories, imageArgs.data or '')
	end
end

local function renderImages()
	if args.image then
		args.image1 = args.image
	end
	if args.caption then
		args.caption1 = args.caption
	end
	local imagenums = getArgNums('image')
	for k, num in ipairs(imagenums) do
		local caption = args['caption' .. tostring(num)]
		local data = mw.html.create():wikitext(args['image' .. tostring(num)])
		if caption then
			data
				:tag('div')
					:addClass('infobox-caption')
					-- @deprecated next; target .infobox-<name> .infobox-caption
					:cssText(args.captionstyle)
					:wikitext(caption)
		end
		addImageRow({
			data = tostring(data),
			-- @deprecated next; target .infobox-<name> .infobox-image
			datastyle = args.imagestyle,
			class = args.imageclass,
			rowclass = args['imagerowclass' .. tostring(num)]
		})
	end
end

-- When autoheaders are turned on, preprocesses the rows
local function preprocessRows()
	if not args.autoheaders then return end
	
	local rownums = union(getArgNums('header'), getArgNums('data'))
	table.sort(rownums)
	local lastheader
	for k, num in ipairs(rownums) do
		if args['header' .. tostring(num)] then
			if lastheader then
				args['header' .. tostring(lastheader)] = nil
			end
			lastheader = num
		elseif args['data' .. tostring(num)] and
			args['data' .. tostring(num)]:gsub(
				category_in_empty_row_pattern, ''
			):match('^%S') then
			local data = args['data' .. tostring(num)]
			if data:gsub(category_in_empty_row_pattern, ''):match('%S') then
				lastheader = nil
			end
		end
	end
	if lastheader then
		args['header' .. tostring(lastheader)] = nil
	end
end

-- Gets the union of the header and data argument numbers,
-- and renders them all in order
local function renderRows()

	local rownums = union(getArgNums('header'), getArgNums('data'))
	table.sort(rownums)
	for k, num in ipairs(rownums) do
		addRow({
			header = args['header' .. tostring(num)],
			label = args['label' .. tostring(num)],
			data = args['data' .. tostring(num)],
			datastyle = args.datastyle,
			class = args['class' .. tostring(num)],
			rowclass = args['rowclass' .. tostring(num)],
			-- @deprecated next; target .infobox-<name> rowclass
			rowstyle = args['rowstyle' .. tostring(num)],
			rowcellstyle = args['rowcellstyle' .. tostring(num)]
		})
	end
end

local function renderNavBar()
	if not args.name then return end

	has_rows = true
	root
		:tag('tr')
			:tag('td')
				:attr('colspan', '2')
				:addClass('infobox-navbar')
				:wikitext(require('Module:Navbar')._navbar{
					args.name,
					mini = 1,
				})
end

local function renderItalicTitle()
	local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title'])
	if italicTitle == '' or italicTitle == 'force' or italicTitle == 'yes' then
		root:wikitext(require('Module:Italic title')._main({}))
	end
end

-- Categories in otherwise empty rows are collected in empty_row_categories.
-- This function adds them to the module output. It is not affected by
-- args.decat because this module should not prevent module-external categories
-- from rendering.
local function renderEmptyRowCategories()
	for _, s in ipairs(empty_row_categories) do
		root:wikitext(s)
	end
end

-- Render tracking categories. args.decat == turns off tracking categories.
local function renderTrackingCategories()
	if args.decat == 'yes' then return end
	if args.child == 'yes' then
		if args.title then
			root:wikitext(
				'[[Category:Pages using embedded infobox templates with the title parameter]]'
			)
		end
	elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
		root:wikitext('[[Category:Articles using infobox templates with no data rows]]')
	end
end

--[=[
Loads the templatestyles for the infobox.

TODO: FINISH loading base templatestyles here rather than in
MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables.
See [[Mediawiki_talk:Common.css/to_do#Infobox]] and/or come help :).
When we do this we should clean up the inline CSS below too.
Will have to do some bizarre conversion category like with sidebar.

]=]
local function loadTemplateStyles()
	local frame = mw.getCurrentFrame()
	
	local hlist_templatestyles = ''
	if lists.hlist_t.found then
		hlist_templatestyles = frame:extensionTag{
			name = 'templatestyles', args = { src = lists.hlist_t.styles }
		}
	end
	
	local plainlist_templatestyles = ''
	if lists.plainlist_t.found then
		plainlist_templatestyles = frame:extensionTag{
			name = 'templatestyles', args = { src = lists.plainlist_t.styles }
		}
	end
	
	-- See function description
	local base_templatestyles = frame:extensionTag{
		name = 'templatestyles', args = { src = 'Module:Инфобокс/styles.css' }
	}

	local templatestyles = ''
	if args['templatestyles'] then
		templatestyles = frame:extensionTag{
			name = 'templatestyles', args = { src = args['templatestyles'] }
		}
	end
	
	local child_templatestyles = ''
	if args['child templatestyles'] then
		child_templatestyles = frame:extensionTag{
			name = 'templatestyles', args = { src = args['child templatestyles'] }
		}
	end
	
	local grandchild_templatestyles = ''
	if args['grandchild templatestyles'] then
		grandchild_templatestyles = frame:extensionTag{
			name = 'templatestyles', args = { src = args['grandchild templatestyles'] }
		}
	end
	
	return table.concat({
		-- hlist -> plainlist -> base is best-effort to preserve old Common.css ordering.
		-- this ordering is not a guarantee because the rows of interest invoking
		-- each class may not be on a specific page
		hlist_templatestyles,
		plainlist_templatestyles,
		base_templatestyles,
		templatestyles,
		child_templatestyles,
		grandchild_templatestyles
	})
end

-- common functions between the child and non child cases
local function structure_infobox_common()
	renderSubheaders()
	renderImages()
	preprocessRows()
	renderRows()
	renderBelowRow()
	renderNavBar()
	renderItalicTitle()
	renderEmptyRowCategories()
	renderTrackingCategories()
	cleanInfobox()
end

-- Specify the overall layout of the infobox, with special settings if the
-- infobox is used as a 'child' inside another infobox.
local function _infobox()
	if args.child ~= 'yes' then
		root = mw.html.create('table')

		root
			:addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox')
			:addClass(args.bodyclass)
			-- @deprecated next; target .infobox-<name>
			:cssText(args.bodystyle)
		
		has_list_class({ args.bodyclass })

		renderTitle()
		renderAboveRow()
	else
		root = mw.html.create()

		root
			:wikitext(args.title)
	end
	structure_infobox_common()
	
	return loadTemplateStyles() .. root
end

-- If the argument exists and isn't blank, add it to the argument table.
-- Blank arguments are treated as nil to match the behaviour of ParserFunctions.
local function preprocessSingleArg(argName)
	if origArgs[argName] and origArgs[argName] ~= '' then
		args[argName] = origArgs[argName]
	end
end

-- Assign the parameters with the given prefixes to the args table, in order, in
-- batches of the step size specified. This is to prevent references etc. from
-- appearing in the wrong order. The prefixTable should be an array containing
-- tables, each of which has two possible fields, a "prefix" string and a
-- "depend" table. The function always parses parameters containing the "prefix"
-- string, but only parses parameters in the "depend" table if the prefix
-- parameter is present and non-blank.
local function preprocessArgs(prefixTable, step)
	if type(prefixTable) ~= 'table' then
		error("Non-table value detected for the prefix table", 2)
	end
	if type(step) ~= 'number' then
		error("Invalid step value detected", 2)
	end

	-- Get arguments without a number suffix, and check for bad input.
	for i,v in ipairs(prefixTable) do
		if type(v) ~= 'table' or type(v.prefix) ~= "string" or
			(v.depend and type(v.depend) ~= 'table') then
			error('Invalid input detected to preprocessArgs prefix table', 2)
		end
		preprocessSingleArg(v.prefix)
		-- Only parse the depend parameter if the prefix parameter is present
		-- and not blank.
		if args[v.prefix] and v.depend then
			for j, dependValue in ipairs(v.depend) do
				if type(dependValue) ~= 'string' then
					error('Invalid "depend" parameter value detected in preprocessArgs')
				end
				preprocessSingleArg(dependValue)
			end
		end
	end

	-- Get arguments with number suffixes.
	local a = 1 -- Counter variable.
	local moreArgumentsExist = true
	while moreArgumentsExist == true do
		moreArgumentsExist = false
		for i = a, a + step - 1 do
			for j,v in ipairs(prefixTable) do
				local prefixArgName = v.prefix .. tostring(i)
				if origArgs[prefixArgName] then
					-- Do another loop if any arguments are found, even blank ones.
					moreArgumentsExist = true
					preprocessSingleArg(prefixArgName)
				end
				-- Process the depend table if the prefix argument is present
				-- and not blank, or we are processing "prefix1" and "prefix" is
				-- present and not blank, and if the depend table is present.
				if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then
					for j,dependValue in ipairs(v.depend) do
						local dependArgName = dependValue .. tostring(i)
						preprocessSingleArg(dependArgName)
					end
				end
			end
		end
		a = a + step
	end
end

-- Parse the data parameters in the same order that the old {{infobox}} did, so
-- that references etc. will display in the expected places. Parameters that
-- depend on another parameter are only processed if that parameter is present,
-- to avoid phantom references appearing in article reference lists.
local function parseDataParameters()

	preprocessSingleArg('autoheaders')
	preprocessSingleArg('child')
	preprocessSingleArg('bodyclass')
	preprocessSingleArg('subbox')
	preprocessSingleArg('bodystyle')
	preprocessSingleArg('title')
	preprocessSingleArg('titleclass')
	preprocessSingleArg('titlestyle')
	preprocessSingleArg('above')
	preprocessSingleArg('aboveclass')
	preprocessSingleArg('abovestyle')
	preprocessArgs({
		{prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}}
	}, 10)
	preprocessSingleArg('subheaderstyle')
	preprocessSingleArg('subheaderclass')
	preprocessArgs({
		{prefix = 'image', depend = {'caption', 'imagerowclass'}}
	}, 10)
	preprocessSingleArg('captionstyle')
	preprocessSingleArg('imagestyle')
	preprocessSingleArg('imageclass')
	preprocessArgs({
		{prefix = 'header'},
		{prefix = 'data', depend = {'label'}},
		{prefix = 'rowclass'},
		{prefix = 'rowstyle'},
		{prefix = 'rowcellstyle'},
		{prefix = 'class'}
	}, 50)
	preprocessSingleArg('headerclass')
	preprocessSingleArg('headerstyle')
	preprocessSingleArg('labelstyle')
	preprocessSingleArg('datastyle')
	preprocessSingleArg('below')
	preprocessSingleArg('belowclass')
	preprocessSingleArg('belowstyle')
	preprocessSingleArg('name')
	-- different behaviour for italics if blank or absent
	args['italic title'] = origArgs['italic title']
	preprocessSingleArg('decat')
	preprocessSingleArg('templatestyles')
	preprocessSingleArg('child templatestyles')
	preprocessSingleArg('grandchild templatestyles')
end

-- If called via #invoke, use the args passed into the invoking template.
-- Otherwise, for testing purposes, assume args are being passed directly in.
function p.infobox(frame)
	if frame == mw.getCurrentFrame() then
		origArgs = frame:getParent().args
	else
		origArgs = frame
	end
	
	parseDataParameters()
	
	return _infobox()
end

-- For calling via #invoke within a template
function p.infoboxTemplate(frame)
	origArgs = {}
	for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end
	
	parseDataParameters()
	
	return _infobox()
end
return p
白月光是什么意思 阁楼是什么意思 95年的猪是什么命 骨质疏松吃什么好 胡萝卜含有什么维生素
2007年属猪五行属什么 六十天打一字是什么字 胆固醇为什么会高 双侧乳腺小叶增生是什么意思 鼻梁歪的男人说明什么
夜盲症缺什么维生素 十一月十七日是什么星座 丹田是什么器官 艾滋病早期有什么症状 吃干饭是什么意思
尿频尿急小腹胀痛吃什么药 b站是什么 梦见着大火了是什么征兆 什么是主动脉夹层 人到中年为什么会发胖
香港代购什么东西好hcv9jop3ns1r.cn 无锡机场叫什么名字hcv9jop7ns3r.cn 黄标车是什么意思hcv8jop3ns3r.cn 30周做什么检查hcv8jop2ns9r.cn 嗳气是什么意思hcv8jop1ns2r.cn
出汗多是什么原因hcv8jop0ns0r.cn 守护者是什么意思hcv9jop5ns7r.cn 爱豆是什么意思hcv8jop3ns0r.cn 治未病科是看什么病的hcv7jop6ns0r.cn 6是什么意思hcv9jop7ns1r.cn
川崎病是什么hcv8jop6ns5r.cn 上户口需要什么资料kuyehao.com 参片泡水喝有什么功效hcv7jop5ns4r.cn 月月红是什么花hcv9jop8ns3r.cn 三级医院什么意思hcv9jop6ns8r.cn
怀孕是什么感觉liaochangning.com 对线是什么意思dayuxmw.com 原发性高血压是什么意思hcv7jop7ns0r.cn 大腿痛挂什么科ff14chat.com 贾琏为什么叫二爷inbungee.com
百度