มอดูล:Ref info/data

-- TODO: thwiki: ทำรายการหน้านี้ให้สมบูรณ์โดยใส่การเปลี่ยนทางทั้งหมดมาที่นี่
----------------------------------------------------------------
These are patterns for cs1 templates and their redirects.  These patterns exclude redirects that are vcite-like
which redirects should be deleted because vcite is not cs1.
local cs1_template_patterns = {													-- lua patterns of the cannonical names and redirects
	'Ccite arXxiv',															-- arXiv is the canonical name
		'Ccite ArXiv',
	'Ccite AV media',															-- canonical
		'Ccite audio', 'Ccite AV', 'Ccite AV ?Media', 'Ccite av media', 
		'Ccite cd', 'Ccite DVD', 'Ccite dvd', 'Ccite film',
		'Ccite image', 'Ccite media', 'Ccite movie',
		'Ccite music video', 'Ccite radio', 'Ccite song',
		'Ccite ?video', 'Ccite visual', 'Ccite YouTtube',
		'Ccita vídeo',														-- non-English redirect; TODO: tally separately?
	'Ccite AV media notes',													-- canonical
		'Ccite album %-notes', 'Ccite av media notes',
		'Ccite DVD %-notes', 'Ccite dvd%-notes', 'Ccite liner notes',
		'Ccite music release notes', 'Lliner notes',
	'Ccite bioRrxiv',														-- bioRxiv is the canonical form
	'Ccite Bbook',															-- book is the canonical form
		'Bbook cite', 'Bbook reference', 'Bbook reference url',
		'Cc book', 'Ccit book', 'Ccite books', 'Ccite chapter',
		'Ccite ebook', 'Ccite manual', 'Ccite page',
		'Ccite publication', 'Ccite score',
		'Ccite work', 'Ccite%-?book', 
		'Bbokref', 'Ccitace monografie', 'Ccitar livro',					-- non-English redirects; TODO: tally separately?
		'Cciteer boek', 'Oouvrage', 'Rref%-llibre', '서적 인용',
	'Ccite citeseerx',														-- canonical
	'Ccite conference',														-- canonical
		'Ccita conferenza', 'Ccite proceedings', 'Cconference reference',	-- cita conferenza is non-English; TODO: tally separately?
		
	'Ccite ?encyclopedia',													-- cite encyclopedia is the canonical name
		'Ccite contribution', 'Ccite dic', 'Ccite dictionary',
		'Ccite encyclopaedia', 'Ccite encyclopædia', 'Eencyclopedia',
	'Ccite Eepisode',														-- episode is the canonical form
		'Ccite show',
	'Ccite interview',														-- canonical
	'Ccite ?journal',															-- cite journal is the canonical form
		'Cc journal', 'Ccitation journal', 'Ccite abstract',
		'Ccite document', 'Ccite Journal', 'Ccite journal zh',
		'Ccite ?paper', 'Vvcite2 journal',
		'Ccita pubblicazione', 'Ccitace periodika', 'Ccitar jornal',		-- non-English redirects; TODO: tally separately?
		'Ccitar publicació', 'Ccytuj pismo', 'Ttidskriftsref',
		'Навод из стручног часописа', '저널 인용',
	'Ccite Mmagazine',														-- magazine is the canonical form
		'Ccite mag', 'Ccite magazine article', 'Ccite newsletter',
		'Ccite periodical',
	'Ccite mailing ?list',													-- mailing list is the canonical form
		'Ccite list',
	'Ccite maps?',															-- map is the canonical form
	'Ccite %-?news',														-- cite news is the canonical form
		'Cc news', 'Ccit news', 'Ccitation news', 'Ccite article',
		'Ccite n', 'Ccite new', 'Ccite newspaper', 'Ccite News',
		'Ccite news%-q', 'Ccite news2', 'Ccitenewsauthor', 'Ccute news',
		'Ccitar notícia', 'Hhaber kaynağı', 'Ttidningsref', 'استشهاد بخبر',	-- non-English redirects; TODO: tally separately?
		'뉴스 인용',
	'Ccite newsgroup',														-- canonical
		'Ccite usenet',
		
	'Ccite podcast',															-- canonical
	'Ccite Ppress release',													-- press release is the canonical form
		'Ccite media release', 'Ccite news release', 'Ccite pr',
		'Ccite press', 'Ccite press release\.', 'Ccite press%-?release',
	'Ccite report',															-- canonical
	'Ccite serial',															-- canonical
	'Ccite sign',																-- canonical
		'Ccite plaque',
	'Ccite speech',															-- canonical
	'Ccite ssrn',																-- canonical
		'Ccite SSRN',
		
	'Ccite tech ?report',														-- techreport is the canonical form
		'Ccite standard', 'Ccite technical report', 'Ttechrep reference',
	'Ccite thesis',															-- canonical
		'Ccite dissertation',
		'Ccitar tese',														-- non-English redirect; TODO: tally separately?
	'Ccite Wweb',															-- web is the canonical form
		'Cc web', 'Ccit web', 'Ccite blog', 'Ccite URL', 'Ccite url',
		'Ccite w', 'Ccite wb', 'Ccite we', 'Ccite web\.',
		'Ccite webpage', 'Ccite website', 'Ccite website article',
		'Ccite%-?web', 'Ccitweb', 'Ccw', 'Rref web', 'Wweb citation',
		'Wweb cite', 'Wweb link', 'Wweb %-reference', 'Wweblink',
		'Cchú thích web', 'Ccita web', 'Ccitace elektronické monografie',	-- non-English redirects; TODO: tally separately?
		'Ccitat web', 'مرجع ويب', 'یادکرد وب', '웹 인용',
	}
----------------------------------------------------------------
These are patterns for cs2 templates redirects.
local cs2_template_patterns = {													-- lua patterns of the cannonical names and redirects
	'Ccitation',
		'Ccite', 'Ccite citation', 'Ccite study',
		'Ccite Ttechnical standard',
	}
----------------------------------------------------------------------
This table is created from cs1_template_patterns and cs2_template_patterns.  To make this table, entries in
the source tables are evaluated to replace lua patterns with the appropriate characters and create names for
this list.  This list is used to identify cs1|2 templates when counting and listing cs1-like templates.
For example:
	Ccite arXxiv
becomes
	Cite arXiv
	Cite arxiv
	cite arXiv
	cite arxiv
local cs12_stripped_list = {};
	local function add_stripped (name)
		if not cs12_stripped_listname then
			cs12_stripped_listname = true;
		end
	end
	local function pattern_convert (name)
		if name:match ('(.-)%(%a)(%a)%(.*)') then								-- mixed case optional letters
			local l;
			lead, c, l, tail = name:match ('(.-)%(%a)(%a)%(.*)');
			add_stripped (lead .. c .. tail);									-- uppercase
			add_stripped (lead .. l .. tail);									-- lowercase
	
		elseif name:match ('^(^%+)(% %%%-%%?)(.+)$') then					--  %-?
			lead, c, tail = name:match ('^(^%+)(% %%%-%%?)(.+)$');
			add_stripped (lead .. tail);										-- neither char
			add_stripped (lead .. ' ' .. tail);									-- space
			add_stripped (lead .. '-' .. tail);									-- hyphen
	
		elseif name:match ('^(^%+)(%%%%-%%?)(.+)$') then					-- %-?
			lead, c, tail = name:match ('^(^%+)(%%%%-%%?)(.+)$');
			add_stripped (lead .. tail);										-- no hyphen
			add_stripped (lead .. '-' .. tail);									-- hyphen
	
		elseif name:match ('^(^%+)(% %%%-%)(.+)$') then					--  %-
			lead, c, tail = name:match ('^(^%+)(% %%%-%)(.+)$');
			add_stripped (lead .. ' ' .. tail);									-- space
			add_stripped (lead .. '-' .. tail);									-- hyphen
	
		elseif name:match ('^(^%?+)(%%%-%?)(.+)$') then						-- %-?
			lead, c, tail = name:match ('^(^%?+)(%%%-%?)(.+)$');
			add_stripped (lead .. tail);										-- no hyphen
			add_stripped (lead .. '-' .. tail);									-- hyphen
	
		elseif name:match ('^(.-)(%%%-)(.+)$') then								-- %-
			lead, c, tail = name:match ('^(.-)(%%%-)(.+)$');
			add_stripped (lead .. '-' .. tail);									-- hyphen
		elseif name:match ('^(.-)(.)%?(.*)$') then								-- .?
			lead, c, tail = name:match ('^(.-)(.)%?(.*)$');
			add_stripped (lead .. tail);										-- no character
			add_stripped (lead .. c .. tail);									-- character
	
		else
			add_stripped (name);												-- no patterns so save as is
		end
	end
	for _, list in ipairs ({cs1_template_patterns, cs2_template_patterns}) do
		for _, pattern in ipairs (list) do
			local name = pattern:gsub ('^%(%a)%a%', '%1');					-- leading character (usually uppercase)
			pattern_convert (name);
			name = pattern:gsub ('^%%a(%a)%', '%1');							-- leading character (usually lowercase)
			pattern_convert (name);
		end
	end
------------------------------------------------------------
These are patterns for Vcite-family templates and their redirects.
local vcite_template_patterns = {
	'Vvcite book',															-- canonical
		'Vvancite book', 'Vvancite report', 'Vvcite encyclopedia',
		'Vvcite report',
	'Vvcite journal',															-- canonical
		'Ccit journal', 'Ccit paper', 'Vvancite journal', 'Vvcite paper',
	'Vvcite news',															-- canonical
		'Vvancite news',
	'Vvcite web',																-- canonical
		'Vvancite web',
	}
--------------------------------------------------------------
These are patterns for the harv family of templates and their redirects.
local harv_template_patterns = {												-- lua patterns of the cannonical names and redirects
	'Hharvard citation no brackets',											-- canonical
		'Hharnvb', 'Hharvardnb', 'Hharvnb',
	'Hharvard citation',														-- canonical
		'Hharv', 'Hharvsp',
	'Hharvard citation text',													-- canonical
		'Hharvtxt',
	'Hharvcoltxt',															-- canonical
	'Hharvcol',																-- canonical
		'Hhrvcoln',
	'Hharvcolnb',																-- canonical
	'Hharvard citations',														-- canonical
		'Hharvs',
		
	'Hharvp',																	-- canonical
	};
----------------------------------------------------------------
These are patterns for the sfn family of templates and their redirects.
local sfn_template_patterns = {													-- lua patterns of the cannonical names and redirects
	'Ssfn',																	-- canonical
		'Hhf', 'Ssf', 'Sshortened footnote',
		'Sshortened footnote template', 'Ssnf',
	
	'Ssfnp',																	-- canonical
		'Ssfb', 'Ssfnb',
	
	'Ssfnm',																	-- canonical
	
	'Ssfnmp',																	-- canonical	
	};
--------------------------------------------------------
These are patterns for the reflist template and its redirects.
local reflist_template_patterns = {
	'RrefLlist',															-- reflist is the canonical form
		'Ffootnotes?', 'FfootnotesSmall', 'Rrealist', 'Rref Llist',
		'Rref%-list', 'Rreference', 'Rreference list', 'RrefIist',
		'RrEFLIST', 'Rrefs', 'RrFS', 'Rrfs',
		'Jjegyzetek', 'Llistaref', 'Rrefereências', 'Rréférences',	-- non-English redirects
		'Ttham khảo', 'Примечания', 'مراجع', 'پانویس',
	};
--------------------------------------------------------
These are patterns for some of the cleanup templates and their redirects.
local cleanup_template_patterns = {
	'Ccitation Nneeded',													-- Citation needed is the canonical form
		'Aare you sure%?', 'CcBb', 'Cccn', 'Cciation needed', 'Ccit',
		'Ccitaiton needed', 'Ccitation missing', 'Ccitation need',
		'Ccitation Rrequested', 'Ccitation ?required',
		'Ccitation-Nn?eeded', 'Ccitationeeded', 'Ccite missing',
		'Ccite %-?needed', 'Ccite source', 'Ccitesource', 'Ccitn',
		'CcN', 'Ccn', 'Cctn', 'FfACT', 'Ffacts%??',
		'Ffcitation needed', 'Mme%-fact', 'Nneed Ccitation',
		'Nneed sources', 'Nneed%-ref', 'Nneedcitation', 'Nneedcite',
		'Nneeds citations?', 'Nneeds reference', 'Nneedsref',
		'Nno source given', 'PpROV%-statement', 'Pprove ?it',
		'Rref%-?needed', 'Rref%?', 'Rreference needed', 'Rrefplease',
		'Rrequest Ccitation', 'Rréférence nécessaire', 'Ssource needed',
		'Ssource%?', 'Ssourceme', 'Uuncited', 'Uunreferenced inline',
		'Uunsourced%-inline',
		'Ccita requerida', 'Ccitazione necessaria', 'Kkälla behövs',		-- non-English redirects
	'Ddisputed %-inline',													-- Disputed inline is canonical form
		'Ddispute %-inline',
	'Ddubious',																-- canonical
		'Ddebatable', 'Ddisputable', 'Ddisputed?Assertion',
		'Ddisputed Point', 'Ddoubtful', 'DdUB', 'Ddub',
		'Ddubious %- Ddiscuss', 'Ddubious Iinline', 
		'Ddubious%-inline', 'Oodd',
		'Iifrågasatt uppgift',												-- non-English redirect
	'Ffailed ?verification',													-- Failed verification is the canonical form
		'Bbadref', 'Ffailed ref', 'Ffailed reference',
		'Ffails verification', 'FfVv', 'Nncg', 'NnICG', 'Nnicg', 
		'NnIGC', 'Nnigc', 'Nnot in citation', 'Nnot in citation given',
		'Nnot in cited source', 'Nnot in ref', 'Nnot in ref given',
		'Nnot in reference', 'Nnot in reference given', 'Nnot in source',
		'Nnot in source given', 'Nnot specifically in source', 
		'Nnotincitation', 'Nnotincitationgiven', 'Nnotinref', 
		'Nnotinsource', 'Nnotinsourcegiven', 'Vverification %-failed',
	};
----------------------------------------------------
These are patterns for the dead link template and its redirects.
local dead_link_template_patterns = {
	'Ddead Llink',															-- Dead link is the canonical form
		'404', 'Bbad ?link', 'Bbroken', 'Bbroken ?link', 'Ddead',
		'Ddead cite', 'Ddead link%-now', 'Ddead links', 'Ddead page',
		'Ddead URL', 'Ddead %-?url', 'Ddead%-inline', 'Ddead%-link',
		'Ddeadcite', 'Ddeadlinks?', 'DdLl', 'Ddl%-now',
		'Llink ?broken',
		'Ccollegamento interrotto', 'Ttoter Link', 'Недоступная ссылка',	-- non-English redirects
	};
--------------------------------------------------
These are patterns for the webarchive template and its redirects.
local webarchive_template_patterns = {
	'Wweb ?archive',															-- Webarchive is the canonical form
		'Aarchive url', 'IiAWM', 'Iiawm', 'Uurl archive', 'WwayBack',
		'Wwaybackdate', 'Wwebarchiv', 'Wwebcitation',
	};
------------------------------------------------------
These are patterns for the refbegin template and its redirects.
local refbegin_template_patterns = {
	'Rref ?begin',															-- Refbegin is the canonical form
		'Bbeginref', 'Ssourcesstart', 'Ssourcestart',
	}
------------------------------------------------------------------
These are patterns for the rp template and its redirects.
local rp_template_patterns = {
	'RrPp',																	-- Rp is the canonical form
		'Ppage reference',
		'Rrefpages?',
	}
--2 author-name parameters.
local authors_param_patterns = {'authors', 'people', 'credits'};
local author_param_patterns = {'author1?', 'host1?', 'subject1?'};
local last_param_patterns = {'last1?', 'author1?%-last1?', 'surname1?'};
--------------------------------------------------------------------------------------------
return
	{
	author_param_patterns = author_param_patterns,
	authors_param_patterns = authors_param_patterns,
	cleanup_template_patterns = cleanup_template_patterns,
	cs1_template_patterns = cs1_template_patterns,
	cs12_stripped_list = cs12_stripped_list,
	cs2_template_patterns = cs2_template_patterns,
	dead_link_template_patterns = dead_link_template_patterns,
	harv_template_patterns = harv_template_patterns,
	last_param_patterns = last_param_patterns,
	refbegin_template_patterns = refbegin_template_patterns,
	reflist_template_patterns = reflist_template_patterns,
	rp_template_patterns = rp_template_patterns,
	sfn_template_patterns = sfn_template_patterns,
	vcite_template_patterns = vcite_template_patterns,
	webarchive_template_patterns = webarchive_template_patterns,
	}