凌晨12点是什么时辰| 痞块是什么意思| 香港车牌号是什么样子| 萘普生是什么药| 便秘是什么症状| 不适是什么意思| 胸为什么会下垂| 网剧是什么意思| 干咳无痰吃什么药效果最好| 验孕棒什么时候测| 女装什么牌子好| 打嗝和嗳气有什么区别| 腿弯处的筋痛是什么原因| 孕妇梦见猫是什么意思| 湿气重用什么泡脚最好| 企鹅吃什么食物| 上炕是什么意思| 六月一号什么星座| 胸椎退变是什么意思| 牙龈萎缩是什么原因引起的| 女孩叫锦什么好听| 稷是什么作物| 知青是什么| 盍是什么意思| 媱五行属什么| x光是检查什么的| 秋天什么水果成熟| 腹泻吃什么药最有效| 为什么天天晚上做梦| 磨玻璃结节是什么| 吃斋是什么意思| 警察在古代叫什么| 最机灵的动物是什么生肖| 826是什么星座| d二聚体是检查什么的| 强直性脊柱炎什么症状| 姊妹是什么意思| 佛法无边是什么意思| 小便有点刺痛是什么原因引起的| 双肾小结石是什么意思| 桂圆跟龙眼有什么区别| 下压高是什么原因引起的| 05年属鸡的是什么命| 洗牙挂什么科| 六月份生日是什么星座| 领结婚证需要准备什么| 任然什么意思| 嘴唇上火起泡用什么药| 八八年属什么生肖| 上火了吃什么食物降火| 柔软的近义词是什么| 榆字五行属什么| 急性肠胃炎吃什么药| 发际线高的人说明什么| 角质增生是什么意思| 治未病是什么意思| 白头发吃什么可以改善| fy是什么意思| 吃鱼肝油有什么好处| 太平猴魁属于什么茶类| lfc是什么意思| 吃什么食物可以降尿酸| 剖腹产坐月子吃什么| 咖喱饭需要什么材料| 生辰八字五行缺什么| 梦见把头发剪短了是什么意思| 一什么不什么的成语| 蚂蚁代表什么风水| 口引念什么| 百雀羚属于什么档次| bigbang是什么意思| 什么是象形字| 什么发色显皮肤白| 儿童不长个子去医院挂什么科| 蚁后长什么样| 鼻子两侧挤出来的白色东西是什么| 双侧胸膜增厚是什么意思| 假体是什么| 杨公忌日是什么意思| bni是什么意思| 八点半是什么时辰| 盥洗是什么意思| 待寝什么意思| 舍本逐末是什么意思| 头顶是什么穴位| 韩国的思密达是什么意思| 抗凝血是什么意思| 为什么鼻子无缘无故流鼻血| 吃红薯有什么好处和坏处| 不负卿是什么意思| 耳朵响吃什么药| 器质性心脏病是什么意思| 安徽有什么好吃的| 印第安老斑鸠什么意思| 肥什么拱门成语| 98年属什么| 周杰伦为什么叫jay| 黄芩有什么功效| hill什么意思| 磨平了棱角是什么意思| 吃什么减肥| 嘴干是什么病的征兆| 异次元是什么意思| 慢性胰腺炎吃什么药效果最好| 飞蚊症是什么| cdr是什么意思| 脏器灰阶立体成像是检查什么的| 47是什么生肖| sansui是什么牌子| ck是什么品牌| 失眠吃什么药最好| 靶点是什么意思| 病案号是什么| 什么是冰种翡翠| 梦见种玉米是什么意思| cpr是什么意思| 背上长痘是什么原因| 秋葵补什么| 耳朵嗡嗡响吃什么药| 协会是什么意思| 黄疸是什么症状| 衰竭是什么意思| 螚什么意思| 梦见蚂蚁是什么预兆| 淋巴转移什么意思| 上嘴唇发白是因为什么原因| 早上吃什么| 90岁叫什么| 尿素是什么肥料| 带鱼为什么是扁的| 过敏喝什么药| 冬至吃什么馅的饺子| 2004年是什么命| au9999是什么意思| 新生儿湿疹抹什么药膏| 集训是什么| 花代表什么生肖| 换气是什么意思| 小猫踩奶是什么意思| 犟嘴是什么意思| 氟骨症是什么病| 回民不吃什么| 手掌发麻是什么原因| 玄学是什么| 开口腔诊所需要什么条件| 白马怕青牛是什么意思| 眩晕吃什么药| 东南方是什么生肖| 微波炉什么牌子好| 黑色皮肤适合什么颜色的衣服| 流年花开讲的什么| 发呆是什么意思| 特种兵是什么兵种| 双规什么意思| 莲子吃了有什么好处| 石蜡病理是什么意思| 玉树临风什么意思| 劳损是什么意思| 大红袍属于什么茶类| 什么是炎症| 查生化是查些什么| 怀孕肚子会有什么反应| 麦五行属什么| 胃烧心吃什么药效果好| 什么饮料好喝| 牛蒡根泡水喝有什么好处| 阴虚火旺吃什么好| 办护照照片有什么要求| 何德何能是什么意思| 打闭经针有什么副作用| 口腔溃疡什么时候能好| nicole是什么意思| 脚二拇指比大拇指长代表什么| 头顶疼是什么原因引起的| 一马平川是什么生肖| 不忘初心方得始终是什么意思| 为什么招蚊子| 一九九二年属什么生肖| 奶茶喝多了有什么危害| 什么样的男人值得托付终身| 纪梵希为什么不娶赫本| 胃出血吃什么药好| 贫血有什么危害| 药流后吃什么消炎药| 没出息什么意思| 静脉曲张用什么药好| 人中长痘痘是什么原因| vodka是什么酒| 食古不化是什么意思| 什么的元帅| viagra是什么药| 沙漠有什么动物| 七月九号是什么日子| 湿热泄泻是什么意思| 什么是翘舌音| 朱砂有什么作用| 吃你鲍鱼是什么意思| 消停是什么意思| 什么花适合室内养| 牛肉不能和什么一起吃| 往生咒是什么意思| 吃什么排气最快| zoom 是什么意思| 薄荷有什么功效| 妹妹你坐船头是什么歌| 净身出户需要什么条件| 木是什么意思| 什么姿势最爽| 胸膜炎有什么症状| 皮肤病是什么原因造成的| 睡觉时身体抽搐是什么原因| 梦见过河是什么意思| 海底椰是什么| 脚抽筋是什么原因引起的| 44什么意思| 什么情况打破伤风| 蠢是什么意思| 八一是什么节| 月经前长痘痘是什么原因| 10015是什么电话| 沙蒜是什么| 石油是什么意思| 肠套叠是什么意思| 首重是什么意思| 四风是什么| 水命是什么意思| 黄瓜为什么苦| 滴水不漏是什么生肖| 腕管综合症吃什么药| 宵字五行属什么| 血肌酐高是什么原因| 什么叫扁平疣长什么样| 甲状腺球蛋白低是什么意思| 鸭子喜欢吃什么食物| 女右眉毛跳是什么预兆| 蝙蝠属于什么类动物| 尿道感染要吃什么药| 阿佛洛狄忒是什么神| 翻新机是什么意思| 胸口疼应该挂什么科| 什么是风象星座| 胃痛可以吃什么| 女人有腰窝意味着什么| 男的尿血是什么原因| 蛤读什么| 业已毕业是什么意思| 梦见很多虫子是什么意思| 鸡犬不宁是什么意思| 缺钾最忌讳吃什么| 护照补办需要什么材料| 什么是剧烈运动| 脸书是什么| 重庆古代叫什么| 湿痹是什么意思| 金骏眉是什么茶| 怀孕脚浮肿是什么原因引起的| 虾仁不能和什么食物一起吃| 什么东西有脚却不能走路| 脸部肌肉跳动是什么原因| 粉蒸肉的粉是什么粉| 老睡不着觉是什么原因| 亦木读什么| 什么的工作| 为什么生气会胃疼| 百度Jump to content

取消二手车限迁政策落地情况不乐观 三部委将督查

Ka Wikipedia
百度 然无念非无闻。

Documentation for this module may be created at Module:Arguments/doc

-- This module provides easy processing of arguments passed to Scribunto from
-- #invoke. It is intended for use by other Lua modules, and should not be
-- called from #invoke directly.

local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType

local arguments = {}

-- Generate four different tidyVal functions, so that we don't have to check the
-- options every time we call it.

local function tidyValDefault(key, val)
	if type(val) == 'string' then
		val = val:match('^%s*(.-)%s*$')
		if val == '' then
			return nil
		else
			return val
		end
	else
		return val
	end
end

local function tidyValTrimOnly(key, val)
	if type(val) == 'string' then
		return val:match('^%s*(.-)%s*$')
	else
		return val
	end
end

local function tidyValRemoveBlanksOnly(key, val)
	if type(val) == 'string' then
		if val:find('%S') then
			return val
		else
			return nil
		end
	else
		return val
	end
end

local function tidyValNoChange(key, val)
	return val
end

local function matchesTitle(given, title)
	local tp = type( given )
	return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title
end

local translate_mt = { __index = function(t, k) return k end }

function arguments.getArgs(frame, options)
	checkType('getArgs', 1, frame, 'table', true)
	checkType('getArgs', 2, options, 'table', true)
	frame = frame or {}
	options = options or {}

	--[[
	-- Set up argument translation.
	--]]
	options.translate = options.translate or {}
	if getmetatable(options.translate) == nil then
		setmetatable(options.translate, translate_mt)
	end
	if options.backtranslate == nil then
		options.backtranslate = {}
		for k,v in pairs(options.translate) do
			options.backtranslate[v] = k
		end
	end
	if options.backtranslate and getmetatable(options.backtranslate) == nil then
		setmetatable(options.backtranslate, {
			__index = function(t, k)
				if options.translate[k] ~= k then
					return nil
				else
					return k
				end
			end
		})
	end

	--[[
	-- Get the argument tables. If we were passed a valid frame object, get the
	-- frame arguments (fargs) and the parent frame arguments (pargs), depending
	-- on the options set and on the parent frame's availability. If we weren't
	-- passed a valid frame object, we are being called from another Lua module
	-- or from the debug console, so assume that we were passed a table of args
	-- directly, and assign it to a new variable (luaArgs).
	--]]
	local fargs, pargs, luaArgs
	if type(frame.args) == 'table' and type(frame.getParent) == 'function' then
		if options.wrappers then
			--[[
			-- The wrappers option makes Module:Arguments look up arguments in
			-- either the frame argument table or the parent argument table, but
			-- not both. This means that users can use either the #invoke syntax
			-- or a wrapper template without the loss of performance associated
			-- with looking arguments up in both the frame and the parent frame.
			-- Module:Arguments will look up arguments in the parent frame
			-- if it finds the parent frame's title in options.wrapper;
			-- otherwise it will look up arguments in the frame object passed
			-- to getArgs.
			--]]
			local parent = frame:getParent()
			if not parent then
				fargs = frame.args
			else
				local title = parent:getTitle():gsub('/sandbox$', '')
				local found = false
				if matchesTitle(options.wrappers, title) then
					found = true
				elseif type(options.wrappers) == 'table' then
					for _,v in pairs(options.wrappers) do
						if matchesTitle(v, title) then
							found = true
							break
						end
					end
				end

				-- We test for false specifically here so that nil (the default) acts like true.
				if found or options.frameOnly == false then
					pargs = parent.args
				end
				if not found or options.parentOnly == false then
					fargs = frame.args
				end
			end
		else
			-- options.wrapper isn't set, so check the other options.
			if not options.parentOnly then
				fargs = frame.args
			end
			if not options.frameOnly then
				local parent = frame:getParent()
				pargs = parent and parent.args or nil
			end
		end
		if options.parentFirst then
			fargs, pargs = pargs, fargs
		end
	else
		luaArgs = frame
	end

	-- Set the order of precedence of the argument tables. If the variables are
	-- nil, nothing will be added to the table, which is how we avoid clashes
	-- between the frame/parent args and the Lua args.
	local argTables = {fargs}
	argTables[#argTables + 1] = pargs
	argTables[#argTables + 1] = luaArgs

	--[[
	-- Generate the tidyVal function. If it has been specified by the user, we
	-- use that; if not, we choose one of four functions depending on the
	-- options chosen. This is so that we don't have to call the options table
	-- every time the function is called.
	--]]
	local tidyVal = options.valueFunc
	if tidyVal then
		if type(tidyVal) ~= 'function' then
			error(
				"bad value assigned to option 'valueFunc'"
					.. '(function expected, got '
					.. type(tidyVal)
					.. ')',
				2
			)
		end
	elseif options.trim ~= false then
		if options.removeBlanks ~= false then
			tidyVal = tidyValDefault
		else
			tidyVal = tidyValTrimOnly
		end
	else
		if options.removeBlanks ~= false then
			tidyVal = tidyValRemoveBlanksOnly
		else
			tidyVal = tidyValNoChange
		end
	end

	--[[
	-- Set up the args, metaArgs and nilArgs tables. args will be the one
	-- accessed from functions, and metaArgs will hold the actual arguments. Nil
	-- arguments are memoized in nilArgs, and the metatable connects all of them
	-- together.
	--]]
	local args, metaArgs, nilArgs, metatable = {}, {}, {}, {}
	setmetatable(args, metatable)

	local function mergeArgs(tables)
		--[[
		-- Accepts multiple tables as input and merges their keys and values
		-- into one table. If a value is already present it is not overwritten;
		-- tables listed earlier have precedence. We are also memoizing nil
		-- values, which can be overwritten if they are 's' (soft).
		--]]
		for _, t in ipairs(tables) do
			for key, val in pairs(t) do
				if metaArgs[key] == nil and nilArgs[key] ~= 'h' then
					local tidiedVal = tidyVal(key, val)
					if tidiedVal == nil then
						nilArgs[key] = 's'
					else
						metaArgs[key] = tidiedVal
					end
				end
			end
		end
	end

	--[[
	-- Define metatable behaviour. Arguments are memoized in the metaArgs table,
	-- and are only fetched from the argument tables once. Fetching arguments
	-- from the argument tables is the most resource-intensive step in this
	-- module, so we try and avoid it where possible. For this reason, nil
	-- arguments are also memoized, in the nilArgs table. Also, we keep a record
	-- in the metatable of when pairs and ipairs have been called, so we do not
	-- run pairs and ipairs on the argument tables more than once. We also do
	-- not run ipairs on fargs and pargs if pairs has already been run, as all
	-- the arguments will already have been copied over.
	--]]

	metatable.__index = function (t, key)
		--[[
		-- Fetches an argument when the args table is indexed. First we check
		-- to see if the value is memoized, and if not we try and fetch it from
		-- the argument tables. When we check memoization, we need to check
		-- metaArgs before nilArgs, as both can be non-nil at the same time.
		-- If the argument is not present in metaArgs, we also check whether
		-- pairs has been run yet. If pairs has already been run, we return nil.
		-- This is because all the arguments will have already been copied into
		-- metaArgs by the mergeArgs function, meaning that any other arguments
		-- must be nil.
		--]]
		if type(key) == 'string' then
			key = options.translate[key]
		end
		local val = metaArgs[key]
		if val ~= nil then
			return val
		elseif metatable.donePairs or nilArgs[key] then
			return nil
		end
		for _, argTable in ipairs(argTables) do
			local argTableVal = tidyVal(key, argTable[key])
			if argTableVal ~= nil then
				metaArgs[key] = argTableVal
				return argTableVal
			end
		end
		nilArgs[key] = 'h'
		return nil
	end

	metatable.__newindex = function (t, key, val)
		-- This function is called when a module tries to add a new value to the
		-- args table, or tries to change an existing value.
		if type(key) == 'string' then
			key = options.translate[key]
		end
		if options.readOnly then
			error(
				'could not write to argument table key "'
					.. tostring(key)
					.. '"; the table is read-only',
				2
			)
		elseif options.noOverwrite and args[key] ~= nil then
			error(
				'could not write to argument table key "'
					.. tostring(key)
					.. '"; overwriting existing arguments is not permitted',
				2
			)
		elseif val == nil then
			--[[
			-- If the argument is to be overwritten with nil, we need to erase
			-- the value in metaArgs, so that __index, __pairs and __ipairs do
			-- not use a previous existing value, if present; and we also need
			-- to memoize the nil in nilArgs, so that the value isn't looked
			-- up in the argument tables if it is accessed again.
			--]]
			metaArgs[key] = nil
			nilArgs[key] = 'h'
		else
			metaArgs[key] = val
		end
	end

	local function translatenext(invariant)
		local k, v = next(invariant.t, invariant.k)
		invariant.k = k
		if k == nil then
			return nil
		elseif type(k) ~= 'string' or not options.backtranslate then
			return k, v
		else
			local backtranslate = options.backtranslate[k]
			if backtranslate == nil then
				-- Skip this one. This is a tail call, so this won't cause stack overflow
				return translatenext(invariant)
			else
				return backtranslate, v
			end
		end
	end

	metatable.__pairs = function ()
		-- Called when pairs is run on the args table.
		if not metatable.donePairs then
			mergeArgs(argTables)
			metatable.donePairs = true
		end
		return translatenext, { t = metaArgs }
	end

	local function inext(t, i)
		-- This uses our __index metamethod
		local v = t[i + 1]
		if v ~= nil then
			return i + 1, v
		end
	end

	metatable.__ipairs = function (t)
		-- Called when ipairs is run on the args table.
		return inext, t, 0
	end

	return args
end

return arguments
前列腺增生用什么药 过敏性鼻炎有什么症状 尿痛什么原因 青城之恋是什么生肖 儿童拉肚子吃什么药
睾丸突然疼痛什么原因 蝉属于什么类动物 套路是什么意思 女人月经总是提前是什么原因 生僻字什么意思
每天尿都是黄的是什么原因 翔字五行属什么 艾滋病会有什么症状 肿物是什么意思 蒹葭苍苍是什么意思
腱鞘炎挂什么科室 toryburch什么牌子 罗刹女是什么意思 外感发热什么意思 什么的公鸡
肝郁症是什么病imcecn.com 痛风能吃什么东西beikeqingting.com 为什么十个络腮九个帅hcv7jop4ns6r.cn 总是打哈欠是什么原因hcv8jop8ns4r.cn 太多的借口太多的理由是什么歌hcv9jop4ns4r.cn
三月27号是什么星座hcv7jop9ns2r.cn 白醋泡脚有什么好处hcv8jop6ns5r.cn 肚脐眼位置疼是什么原因hcv8jop7ns0r.cn 生姜有什么功效hcv7jop7ns4r.cn 12月23日是什么星座hcv8jop0ns9r.cn
性激素六项查什么hcv8jop7ns2r.cn 什么是不动产权证hcv9jop7ns9r.cn 抚触是什么意思gysmod.com 仙逝是什么意思hcv9jop4ns4r.cn 倒走对身体有什么好处hcv9jop2ns3r.cn
元阳是什么意思zsyouku.com 上四休二是什么意思hcv7jop7ns1r.cn 八婆是什么意思imcecn.com 白羊女和什么星座最配hcv9jop4ns9r.cn 20分贝相当于什么声音hcv9jop0ns0r.cn
百度