什么军官可以随身配枪| c肽是什么意思| 肝风内动吃什么中成药| 花生不能和什么食物一起吃| 血氨是什么| ahc是韩国什么档次| 我宣你是什么意思| 杭州菜属于什么菜系| o型血和b型血的孩子是什么血型| 南瓜皮可以吃吗有什么作用| 稻花鱼是什么鱼| 处女膜是什么颜色| 测子女缘什么时候到来| 高碱性食物都有什么| 做包皮挂什么科| 什么食物含铅| rhubarb是什么意思| 梦见前夫是什么意思| 药流后可以吃什么水果| 小柴胡颗粒主要治什么| 尿等待是什么症状| 880什么意思| 心胆气虚吃什么中成药| 田野里有什么| 2012年是什么命| 降维打击是什么意思| 肚子胀屁多是什么原因| 脖子发痒是什么原因| 泛是什么意思| 烫伤了抹什么| 雪人是什么生肖| 南瓜子吃多了有什么副作用| 急性牙髓炎吃什么药| 什么牌子的耳机音质效果最好| 脍炙人口什么意思| 铁罗汉是什么茶| 湿疹为什么要查肝功能| 为什么有两个六月| 腐女是什么| 慢性萎缩性胃炎吃什么药| 为什么梦不到死去的亲人| 公价是什么意思| 不要问为什么| 梦见自己流血是什么预兆| 海市蜃楼为什么可怕| 为什么感冒吃冰棒反而好了| 绿色食品是什么| gmp认证是什么意思| 减肥期间吃什么主食| 减肥可以吃什么肉| 吃什么有饱腹感还减肥| 虾皮是什么| 体脂率是什么| 身上长了好多红痣是什么原因| 十月份是什么季节| 水逆什么意思| k是什么元素| 什么的贾宝玉| 论文检索号是什么| 晚上睡觉脚底发热是什么原因| 睾丸痛什么原因| 拿铁和美式有什么区别| 牙龈化脓是什么原因| 肆无忌惮的意思是什么| 瘟疫是什么病| 什么茶降血脂最好| 茯苓什么味道| 孕妇做糖筛是检查什么| 青霉素过敏可以吃什么消炎药| 盆腔炎做什么检查能查出来| 中国为什么叫中国| 点痦子去医院挂什么科| luky是什么意思| 吃什么会导致流产| 友字五行属什么| 雾化主要治疗什么| 急性乳腺炎是什么原因引起的| 什么减肥最好最快| 今年22岁属什么生肖| 钓鲤鱼用什么饵料| 尿道流脓吃什么药| 为什么一吃饭就拉肚子| 下午1点到3点是什么时辰| 为什么会得口腔溃疡| 李元霸为什么怕罗士信| 二球是什么意思| gg是什么牌子| 去香港澳门需要什么证件| 备皮什么意思| 尿酸高是什么症状| 曼妥思是什么糖| 牛肉和什么蔬菜搭配好| 地级市市长是什么级别| 女性尿频吃什么药| 女性阴道长什么样| 把握时机是指什么生肖| 人为什么要日b| tv是什么意思| 国资委什么级别| 38节送什么礼物| 红细胞偏高是什么意思| 鼻翼长痘是什么原因| 血尿是什么颜色的| 标准是什么意思| gm眼镜是什么牌子| rip什么意思| 尿的是白色米汤是什么病| 感冒了挂什么科| 姚明什么时候退役的| 经血粉红色是什么原因| 什么是龙抬头| 胃胀打嗝吃什么药最好| 正常人为什么传导阻滞| 打喷嚏是什么意思| 头胀痛吃什么药| 什么人不能念阿弥陀佛| 红豆不能和什么一起吃| 东吴是现在的什么地方| 办理护照需要什么手续| 什么叫有氧运动| 帽缨是什么意思| 无济于事的济是什么意思| 肚子胀气用什么药| 工厂体检一般检查什么| 血小板低吃什么补的快| 老佛爷是什么意思| 甲状腺腺体回声欠均匀是什么意思| 周吴郑王是什么意思| 指甲长出来是白色的什么原因| 白事随礼钱有什么讲究| 肝介入治疗是什么意思| 痔疮发痒是什么原因| 仲夏什么意思| 什么是癣| 抗原和抗体有什么区别| punk什么意思| 大便次数增多是什么原因| 脚板痛是什么原因| bpm什么意思| 结肠多发憩室是什么意思| 县团委书记是什么级别| 体罚是什么意思| 烧钱是什么意思| 绩效工资是什么| 眉毛长痘是什么原因| 尿道尿血是什么原因| 难以启齿什么意思| 静待花开什么意思| 维生素b2是什么| fabric是什么面料| 胆固醇高不能吃什么食物| 2024年是什么命| 为什么会孕酮低| o发什么音| 中药学是干什么的| 高温什么时候结束| 再障性贫血是什么病| 什么是凶宅| 野什么意思| 社保缴费基数和工资有什么关系| 鳊鱼是什么鱼| 甘肃天水有什么好玩的地方| 中风什么症状| 引火上身是什么意思| 彩虹旗是什么意思| 牛加一笔是什么字| 拜有利主要是治疗什么| 动脉抽血为什么这么疼| 小宝贝是什么意思| 10月30日什么星座| 鸳鸯戏水是什么意思| 社区建档需要什么资料| 月经不规律吃什么药调理| 奥运会五环颜色分别代表什么| 鳄鱼怕什么| 有何特长一般填什么好| 长期失眠看什么科最好| 甲亢去医院挂什么科| 乙肝会有什么表现症状| 肛门瘙痒用什么药膏好| 冒泡是什么意思| 重力是什么| 改善记忆力吃什么药好| 什么叫前庭功能| ugg是什么品牌| 挫折是什么意思| 乳腺增生有什么症状| 女性尿血挂什么科| 孢子粉是什么| 红是什么意思| 舌苔白腻是什么原因| 月经来潮是什么意思| 什么米之乡| amk是什么品牌| 补气养阴是什么意思| 连襟什么意思| 骨扫描是检查什么| 多吃苹果有什么好处| 高锰酸钾用什么能洗掉| 转移灶是什么意思| 空腔是什么意思| 老是想睡觉是什么原因| 西林是什么药| 供血不足吃什么药效果最好| 补钙吃什么食物最好最快中老年| 脚指甲盖凹凸不平是什么原因| 背后长痘痘是什么原因| 九五年属什么生肖| 食管炎是什么原因引起的| 血液透析是什么意思| 10月30是什么星座| 守株待兔是什么生肖| 焦糖色搭配什么颜色好看| 大材小用是什么生肖| 20年是什么婚姻| 耳石症什么症状| 淋巴细胞百分比高是什么原因| w是什么单位| 凌晨的凌是什么意思| 子宫腺肌症是什么| 通情达理是什么意思| 孕中期宫缩是什么感觉| 早上起床眼睛浮肿是什么原因| 水火不容是什么意思| 秀米是什么| 生肖狗和什么生肖相冲| 蚊子有什么用| 来大姨妈适合吃什么水果| 黄金的动物是什么生肖| 月经期间喝红糖水有什么好处| 血压低什么原因| 狗剩是什么意思| 肌酸激酶高是什么病| 冰丝是什么材料| 做nt需要准备什么| 厄瓜多尔说什么语言| 舌头上有溃疡是什么原因| 月经每次都推迟是什么原因| 腿弯处的筋痛是什么原因| 阿昔洛韦片治什么病| 咽炎吃什么药最管用| spiderman是什么意思| 月球表面的坑叫什么| 慢性鼻炎用什么药| 气管炎吃什么好| 什么奶粉好吸收好消化| 脸上长痘痘去医院挂什么科| 雨字头的字有什么| 血压低吃什么水果| 鼻尖长痘是什么原因| mw是什么单位| 盘尼西林是什么药| 青汁是什么| 金银花有什么功效| 开心水是什么| 回乳是什么意思| 比特币是什么意思| 泰山石敢当是什么意思| 古代人用什么刷牙| 井代表什么数字| 达瓦里氏什么意思| 恙虫是什么虫| 大摇大摆是什么生肖| 拔得头筹是什么意思| 百度??????? ?? ?? ????

vcr什么意思

???? ????? ???????? ????????? ??
Documentation icon ??????? [?????]
百度   据统计,去年8月份以来,陕州区共办理发放金融扶贫贷款6867笔、3.64亿元,其中为2765对非贫困户与贫困户发放办理贷款1.48亿元。
local z = {
	error_cats_t = {};															-- for categorizing citations that contain errors
	error_ids_t = {};															-- list of error identifiers; used to prevent duplication of certain errors; local to this module
	error_msgs_t = {};															-- sequence table of error messages
	maint_cats_t = {};															-- for categorizing citations that aren't erroneous per se, but could use a little work
	prop_cats_t = {};															-- for categorizing citations based on certain properties, language of source for instance
	prop_keys_t = {};															-- for adding classes to the citation's <cite> tag
};


--[[--------------------------< F O R W A R D   D E C L A R A T I O N S >--------------------------------------
]]

local cfg;																		-- table of tables imported from selected Module:Citation/CS1/Configuration


--[[--------------------------< I S _ S E T >------------------------------------------------------------------

Returns true if argument is set; false otherwise. Argument is 'set' when it exists (not nil) or when it is not an empty string.

]]

local function is_set (var)
	return not (var == nil or var == '');
end


--[[--------------------------< I N _ A R R A Y >--------------------------------------------------------------

Whether needle is in haystack

]]

local function in_array (needle, haystack)
	if needle == nil then
		return false;
	end
	for n, v in ipairs (haystack) do
		if v == needle then
			return n;
		end
	end
	return false;
end


--[[--------------------------< H A S _ A C C E P T _ A S _ W R I T T E N >------------------------------------

When <str> is wholly wrapped in accept-as-written markup, return <str> without markup and true; return <str> and false else

with allow_empty = false, <str> must have at least one character inside the markup
with allow_empty = true, <str> the markup frame can be empty like (()) to distinguish an empty template parameter from the specific condition "has no applicable value" in citation-context.

After further evaluation the two cases might be merged at a later stage, but should be kept separated for now.

]]

local function has_accept_as_written (str, allow_empty)
	if not is_set (str) then
		return str, false;
	end

	local count;

	if true == allow_empty then
		str, count = str:gsub ('^%(%((.*)%)%)$', '%1'); 						-- allows (()) to be an empty set
	else
		str, count = str:gsub ('^%(%((.+)%)%)$', '%1');
	end
	return str, 0 ~= count;
end


--[[--------------------------< S U B S T I T U T E >----------------------------------------------------------

Populates numbered arguments in a message string using an argument table. <args> may be a single string or a
sequence table of multiple strings.

]]

local function substitute (msg, args)
	return args and mw.message.newRawMessage (msg, args):plain() or msg;
end


--[[--------------------------< E R R O R _ C O M M E N T >----------------------------------------------------

Wraps error messages with CSS markup according to the state of hidden. <content> may be a single string or a
sequence table of multiple strings.

]]

local function error_comment (content, hidden)
	return substitute (hidden and cfg.presentation['hidden-error'] or cfg.presentation['visible-error'], content);
end


--[[--------------------------< H Y P H E N _ T O _ D A S H >--------------------------------------------------

Converts a hyphen to a dash under certain conditions.  The hyphen must separate
like items; unlike items are returned unmodified.  These forms are modified:
	letter - letter (A - B)
	digit - digit (4-5)
	digit separator digit - digit separator digit (4.1-4.5 or 4-1-4-5)
	letterdigit - letterdigit (A1-A5) (an optional separator between letter and
		digit is supported – a.1-a.5 or a-1-a-5)
	digitletter - digitletter (5a - 5d) (an optional separator between letter and
		digit is supported – 5.a-5.d or 5-a-5-d)

any other forms are returned unmodified.

str may be a comma- or semicolon-separated list

]]

local function hyphen_to_dash (str)
	if not is_set (str) then
		return str;
	end

	local accept;																-- boolean

	str = str:gsub ("(%(%(.-%)%))", function(m) return m:gsub(",", ","):gsub(";", ";") end) -- replace commas and semicolons in accept-as-written markup with similar unicode characters so they'll be ignored during the split	
	str = str:gsub ('&[nm]dash;', {['&ndash;'] = '–', ['&mdash;'] = '—'});		-- replace &mdash; and &ndash; entities with their characters; semicolon mucks up the text.split
	str = str:gsub ('&#45;', '-'); -- replace HTML numeric entity with hyphen character
	str = str:gsub ('&nbsp;', ' '); -- replace &nbsp; entity with generic keyboard space character
	
	local out = {};
	local list = mw.text.split (str, '%s*[,;]%s*');								-- split str at comma or semicolon separators if there are any

	for _, item in ipairs (list) do												-- for each item in the list
		item, accept = has_accept_as_written (item);							-- remove accept-this-as-written markup when it wraps all of item
		if not accept and mw.ustring.match (item, '^%w*[%.%-]?%w+%s*[%-–—]%s*%w*[%.%-]?%w+$') then	-- if a hyphenated range or has endash or emdash separators
			if item:match ('^%a+[%.%-]?%d+%s*%-%s*%a+[%.%-]?%d+$') or			-- letterdigit hyphen letterdigit (optional separator between letter and digit)
				item:match ('^%d+[%.%-]?%a+%s*%-%s*%d+[%.%-]?%a+$') or			-- digitletter hyphen digitletter (optional separator between digit and letter)
				item:match ('^%d+[%.%-]%d+%s*%-%s*%d+[%.%-]%d+$') or			-- digit separator digit hyphen digit separator digit
				item:match ('^%d+%s*%-%s*%d+$') or								-- digit hyphen digit
				item:match ('^%a+%s*%-%s*%a+$') then							-- letter hyphen letter
					item = item:gsub ('(%w*[%.%-]?%w+)%s*%-%s*(%w*[%.%-]?%w+)', '%1–%2');	-- replace hyphen, remove extraneous space characters
			else
				item = mw.ustring.gsub (item, '%s*[–—]%s*', '–');				-- for endash or emdash separated ranges, replace em with en, remove extraneous whitespace
			end
		end
		table.insert (out, item);												-- add the (possibly modified) item to the output table
	end

	local temp_str = '';														-- concatenate the output table into a comma separated string
	temp_str, accept = has_accept_as_written (table.concat (out, ', '));		-- remove accept-this-as-written markup when it wraps all of concatenated out
	if accept then
		temp_str = has_accept_as_written (str);									-- when global markup removed, return original str; do it this way to suppress boolean second return value
		return temp_str:gsub(",", ","):gsub(";", ";");
	else
		return temp_str:gsub(",", ","):gsub(";", ";");						-- else, return assembled temp_str
	end
end


--[=[-------------------------< M A K E _ W I K I L I N K >----------------------------------------------------

Makes a wikilink; when both link and display text is provided, returns a wikilink in the form [[L|D]]; if only
link is provided (or link and display are the same), returns a wikilink in the form [[L]]; if neither are
provided or link is omitted, returns an empty string.

]=]

local function make_wikilink (link, display)
	if not is_set (link) then return '' end

	if is_set (display) and link ~= display then			
		return table.concat ({'[[', link, '|', display, ']]'});			
	else
		return table.concat ({'[[', link, ']]'});
	end
end


--[[--------------------------< S E T _ M E S S A G E >----------------------------------------------------------

Sets an error message using the ~/Configuration error_conditions{} table along with arguments supplied in the function
call, inserts the resulting message in z.error_msgs_t{} sequence table, and returns the error message.

<error_id> – key value for appropriate error handler in ~/Configuration error_conditions{} table 
<arguments> – may be a single string or a sequence table of multiple strings to be subsititued into error_conditions[error_id].message
<raw> – boolean
	true –	causes this function to return the error message not wrapped in visible-error, hidden-error span tag;
			returns error_conditions[error_id].hidden as a second return value
			does not add message to z.error_msgs_t sequence table
	false, nil – adds message wrapped in visible-error, hidden-error span tag to z.error_msgs_t
			returns the error message wrapped in visible-error, hidden-error span tag; there is no second return value
<prefix> – string to be prepended to <message>									-- TODO: remove support for these unused(?) arguments?
<suffix> – string to be appended to <message>

TODO: change z.error_cats_t and z.maint_cats_t to have the form cat_name = true?  this to avoid dups without having to have an extra table

]]

local added_maint_cats = {}														-- list of maintenance categories that have been added to z.maint_cats_t; TODO: figure out how to delete this table

local function set_message (error_id, arguments, raw, prefix, suffix)
	local error_state = cfg.error_conditions[error_id];
	
	prefix = prefix or '';
	suffix = suffix or '';
	
	if error_state == nil then
		error (cfg.messages['undefined_error'] .. ': ' .. error_id);			-- because missing error handler in Module:Citation/CS1/Configuration

	elseif is_set (error_state.category) then
		if error_state.message then												-- when error_state.message defined, this is an error message
			table.insert (z.error_cats_t, error_state.category);
		else
			if not added_maint_cats[error_id] then
				added_maint_cats[error_id] = true;								-- note that we've added this category
				table.insert (z.maint_cats_t, substitute (error_state.category, arguments));	-- make cat name then add to table
			end
			return;																-- because no message, nothing more to do
		end
	end

	local message = substitute (error_state.message, arguments);

	message = table.concat (
		{
		message,
		' (',
		make_wikilink (
			table.concat (
				{
				cfg.messages['help page link'],
				'#',
				error_state.anchor
				}),
			cfg.messages['help page label']),
		')'
		});

	z.error_ids_t[error_id] = true;
	if z.error_ids_t['err_citation_missing_title'] and							-- if missing-title error already noted
		in_array (error_id, {'err_bare_url_missing_title', 'err_trans_missing_title'}) then		-- and this error is one of these
			return '', false;													-- don't bother because one flavor of missing title is sufficient
	end
	
	message = table.concat ({prefix, message, suffix});

	if true == raw then
		return message, error_state.hidden;										-- return message not wrapped in visible-error, hidden-error span tag
	end		

	message = error_comment (message, error_state.hidden);						-- wrap message in visible-error, hidden-error span tag
	table.insert (z.error_msgs_t, message);										-- add it to the messages sequence table
	return message;																-- and done; return value generally not used but is used as a flag in various functions of ~/Identifiers
end


--[[-------------------------< I S _ A L I A S _ U S E D >-----------------------------------------------------

This function is used by select_one() to determine if one of a list of alias parameters is in the argument list
provided by the template.

Input:
	args – pointer to the arguments table from calling template
	alias – one of the list of possible aliases in the aliases lists from Module:Citation/CS1/Configuration
	index – for enumerated parameters, identifies which one
	enumerated – true/false flag used to choose how enumerated aliases are examined
	value – value associated with an alias that has previously been selected; nil if not yet selected
	selected – the alias that has previously been selected; nil if not yet selected
	error_list – list of aliases that are duplicates of the alias already selected

Returns:
	value – value associated with alias we selected or that was previously selected or nil if an alias not yet selected
	selected – the alias we selected or the alias that was previously selected or nil if an alias not yet selected

]]

local function is_alias_used (args, alias, index, enumerated, value, selected, error_list)
	if enumerated then															-- is this a test for an enumerated parameters?
		alias = alias:gsub ('#', index);										-- replace '#' with the value in index
	else
		alias = alias:gsub ('#', '');											-- remove '#' if it exists
	end

	if is_set (args[alias]) then												-- alias is in the template's argument list
		if value ~= nil and selected ~= alias then								-- if we have already selected one of the aliases
			local skip;
			for _, v in ipairs (error_list) do									-- spin through the error list to see if we've added this alias
				if v == alias then
					skip = true;
					break;														-- has been added so stop looking 
				end
			end
			if not skip then													-- has not been added so
				table.insert (error_list, alias);								-- add error alias to the error list
			end
		else
			value = args[alias];												-- not yet selected an alias, so select this one
			selected = alias;
		end
	end
	return value, selected;														-- return newly selected alias, or previously selected alias
end


--[[--------------------------< A D D _ M A I N T _ C A T >------------------------------------------------------

Adds a category to z.maint_cats_t using names from the configuration file with additional text if any.
To prevent duplication, the added_maint_cats table lists the categories by key that have been added to z.maint_cats_t.

]]

local function add_maint_cat (key, arguments)
	if not added_maint_cats [key] then
		added_maint_cats [key] = true;											-- note that we've added this category
		table.insert (z.maint_cats_t, substitute (cfg.maint_cats [key], arguments));	-- make name then add to table
	end
end


--[[--------------------------< A D D _ P R O P _ C A T >--------------------------------------------------------

Adds a category to z.prop_cats_t using names from the configuration file with additional text if any.

foreign_lang_source and foreign_lang_source_2 keys have a language code appended to them so that multiple languages
may be categorized but multiples of the same language are not categorized.

added_prop_cats is a table declared in page scope variables above

]]

local added_prop_cats = {};														-- list of property categories that have been added to z.prop_cats_t

local function add_prop_cat (key, arguments, key_modifier)
	local key_modified = key .. ((key_modifier and key_modifier) or '');		-- modify <key> with <key_modifier> if present and not nil
	
	if not added_prop_cats [key_modified] then
		added_prop_cats [key_modified] = true;									-- note that we've added this category
		table.insert (z.prop_cats_t, substitute (cfg.prop_cats [key], arguments));	-- make name then add to table
		table.insert (z.prop_keys_t, 'cs1-prop-' .. key);						-- convert key to class for use in the citation's <cite> tag
	end
end


--[[--------------------------< S A F E _ F O R _ I T A L I C S >----------------------------------------------

Protects a string that will be wrapped in wiki italic markup '' ... ''

Note: We cannot use <i> for italics, as the expected behavior for italics specified by ''...'' in the title is that
they will be inverted (i.e. unitalicized) in the resulting references.  In addition, <i> and '' tend to interact
poorly under Mediawiki's HTML tidy.

]]

local function safe_for_italics (str)
	if not is_set (str) then return str end

	if str:sub (1, 1) == "'" then str = "<span></span>" .. str; end
	if str:sub (-1, -1) == "'" then str = str .. "<span></span>"; end
	
	return str:gsub ('\n', ' ');												-- Remove newlines as they break italics.
end


--[[--------------------------< W R A P _ S T Y L E >----------------------------------------------------------

Applies styling to various parameters.  Supplied string is wrapped using a message_list configuration taking one
argument; protects italic styled parameters.  Additional text taken from citation_config.presentation - the reason
this function is similar to but separate from wrap_msg().

]]

local function wrap_style (key, str)
	if not is_set (str) then
		return "";
	elseif in_array (key, {'italic-title', 'trans-italic-title'}) then
		str = safe_for_italics (str);
	end

	return substitute (cfg.presentation[key], {str});
end


--[[--------------------------< M A K E _ S E P _ L I S T >------------------------------------------------------------

make a separated list of items using provided separators.
	<sep_list> - typically '<comma><space>'
	<sep_list_pair> - typically '<space>and<space>'
	<sep_list_end> - typically '<comma><space>and<space>' or '<comma><space>&<space>'

defaults to cfg.presentation['sep_list'], cfg.presentation['sep_list_pair'], and cfg.presentation['sep_list_end']
if <sep_list_end> is specified, <sep_list> and <sep_list_pair> must also be supplied

]]

local function make_sep_list (count, list_seq, sep_list, sep_list_pair, sep_list_end)
	local list = '';

	if not sep_list then														-- set the defaults
		sep_list = cfg.presentation['sep_list'];
		sep_list_pair = cfg.presentation['sep_list_pair'];
		sep_list_end = cfg.presentation['sep_list_end'];
	end
	
	if 2 >= count then
		list = table.concat (list_seq, sep_list_pair);							-- insert separator between two items; returns list_seq[1] then only one item
	elseif 2 < count then
		list = table.concat (list_seq, sep_list, 1, count - 1);					-- concatenate all but last item with plain list separator
		list = table.concat ({list, list_seq[count]}, sep_list_end);			-- concatenate last item onto end of <list> with final separator
	end
	
	return list;
end

local function make_sep_error_list (count, list_seq, sep_list, sep_list_pair, sep_list_end)
	local list = '';
	local i; local rep_count;

	local function append_string(str1,str2)
		local ret_str='';
		local rep_count;
		ret_str, rep_count = mw.ustring.gsub(str1, "</span>$", str2 .. "</span>")
		if rep_count==0 then
			ret_str = str1 .. str2;
		end
		return ret_str;
	end

	if not sep_list then														-- set the defaults
		sep_list = cfg.presentation['sep_list'];
		sep_list_pair = cfg.presentation['sep_list_pair'];
		sep_list_end = cfg.presentation['sep_list_end'];
	end
	
	if 1==count then
		list = list_seq[1]
	elseif  2 == count  then
		list = append_string(list_seq[1], sep_list_pair) .. list_seq[2]
	elseif 2 < count then
		for i = 1, count-2, 1 do
			list = list .. append_string(list_seq[i], sep_list)
		end
		list = list .. append_string(list_seq[count-1], sep_list_end) .. list_seq[count]
	end
	
	return list;
end
--[[--------------------------< S E L E C T _ O N E >----------------------------------------------------------

Chooses one matching parameter from a list of parameters to consider.  The list of parameters to consider is just
names.  For parameters that may be enumerated, the position of the numerator in the parameter name is identified
by the '#' so |author-last1= and |author1-last= are represented as 'author-last#' and 'author#-last'.

Because enumerated parameter |<param>1= is an alias of |<param>= we must test for both possibilities.


Generates an error if more than one match is present.

]]

local function select_one (args, aliases_list, error_condition, index)
	local value = nil;															-- the value assigned to the selected parameter
	local selected = '';														-- the name of the parameter we have chosen
	local error_list = {};

	if index ~= nil then index = tostring(index); end

	for _, alias in ipairs (aliases_list) do									-- for each alias in the aliases list
		if alias:match ('#') then												-- if this alias can be enumerated
			if '1' == index then												-- when index is 1 test for enumerated and non-enumerated aliases
				value, selected = is_alias_used (args, alias, index, false, value, selected, error_list);	-- first test for non-enumerated alias
			end
			value, selected = is_alias_used (args, alias, index, true, value, selected, error_list);	-- test for enumerated alias
		else
			value, selected = is_alias_used (args, alias, index, false, value, selected, error_list);	-- test for non-enumerated alias
		end
	end

	if #error_list > 0 and 'none' ~= error_condition then						-- for cases where this code is used outside of extract_names()
		for i, v in ipairs (error_list) do
			error_list[i] = wrap_style ('parameter', v);
		end
		table.insert (error_list, wrap_style ('parameter', selected));
		set_message (error_condition, {make_sep_list (#error_list, error_list)});
	end
	
	return value, selected;
end


--[=[-------------------------< R E M O V E _ W I K I _ L I N K >----------------------------------------------

Gets the display text from a wikilink like [[A|B]] or [[B]] gives B

The str:gsub() returns either A|B froma [[A|B]] or B from [[B]] or B from B (no wikilink markup).

In l(), l:gsub() removes the link and pipe (if they exist); the second :gsub() trims whitespace from the label
if str was wrapped in wikilink markup.  Presumably, this is because without wikimarkup in str, there is no match
in the initial gsub, the replacement function l() doesn't get called.

]=]

local function remove_wiki_link (str)
	return (str:gsub ("%[%[([^%[%]]*)%]%]", function(l)
		return l:gsub ("^[^|]*|(.*)$", "%1" ):gsub ("^%s*(.-)%s*$", "%1");
	end));
end


--[=[-------------------------< I S _ W I K I L I N K >--------------------------------------------------------

Determines if str is a wikilink, extracts, and returns the wikilink type, link text, and display text parts.
If str is a complex wikilink ([[L|D]]):
	returns wl_type 2 and D and L from [[L|D]];
if str is a simple wikilink ([[D]])
	returns wl_type 1 and D from [[D]] and L as empty string;
if not a wikilink:
	returns wl_type 0, str as D, and L as empty string.

trims leading and trailing whitespace and pipes from L and D ([[L|]] and [[|D]] are accepted by MediaWiki and
treated like [[D]]; while [[|D|]] is not accepted by MediaWiki, here, we accept it and return D without the pipes).

]=]

local function is_wikilink (str)
	local D, L
	local wl_type = 2;															-- assume that str is a complex wikilink [[L|D]]

	if not str:match ('^%[%[[^%]]+%]%]$') then									-- is str some sort of a wikilink (must have some sort of content)
		return 0, str, '';														-- not a wikilink; return wl_type as 0, str as D, and empty string as L
	end
	
	L, D = str:match ('^%[%[([^|]+)|([^%]]+)%]%]$');							-- get L and D from [[L|D]] 

	if not is_set (D) then														-- if no separate display
		D = str:match ('^%[%[([^%]]*)|*%]%]$');									-- get D from [[D]] or [[D|]]
		wl_type = 1; 
	end
	
	D = mw.text.trim (D, '%s|');												-- trim white space and pipe characters 
	return wl_type, D, L or '';
end


--[[--------------------------< S T R I P _ A P O S T R O P H E _ M A R K U P >--------------------------------

Strip wiki italic and bold markup from argument so that it doesn't contaminate COinS metadata.
This function strips common patterns of apostrophe markup.  We presume that editors who have taken the time to
markup a title have, as a result, provided valid markup. When they don't, some single apostrophes are left behind.

Returns the argument without wiki markup and a number; the number is more-or-less meaningless except as a flag
to indicate that markup was replaced; do not rely on it as an indicator of how many of any kind of markup was
removed; returns the argument and nil when no markup removed

]]

local function strip_apostrophe_markup (argument)
	if not is_set (argument) then
		return argument, nil;													-- no argument, nothing to do
	end

	if nil == argument:find ( "''", 1, true ) then								-- Is there at least one double apostrophe?  If not, exit.
		return argument, nil;
	end

	local flag;
	while true do
		if argument:find ("'''''", 1, true) then								-- bold italic (5)
			argument, flag = argument:gsub ("%'%'%'%'%'", "");					-- remove all instances of it
		elseif argument:find ("''''", 1, true) then								-- italic start and end without content (4)
			argument, flag=argument:gsub ("%'%'%'%'", "");
		elseif argument:find ("'''", 1, true) then								-- bold (3)
			argument, flag=argument:gsub ("%'%'%'", "");
		elseif argument:find ("''", 1, true) then								-- italic (2)
			argument, flag = argument:gsub ("%'%'", "");
		else
			break;
		end
	end

	return argument, flag;														-- done
end


--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------

Sets local cfg table to same (live or sandbox) as that used by the other modules.

]]

local function set_selected_modules (cfg_table_ptr)
	cfg = cfg_table_ptr;
	
end


--[[--------------------------< E X P O R T S >----------------------------------------------------------------
]]

return {
	add_maint_cat = add_maint_cat,												-- exported functions
	add_prop_cat = add_prop_cat,
	error_comment = error_comment,
	has_accept_as_written = has_accept_as_written,
	hyphen_to_dash = hyphen_to_dash,
	in_array = in_array,
	is_set = is_set,
	is_wikilink = is_wikilink,
	make_sep_list = make_sep_list,
	make_wikilink = make_wikilink,
	remove_wiki_link = remove_wiki_link,
	safe_for_italics = safe_for_italics,
	select_one = select_one,
	set_message = set_message,
	set_selected_modules = set_selected_modules,
	strip_apostrophe_markup = strip_apostrophe_markup,
	substitute = substitute,
	wrap_style = wrap_style,
	make_sep_error_list = make_sep_error_list,

	z = z,																		-- exported table
	}
夏天用什么泡脚最好 水猴子长什么样 兔死狗烹是什么意思 关节积液是什么原因造成的 阴道瘙痒是什么原因
镜子是什么生肖 眼角长脂肪粒是什么原因 糖耐是检查什么的 脾虚气滞吃什么中成药 手串19颗代表什么意思
脚麻吃什么药 甲亢是什么原因 午时是什么时间 梦见鸡啄我是什么意思 梦见蛇在家里是什么意思
什么叫感性的女人 刮目相看是什么意思 胡萝卜什么时候种 甲状腺功能亢进是什么意思 火车无座是什么意思
o型血阳性是什么意思hcv9jop1ns4r.cn 内裤发黄是什么原因hcv9jop5ns9r.cn 前列腺炎挂什么科hcv8jop4ns9r.cn 猫藓用什么药sscsqa.com 产复欣颗粒什么时候吃hcv8jop3ns4r.cn
木节念什么hcv9jop1ns8r.cn 廿读什么hcv9jop5ns6r.cn 感冒可以吃什么水果hcv9jop5ns0r.cn 开除党籍有什么影响hcv8jop9ns6r.cn 西红柿对人体有什么好处hcv7jop9ns8r.cn
ppa是什么意思hcv8jop9ns1r.cn 身先士卒是什么意思hcv8jop0ns9r.cn 什么菜是发物不能吃hcv8jop1ns7r.cn 坚果都有什么hcv8jop4ns8r.cn 长孙皇后为什么叫观音婢hcv9jop6ns5r.cn
窦性心动过速什么意思bfb118.com 走肾不走心什么意思hcv8jop0ns7r.cn 为什么十二生肖老鼠排第一hcv8jop3ns9r.cn 河水什么的流着hcv8jop6ns2r.cn 11月1日是什么星座hcv7jop9ns1r.cn
百度