狗属于什么类动物| 牙齿掉了一小块是什么原因| 如法炮制是什么意思| avia是什么牌子| 猪猪侠叫什么| 孕吐最早什么时候开始| 地图鱼吃什么| 边界尚清是什么意思| 什么叫执行力| 肌肉僵硬是什么原因| 石人工念什么| 埃及是什么人种| 为什么会突然长痣| 什么情况下会缺钾| 白粉病用什么药| 卡地亚属于什么档次| 拮抗药物是什么药| 私募是做什么的| 下眼睑肿胀是什么原因| 梦见已故长辈什么预兆| 近视是什么原因造成的| 嘴里起泡是什么原因| 梦见冬瓜是什么意思| 万圣节是什么时候| 地主代表什么生肖| 什么红什么红| 孕妇梦见很多蛇是什么意思| 绿松石是什么| 六味地黄丸是治什么病| 银为什么会变黑| 祭祀什么意思| 称中药的小秤叫什么| 六扇门是什么意思| 布帛是什么意思| 晚上10点属于什么时辰| 时点是什么意思| 71年属什么生肖| 惊为天人是什么意思| bni是什么意思| 大姨妈为什么会推迟| 晚上难以入睡是什么原因| 白羊歌词是什么意思| 人怕出名猪怕壮是什么生肖| 什么是交感神经| 上火为什么会牙疼| 斑秃是什么原因造成的| 低烧是什么原因| 类固醇是什么东西| 发好人卡是什么意思| 例假期间适合吃什么水果| 什么的小手| 煎中药用什么容器最好| 自传是什么意思| 吐槽是什么意思啊| 红细胞高是什么原因| 风湿性心脏病是什么原因引起的| 身体出虚汗是什么原因| 女性大腿酸痛什么原因| 女性排卵期出血是什么原因| 鸡飞狗跳是什么意思| 手脚肿胀是什么原因引起的| 7月23是什么星座| 为什么记忆力很差| eb病毒是什么| 银针白毫是什么茶| 品种是什么意思| 完蛋是什么意思| 属虎的生什么属相的宝宝好| 四平八稳是什么生肖| 早泄吃什么药见效| 依赖一个人是什么意思| 什么是心脏病| 耳朵痛吃什么药| 润月是什么意思| 吃金蝉有什么好处| 双甘油脂肪酸酯是什么| 南非叶有什么功效| 贫嘴什么意思| 杏花是什么生肖| 教育的本质是什么| 派出所是干什么的| 经常吃土豆有什么好处| 秉承是什么意思| 什么面玲珑| 爬高上低是什么意思| 甲亢属于什么科室| gin是什么意思| dpd是什么意思| 噩耗是什么意思| 武汉都有什么大学| 气血两亏是什么意思| 葱白是什么| 法兰绒是什么面料| 日代表什么生肖| 33朵玫瑰花代表什么| 小孩的指甲脱落是什么原因| 月字五行属什么| 儿童上火了吃什么降火最快| 舒畅的舅舅是做什么的| 脾胃虚吃什么好| 吃什么会长高| 回执单是什么意思| 单核细胞偏高是什么原因| 总是抽筋是什么原因| 桑寄生是什么| 吃什么治拉肚子| 吃皮蛋有什么好处和坏处| 狮子是什么科| 胡萝卜什么时间种| 足癣用什么药最快好| 眼皮为什么会跳| 反应性增生是什么意思| 二甲苯是什么| 血沉是查什么病的| 头爱出汗是什么原因| 微米是什么单位| 6月16日是什么日子| 疱疹是什么症状| 什么时候三伏天| 肢体拘挛是什么意思| 缺碘会有什么症状| 加盟资质需要什么条件| 血光之灾是什么意思| oppo是什么牌子| 九月四号是什么星座的| 7.23什么星座| 美尼尔综合征吃什么药| 吃什么东西可以降压| 想吃咸的是身体缺什么| 金蟾折桂什么意思| 武汉都有什么大学| 宫颈多发纳囊什么意思| 定力是什么意思| 京豆有什么用| 霸天虎和威震天是什么关系| 讲述是什么意思| 帝舵手表什么档次| 什么是有机奶粉| 金利来属于什么档次| 速干裤是什么面料| 桑葚搭配什么泡水喝最好| 象牙白适合什么肤色| 标新立异什么意思| 喜欢紫色的女人是什么性格| 硫黄和硫磺有什么区别| rhc血型阳性是什么意思| 葡萄代表什么生肖| 提手旁的字有什么| 胎盘低是什么原因造成的| 检查肺挂什么科| 舌头干燥吃什么药| 经期喝什么茶好| 黄色是什么意思| 如来是什么意思| 绝经后吃什么能来月经| 小马拉大车什么意思| 五月十九日是什么星座| 卡尔文克莱恩是什么牌子| 什么叫吐槽| 栀子花什么季节开花| 农历正月十五吃什么| 长期熬夜会得什么病| 老烂腿用什么药最好| 道家思想的核心是什么| 做肠镜前一天可以吃什么| 掌勺是什么意思| 什么是鼻窦炎| 白斑有什么症状图片| 丸吞是什么意思| 饭撒是什么意思| 6424什么意思| 9月10号什么星座| 汕是什么意思| 炖牛肉放什么| ppb是什么单位| 海棠花什么季节开花| 红润润的什么| 不解大便是什么原因| 荷尔蒙爆发是什么意思| 亡羊补牢的亡是什么意思| 不安腿是什么症状| hvi是什么病| 小手指麻木是什么原因引起的| 家里放什么最招财| 梦见大蛇是什么预兆| 拿乔是什么意思| 梦见仙鹤是什么意思| 女生吃避孕药有什么副作用| 家里为什么有小飞虫| 榴莲蜜什么味道| 西夏是现在的什么地方| 囊性回声是什么意思| 什么是三有保护动物| c2能开什么车| 特约演员什么意思| 处女座和什么座最配对| 五更是什么生肖| 足下生辉是什么意思| 偏头疼挂什么科室| 0604是什么日子| 收缩压偏高是什么意思| 草龟吃什么食物| 清热去火喝什么茶| 沉冤得雪是什么意思| 什么泡水喝降甘油三酯| 梦见男朋友是什么意思| 苔菜是什么菜| 冬天吃什么| 老妈子是什么意思| la是什么| 拉肚子应该吃什么药| 横空出世是什么意思| 双氧水是什么| 什么叫语言障碍| 剪头发叫什么手术| 围绝经期吃什么药调理| 浪荡闲游是什么生肖| 黑皮肤适合穿什么颜色的衣服| 什么零食好吃| 耳屎多是什么原因| 正确的三观是什么| pd是什么金属| c1开什么车| 做梦手机坏了什么预兆| 脱肛吃什么药| 梦见打老婆是什么预兆| 手心发热什么原因| 什么蔬菜降血压效果最好| 空气炸锅什么牌子好| 用神是什么意思| 什么样的人容易孕酮低| 孕妇无创检查是什么| 九月四号是什么星座的| 健脾胃吃什么药| 睡觉背疼是什么原因| 老白茶是什么茶| 40不惑是什么意思| 保胎吃什么食物好| 月经为什么来了一点又不来了| 梓代表什么意思| 卤牛肉用什么部位| 肌酐高是什么原因| 上午10点是什么时辰| 腹腔淋巴结肿大是什么原因| 马代表什么数字| 儿童鼻窦炎吃什么药| 木瓜和什么不能一起吃| 肝癌是什么原因引起的| 共襄盛举是什么意思| 什么是消炎药| 什么是黄体| 血液粘稠吃什么药| 2月15日什么星座| 右眼跳什么意思| 什么狗聪明听话又好养| 做造影对身体有什么伤害| 三位一体是什么生肖| 什么是琥珀| 脂肪瘤是什么引起的| 好看是什么意思| 教师节送老师什么好| 什么心什么气| 男生为什么喜欢女生叫爸爸| 12.24是什么星座| 百度Jump to content

梦见经血是什么预兆

From Wikimedia Commons, the free media repository
Lua
百度 对于道德补偿的解释机制,心理学家认为,不道德行为会导致个体的道德自我概念受到威胁,当事人会倾向于通过道德行为或者道德洁净行为来修复道德自我概念。

CodeDiscussionEditHistoryLinksLink count Subpages:DocumentationTestsResultsSandboxLive code All modules

This is a meta-module for producing message box templates, as used by:

Code

require('strict')
local getArgs
local yesno = require('Module:Yesno')
local err = require('Module:Error')
local TNT = require('Module:TNT')
local lang = mw.language.getContentLanguage()
local int_lang = mw.getCurrentFrame():preprocess('{{int:lang}}')

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

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

local function errormsg(text)
	-- create warning text
	return err.error({tag="span", message=text})
end

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 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 ambox
				obj.cfg = cfg.mbox
			end
		elseif ns == 0 then
			obj.cfg = cfg.mbox -- main namespace
		elseif ns == 6 then
			obj.cfg = cfg.mbox -- file namespace
		elseif ns == 14 then
			obj.cfg = cfg.mbox -- 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.mbox -- 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
	self.typeImageNeedsLink = typeData.imageNeedsLink

	-- 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
	
	-- Set width
	self.width = args.width
	
	-- Set margin
	self.margin = args.margin
	
	-- 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 '45x45px'
			self.imageLeft = string.format('[[File:%s|%s%s|alt=]]', self.typeImage
				or 'Information icon4.svg', imageSize, self.typeImageNeedsLink and "" or "|link=" )
		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: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
end

function MessageBox:setAllNamespaceCategories()
	local cfg = self.cfg
	
	-- Set categories for all namespaces.
	if self.invalidTypeError then
		local allSort = (self.title.namespace == 0 and 'Main:' or '') .. self.title.prefixedText
		self:addCat('all', 'Message box parameter needs fixing', allSort)
	end
	-- Deprecate license type
	if self.type == 'license' and cfg.deprecateLicense then
		self:addCat('all', 'Licensing templates based on Mbox')
	end
end

function MessageBox:setCategories()
	if 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()
	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.width then
		boxTable:cssText('width: ' .. self.width)
	end
	if self.margin then
		boxTable:cssText('margin: 2px ' .. self.margin)
	end
	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(errormsg(TNT.formatInLanguage(int_lang, 'I18n/Message box', 'err-type', 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)
什么饼不能吃脑筋急转弯 为什么手指会发麻 天冬氨酸氨基转移酶高是什么原因 des是什么意思 天麻有什么作用
阴唇发黑是什么原因 有没有什么 痛风挂什么科 为什么胃疼 鹰嘴豆是什么
身上起小红点是什么原因 拉拉裤和纸尿裤有什么区别 光敏树脂是什么材料 卵巢囊肿是什么 梦见烧火做饭是什么意思
宫颈那囊是什么 脑梗需要注意什么 阿斯巴甜是什么 什么手机拍照好看 虾和什么相克
脑梗会引起什么症状hcv9jop7ns0r.cn 7月是什么生肖hcv8jop1ns8r.cn 无花果和什么不能一起吃hcv9jop1ns4r.cn 试管婴儿是什么意思jasonfriends.com met是什么意思hcv7jop5ns5r.cn
肛门塞什么东西最舒服hcv9jop5ns4r.cn 脾胃虚寒能吃什么水果hcv7jop4ns8r.cn 闪光眼是什么症状hcv8jop1ns6r.cn 肋间神经炎吃什么药hcv7jop4ns7r.cn 窦性心律过速吃什么药hcv8jop9ns6r.cn
跑完步喝什么水最好jingluanji.com 脑血栓是什么原因引起的hcv8jop3ns7r.cn 凡人修仙传什么时候写的hcv8jop0ns8r.cn 血小板下降是什么原因hcv9jop5ns9r.cn 马牛羊鸡犬豕中的豕指的是什么hcv8jop7ns1r.cn
鼻孔里面痒是什么原因hcv7jop4ns6r.cn 横死是什么意思hcv8jop4ns5r.cn roma是什么意思hcv8jop1ns6r.cn 什么防晒霜好用hanqikai.com 什么是正骨hcv8jop0ns2r.cn
百度