モジュール:Citation/CS-ja/Configuration/sandbox

local lang_obj = mw.language.getContentLanguage();								-- make a language object for the local language; used here for languages and dates 
------------------------------------------------------------------------------------------
boolean settings used to control various things.  these setting located here to make them easy to find
																				-- these settings local to this module only
local local_digits_from_mediawiki = false;										-- for i18n; when true, module fills date_names'local_digits' from MediaWiki; manual fill required else; always false at en.wiki
local local_date_names_from_mediawiki = false;									-- for i18n; when true, module fills date_names'locallong' and date_names'localshort' from MediaWiki;
																				-- manual translation required else; ; always false at en.wiki
																				-- these settings exported to other modules
local use_identifier_redirects = true;											-- when true use redirect name for identifier label links; always true at en.wiki
local local_lang_cat_enable = false;											-- when true categorizes pages where |language=; always false at en.wiki
local date_name_auto_xlate_enable = false;										-- when true translates English month-names to the local-wiki's language month names; always false at en.wiki
local date_digit_auto_xlate_enable = false;										-- when true translates Western date digit to the local-wiki's language digits (date_names'local_digits'); always false at en.wiki
local enable_sort_keys = false;													-- when true module adds namespace sort keys to error and maintenance category links
----------------------------------------------------------
List of namespaces identifiers for namespaces that will not be included in citation error categories.
Same as setting notracking = true by default.
For wikis that have a current version of Module:cs1 documentation support, this #invoke will return an unordered
list of namespace names and their associated identifiers:
	all=
local uncategorized_namespaces_t = {2=true};										-- init with user namespace id
for k, _ in pairs (mw.site.talkNamespaces) do									-- add all talk namespace ids
	uncategorized_namespaces_tk = true;
end
local uncategorized_subpages = {'/Ssandbox', '/Ttestcases', '/^/*Llog', '/Aarchive', '/過去ログ', '/ログ'};		-- list of Lua patterns found in page names of pages we should not categorize
--2 template on a page in that namespace.
i18n: if this does not work well for your language, set  to false.
local name_space_sort_keys = {													-- sort keys to be used with these namespaces:
	4 = 'ω',																	-- wikipedia; omega
	10 = 'τ',																	-- template; tau
	118 = 'Δ', 																-- draft; delta
	'other' = 'ο',															-- all other non-talk namespaces except main (article); omicron
	}
------------------------------------------------------------------------------------------
Translation table
The following contains fixed text that may be output as part of a citation.
This is separated from the main body to aid in future translations of this
module.
local messages = {
	'agency' = '$1 $2',														-- $1 is sepc, $2 is agency
	'archived-dead' = '$2時点の$1よりアーカイブ',
	'archived-live' = '$2時点のオリジナルより$1',
	'archived-unfit' = '時点のオリジナルよりアーカイブ',
	'archived' = 'アーカイブ',
	'author' = '（著）',														-- CS-ja独自: 編者や訳者がいる場合に、著者リストの後ろに表示
	'by' = 'By',																-- contributions to authored works: introduction, foreword, afterword
	'cartography' = 'Cartography by $1',
	'editor' = '（編）',
	'editors' = '（編）',
	'edition' = '（$1版）',
	'episode' = '第$1話',
	'et al' = 'ほか',
	'in' = '。',																-- edited works
	'inactive' = '（リンク切れ、$1確認）',									-- $1はdoiのリンク切れを確認した日付（プレースホルダーは日本語版独自）
	'inset' = '$1 inset',
	'interview' = '（インタビュアー：$1）',										
	'mismatch' = '|$1=と|$2=',	-- $1 is year param name; $2 is date param name
	'newsgroup' = 'ニュースグループ：$1',
	'notitle' = 'タイトルなし',												-- for |title=(()) and (in the future) |title=none
	'origdate' = '（$1）',
	'original' = 'オリジナル',
	'published' = '（$1発行）',
	'retrieved' = '$1閲覧',
	'season' = 'シーズン$1',
	'section' = '§ $1',
	'sections' = '§§ $1',
	'series' = '〈$2〉',														-- $1 is sepc, $2 is series
	'seriesnum' = '第$1シリーズ',
	'translated' = '$1（訳）',
	'type' = '（$1）',														-- for titletype
	'written' = '$1にて',
	'vol' = '$1$2',															-- $1 is sepc; bold journal style volume is in presentation{}
	'vol-no' = '$1$2（$3号）',												-- sepc, volume, issue (alternatively insert $1 after $2, but then we'd also have to change capitalization)
	'issue' = '$1$2号',														-- $1 is sepc
	'art' = '$1 Art. $2',												-- $1 is sepc; for  only
	'vol-art' = '$1 Vol. $2, art. $3',								-- sepc, volume, article-number; for  only
	'j-vol' = '$1第$2巻',														-- sepc, volume; bold journal volume is in presentation{}
	'j-issue' = '第$1号',
	'j-article-num' = ' $1',													-- TODO: any punctuation here? static text?
	'nopp' = '$1$2';															-- page(s) without prefix; $1 is sepc
	'page(s)' = "$1$2頁",														-- CS-ja独自名称; $1 is sepc
	'news-page(s)' = "$1$2面",												-- CS-ja独自名称; $1 is sepc
	'j-page(s)' = ': $1',														-- same for page and pages
	'sheet' = '$1 Sheet $2',												-- $1 is sepc
	'sheets' = '$1 Sheets $2',											-- $1 is sepc
	'j-sheet' = ': Sheet $1',
	'j-sheets' = ': Sheets $1',
	'language' = '（$1）',
	'via' = "$1より",
	'event' = '該当時間:',
	'minutes' = '開始$1分時点',												-- プレースホルダーはCS-ja独自
	-- Determines the location of the help page
	'help page link' = 'Help:CS1テンプレートエラー',
	'help page label' = '説明',
	
	-- Categories
	'cat wikilink' = ,										-- $1 is the category name
	'cat wikilink sk' = ,									-- $1 is the category name; $2 is namespace sort key
	':cat wikilink' = 'カテゴリ',							-- category name as maintenance message wikilink; $1 is the category name
	-- Internal errors (should only occur if configuration is bad)
	'undefined_error' = 'Called with an undefined error condition',
	'unknown_ID_key' = 'Unrecognized ID key: ',								-- an ID key in id_handlers not found in ~/Identifiers func_map{}
	'unknown_ID_access' = 'Unrecognized ID access keyword: ',					-- an ID access keyword in id_handlers not found in keywords_lists'id-access'{}
	'unknown_argument_map' = 'この変数に対して定義されていない引数',
	'bare_url_no_origin' = 'Bare URL found but origin indicator is nil or empty',
	'warning_msg_e' = 'テンプレートにエラーがあります。エラーメッセージが非表示になっている可能性があります（説明）。';	-- $1 is template link
	'warning_msg_m' = 'テンプレートにメンテナンス用メッセージがあります。メッセージが非表示になっている可能性があります（説明）。';	-- $1 is template link
	}
--CitationClass= values at en.wiki match their canonical template names so are not listed here.
	local citation_class_map_t = {												-- TODO: if kept, these and all other config.CitationClass 'names' require some sort of i18n
		'arxiv' = 'arXiv',
		'audio-visual' = 'AV media',
		'AV-media-notes' = 'AV media notes',
		'biorxiv' = 'bioRxiv',
		'citeseerx' = 'CiteSeerX',
		'encyclopaedia' = 'encyclopedia',
		'mailinglist' = 'mailing list',
		'medrxiv' = 'medRxiv',
		'pressrelease' = 'press release',
		'ssrn' = 'SSRN',
		'techreport' = 'tech report',
		}
--=---------------------------------------------------------------------------
This table provides Lua patterns for the phrase "et al" and variants in name text
(author, editor, etc.). The main module uses these to identify and emit the 'etal' message.
**
local et_al_patterns = {
	";,? *\"'*%f%aEeTt%.? *AaLl%.;,\"'*$",						-- variations on the 'et al' theme
	";,? *\"'*%f%aEeTt%.? *AaLlIiAaIiEe?%.;,\"'*$",		-- variations on the 'et alia', 'et alii' and 'et aliae' themes (false positive 'et aliie' unlikely to match)
	";,? *%f%aand Oothers",												-- an alternative to et al.
	"%% *EeTt%.? *AaLl%.? *%%",										-- a wikilinked form
	"%(%( *EeTt%.? *AaLl%.? *%)%)",										-- a double-bracketed form (to counter partial removal of ((...)) syntax)
	"%(% *EeTt%.? *AaLl%.? *%)%",									-- a bracketed form
	}
----------------------------------------------------
Fixed presentation markup.  Originally part of citation_config.messages it has
been moved into its own, more semantically correct place.
local presentation = 
	{
	-- .citation-comment class is specified at Help:CS1_errors#Controlling_error_message_display
	'hidden-error' = '$1',
	'visible-error' = '$1',
	'hidden-maint' = '$1',
	
	'accessdate' = '$1$2',			-- to allow editors to hide accessdate using personal CSS
	'bdi' = '$2',												-- bidirectional isolation used with |script-title= and the like
	'cite' = '$2';									-- for use when citation does not have a namelist and |ref= not set so no id="..." attribute
	'cite-id' = '$3';							-- for use when when |ref= is set or when citation has a namelist
	'format' = ' ($1)',						-- for |format=, |chapter-format=, etc.
	'interwiki' = ' $1版',					-- for interwiki-language-linked author, editor, etc
	'interproj' = ' $1',					-- for interwiki-project-linked author, editor, etc (:d: and :s: supported; :w: ignored)
	-- various access levels, for |access=, |doi-access=, |arxiv=, ...
	-- narrow no-break space   may work better than nowrap CSS. Or not? Browser support?
	'ext-link-access-signal' = '$3',		-- external link with appropriate lock icon
		'free' = {class='id-lock-free', title='無料閲覧可'},			-- classes defined in Module:Citation/CS1/styles.css
		'registration' = {class='id-lock-registration', title='要無料登録'},
		'limited' = {class='id-lock-limited', title='無料閲覧は回数限定で可能、以降は有料購読が必要'},
		'subscription' = {class='id-lock-subscription', title='要有料購読'},
	'interwiki-icon' = '$3',
		'class-wikisource' = 'cs1-ws-icon',
	'italic-title' = "$1",												-- white-bracketed-titleへの移行が完了したら除去する
	'kern-left' = '$1',					-- spacing to use when title contains leading single or double quote mark
	'kern-right' = '$1',					-- spacing to use when title contains trailing single or double quote mark
	'nowrap1' = '$1',								-- for nowrapping an item: yyyy-mm-dd
	'nowrap2' = '$1 $2',							-- for nowrapping portions of an item: dd mmmm yyyy (note white space)
	'ocins' = ,
	
	'parameter' = '|$1=',
	'ps_ja' = '。';															-- CS-ja独自名称
	'quoted-text' = '$1',												-- for wrapping |quote= content
	'quoted-title' = '「$1」',												-- bracketed-titleへの移行が完了したら除去する
	'bracketed-title' = '「$1」',												-- CS-ja独自名称: CS1モジュールのquoted-titleに相当
	'white-bracketed-title' = '『$1』',										-- CS-ja独自名称: CS1モジュールのitalic-titleに相当
	'sep_ja' = '、',															-- CS-ja独自名称
	'sep_id' = '。',															-- CS-ja独自名称
	'sep_nl' = '、',															-- CS1|2 style name-list separator between names is a semicolon
	'sep_nl_and' = '、',														-- used as last nl sep when |name-list-style=and and list has 2 items
	'sep_nl_end' = '、',														-- used as last nl sep when |name-list-style=and and list has 3+ names
	'sep_name' = ', ',														-- CS1|2 style last/first separator is 
	'sep_nl_vanc' = ',',														-- Vancouver style name-list separator between authors is a comma
	'sep_name_vanc' = ' ',													-- Vancouver style last/first separator is a space
	'sep_list' = '、',														-- used for |language= when list has 3+ items except for last sep which uses sep_list_end
	'sep_list_pair' = '、',													-- used for |language= when list has 2 items
	'sep_list_end' = '、',													-- used as last list sep for |language= when list has 3+ items
	'trans-title' = "$1",											-- CS-ja独自名称: CS1モジュールのtrans-italic-titleとtrans-quoted-titleに相当
	'trans-italic-title' = "$1",								-- trans-titleへの移行が完了したら除去する
	'trans-quoted-title' = "$1",									-- trans-titleへの移行が完了したら除去する
	'vol-bold' = '$1 $2',												-- sepc, volume; for bold journal cites; for other cites 'vol' in messages{}
	}
	
-------------------------------------------------------------
Aliases table for commonly passed parameters.
Parameter names on the right side in the assignments in this table must have been
defined in the Whitelist before they will be recognized as valid parameter names
local aliases = {
	'AccessDate' = {'access-date', 'accessdate'},								-- Used by InternetArchiveBot
	'Agency' = 'agency',
	'ArchiveDate' = {'archive-date', 'archivedate'},							-- Used by InternetArchiveBot
	'ArchiveFormat' = 'archive-format',
	'ArchiveURL' = {'archive-url', 'archiveurl'},								-- Used by InternetArchiveBot
	'ArticleNumber' = 'article-number',
	'ASINTLD' = 'asin-tld',
	'At' = 'at',																-- Used by InternetArchiveBot
	'Authors' = {'authors', 'people', 'credits'},
	'BookTitle' = {'book-title', 'booktitle'},
	'Cartography' = 'cartography',
	'Chapter' = {'chapter', 'contribution', 'entry', 'article', 'section'},
	'ChapterFormat' = {'chapter-format', 'contribution-format', 'entry-format',
		'article-format', 'section-format'};
	'ChapterURL' = {'chapter-url', 'contribution-url', 'entry-url', 'article-url',
		'section-url', 'chapterurl', 'contributionurl', 'sectionurl'},			-- Used by InternetArchiveBot
	'ChapterUrlAccess' = {'chapter-url-access', 'contribution-url-access',
		'entry-url-access', 'article-url-access', 'section-url-access'},		-- Used by InternetArchiveBot
	'Class' = 'class',														-- cite arxiv and arxiv identifier
	'Coauthors' = {'coauthors', 'coauthor'},	--暫定対応
	'Collaboration' = 'collaboration',
	'Conference' = {'conference', 'event'},
	'ConferenceFormat' = 'conference-format',
	'ConferenceURL' = {'conference-url', 'conferenceurl'},					-- Used by InternetArchiveBot
	'Date' = {'date', 'air-date', 'airdate'},									-- air-date and airdate for cite episode and cite serial only
	'Degree' = 'degree',
	'DF' = 'df',
	'DisplayAuthors' = {'display-authors', 'display-subjects'},
	'DisplayContributors' = 'display-contributors',
	'DisplayEditors' = 'display-editors',
	'DisplayInterviewers' = 'display-interviewers',
	'DisplayTranslators' = 'display-translators',
	'Docket' = 'docket',
	'DoiBroken' = 'doi-broken-date',
	'Edition' = 'edition',
	'Editors' = 'editors',	--暫定対応
	'Embargo' = 'pmc-embargo-date',
	'Encyclopedia' = {'encyclopedia', 'encyclopaedia', 'dictionary'},			-- cite encyclopedia only
	'Episode' = 'episode',													-- cite serial only TODO: make available to cite episode?
	'Format' = 'format',
	'ID' = {'id', 'ID'},
	'Inset' = 'inset',
	'Issue' = {'issue', 'number'},
	'Language' = {'language', 'lang'},
	'MailingList' = {'mailing-list', 'mailinglist'},							-- cite mailing list only
	'Major' = 'major',														-- CS-ja独自: thesisで使用
	'Map' = 'map',															-- cite map only
	'MapFormat' = 'map-format',												-- cite map only
	'MapURL' = {'map-url', 'mapurl'},											-- cite map only -- Used by InternetArchiveBot
	'MapUrlAccess' = 'map-url-access',										-- cite map only -- Used by InternetArchiveBot
	'Minutes' = 'minutes',
	'Mode' = 'mode',
	'NameListStyle' = 'name-list-style',
	'Network' = 'network',
	'Newsgroup' = 'newsgroup',												-- cite newsgroup only
	'NoPP' = {'no-pp', 'nopp'},
	'NoTracking' = {'no-tracking', 'template-doc-demo'},
	'Number' = 'number',														-- this case only for cite techreport
	'OrigDate' = {'orig-date', 'origdate', 'orig-year', 'origyear'},
	'Others' = 'others',
	'Page' = {'page', 'p'},													-- Used by InternetArchiveBot
	'Pages' = {'pages', 'pp'},												-- Used by InternetArchiveBot
	'Periodical' = {'journal', 'magazine', 'newspaper', 'periodical', 'website', 'work'},
	'Place' = {'place', 'location'},
	'PostScript' = 'postscript',
	'PublicationDate' = {'publication-date', 'publicationdate'},
	'PublicationPlace' = {'publication-place', 'publicationplace'},
	'PublisherName' = {'publisher', 'institution'},
	'Quote' = {'quote', 'quotation'},
	'QuotePage' = 'quote-page',
	'QuotePages' = 'quote-pages',
	'Ref' = 'ref',
	'RequireAccessDate' = 'require-access-date',
	'Scale' = 'scale',
	'ScriptChapter' = {'script-chapter', 'script-contribution', 'script-entry',
		'script-article', 'script-section'},
	'ScriptEncyclopedia' = {'script-encyclopedia', 'script-encyclopaedia'},	-- cite encyclopedia only
	'ScriptMap' = 'script-map',
	'ScriptPeriodical' = {'script-journal', 'script-magazine', 'script-newspaper',
		'script-periodical', 'script-website', 'script-work'},
	'ScriptQuote' = 'script-quote',
	'ScriptTitle' = 'script-title',											-- Used by InternetArchiveBot
	'Season' = 'season',
	'Sections' = 'sections',													-- cite map only
	'Series' = {'series', 'version'},
	'SeriesLink' = {'series-link', 'serieslink'},
	'SeriesNumber' = {'series-number', 'series-no', 'seriesno'},
	'Sheet' = 'sheet',														-- cite map only
	'Sheets' = 'sheets',														-- cite map only
	'Station' = 'station',
	'Time' = 'time',
	'TimeCaption' = {'time-caption', 'timecaption'},
	'Title' = 'title',														-- Used by InternetArchiveBot
	'TitleLink' = {'title-link', 'episode-link', 'titlelink', 'episodelink'},	-- Used by InternetArchiveBot
	'TitleNote' = {'title-note', 'department'},
	'TitleType' = {'type', 'medium'},
	'TransChapter' = {'trans-article', 'trans-chapter', 'trans-contribution',
		'trans-entry', 'trans-section'},
	'Transcript' = 'transcript',
	'TranscriptFormat' = 'transcript-format',	
	'TranscriptURL' = {'transcript-url', 'transcripturl'},					-- Used by InternetArchiveBot
	'TransEncyclopedia' = {'trans-encyclopedia', 'trans-encyclopaedia'},		-- cite encyclopedia only
	'TransMap' = 'trans-map',													-- cite map only
	'TransPeriodical' = {'trans-journal', 'trans-magazine', 'trans-newspaper',
		'trans-periodical', 'trans-website', 'trans-work'},
	'TransQuote' = 'trans-quote',
	'TransTitle' = 'trans-title',												-- Used by InternetArchiveBot
	'URL' = {'url', 'URL'},													-- Used by InternetArchiveBot
	'UrlAccess' = 'url-access',												-- Used by InternetArchiveBot
	'UrlStatus' = {'url-status', 'urlstatus'},								-- Used by InternetArchiveBot
	'UrlStatusDate' = {'url-status-date', 'deadlinkdate', 'deadurldate'},
	'Vauthors' = 'vauthors',
	'Veditors' = 'veditors',
	'Via' = 'via',
	'Volume' = 'volume',
	'VolumeTitle' = 'volume-title',	--暫定対応
	'Year' = 'year',
	'AuthorList-First' = {"first#", "author-first#", "author#-first", "author-given#", "author#-given",
		"subject-first#", "subject#-first", "subject-given#", "subject#-given",
		"given#"},
	'AuthorList-Last' = {"last#", "author-last#", "author#-last", "author-surname#", "author#-surname",
		"subject-last#", "subject#-last", "subject-surname#", "subject#-surname",
		"author#", 'host#', "subject#", "surname#"},
	'AuthorList-Link' = {"author-link#", "author#-link", "subject-link#",
		"subject#-link", "authorlink#", "author#link"},
	'AuthorList-Mask' = {"author-mask#", "author#-mask", "subject-mask#", "subject#-mask"},
	'ContributorList-First' = {'contributor-first#', 'contributor#-first',
		'contributor-given#', 'contributor#-given'},
	'ContributorList-Last' = {'contributor-last#', 'contributor#-last',
		'contributor-surname#', 'contributor#-surname', 'contributor#'},
	'ContributorList-Link' = {'contributor-link#', 'contributor#-link'},
	'ContributorList-Mask' = {'contributor-mask#', 'contributor#-mask'},
	'EditorList-First' = {"editor-first#", "editor#-first", "editor-given#", "editor#-given"},
	'EditorList-Last' = {"editor-last#", "editor#-last", "editor-surname#",
		"editor#-surname", "editor#"},
	'EditorList-Link' = {"editor-link#", "editor#-link"},
	'EditorList-Mask' = {"editor-mask#", "editor#-mask"},
	
	'InterviewerList-First' = {'interviewer-first#', 'interviewer#-first',
		'interviewer-given#', 'interviewer#-given'},
	'InterviewerList-Last' = {'interviewer-last#', 'interviewer#-last',
		'interviewer-surname#', 'interviewer#-surname', 'interviewer#'},
	'InterviewerList-Link' = {'interviewer-link#', 'interviewer#-link'},
	'InterviewerList-Mask' = {'interviewer-mask#', 'interviewer#-mask'},
	'TranslatorList-First' = {'translator-first#', 'translator#-first',
		'translator-given#', 'translator#-given'},
	'TranslatorList-Last' = {'translator-last#', 'translator#-last',
		'translator-surname#', 'translator#-surname', 'translator#'},
	'TranslatorList-Link' = {'translator-link#', 'translator#-link'},
	'TranslatorList-Mask' = {'translator-mask#', 'translator#-mask'},
	}
-------------------------------------------------------
builds a table of parameter names that the extraneous terminal punctuation check should not check.
local punct_meta_params = {														-- table of aliases keys (meta parameters); each key has a table of parameter names for a value
	'BookTitle', 'Chapter', 'ScriptChapter', 'ScriptTitle', 'Title', 'TransChapter', 'Transcript', 'TransMap',	'TransTitle',	-- title-holding parameters
	'AuthorList-Mask', 'ContributorList-Mask', 'EditorList-Mask', 'InterviewerList-Mask', 'TranslatorList-Mask',	-- name-list mask may have name separators
	'PostScript', 'Quote', 'ScriptQuote', 'TransQuote', 'Ref',											-- miscellaneous
	'ArchiveURL', 'ChapterURL', 'ConferenceURL', 'MapURL', 'TranscriptURL', 'URL',			-- URL-holding parameters
	}
local url_meta_params = {														-- table of aliases keys (meta parameters); each key has a table of parameter names for a value
	'ArchiveURL', 'ChapterURL', 'ConferenceURL', 'ID', 'MapURL', 'TranscriptURL', 'URL',		-- parameters allowed to hold urls
	'Page', 'Pages', 'At', 'QuotePage', 'QuotePages',							-- insource locators allowed to hold urls
	}
local function build_skip_table (skip_t, meta_params)
	for _, meta_param in ipairs (meta_params) do								-- for each meta parameter key
		local params = aliasesmeta_param;										-- get the parameter or the table of parameters associated with the meta parameter name
		if 'string' == type (params) then
			skip_tparams = 1;													-- just a single parameter
		else
			for _, param in ipairs (params) do									-- get the parameter name
				skip_tparam = 1;												-- add the parameter name to the skip table
				local count;
				param, count = param:gsub ('#', );							-- remove enumerator marker from enumerated parameters
				if 0 ~= count then												-- if removed
					skip_tparam = 1;											-- add param name without enumerator marker
				end
			end
		end
	end
	return skip_t;
end
local punct_skip = {};
local url_skip = {};
--------------------------------------
this is a list of tlds that are known to have single-letter second-level domain names.  This list does not include
ccTLDs which are accepted in is_domain_name().
local single_letter_2nd_lvl_domains_t = {'cash', 'company', 'foundation', 'media', 'org', 'today'};
-------------------------
This table is primarily here to support internationalization.  Translations in
this table are used, for example, when an error message, category name, etc.,
is extracted from the English alias key.  There may be other cases where
this translation table may be useful.
local is_Latn = 'A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143\225\184\128-\225\187\191';
local special_case_translation = {
	'AuthorList' = 'authors list',											-- used to assemble maintenance category names
	'ContributorList' = 'contributors list',									-- translation of these names plus translation of the base maintenance category names in maint_cats{} table below
	'EditorList' = 'editors list',											-- must match the names of the actual categories
	'InterviewerList' = 'interviewers list',									-- this group or translations used by name_has_ed_markup() and name_has_mult_names()
	'TranslatorList' = 'translators list',
																				-- Lua patterns to match pseudo-titles used by InternetArchiveBot and others as placeholder for unknown |title= value
	'archived_copy' = {														-- used with CS1 maint: Archived copy as title
		'en' = '^archived?%s+copy$',											-- for English; translators: keep this because templates imported from en.wiki
		'local' = '^アーカイブコピー$',										-- translators: replace 'local' = nil with lowercase translation only when bots or tools create generic titles in your language
		},
																				-- Lua patterns to match generic titles; usually created by bots or reference filling tools
																				-- translators: replace 'local' = nil with lowercase translation only when bots or tools create generic titles in your language
		-- generic titles and patterns in this table should be lowercase only
		-- leave 'local' nil except when there is a matching generic title in your language
		-- boolean 'true' for plain-text searches; 'false' for pattern searches
	'generic_titles' = {
		'accept' = {
			},
		'reject' = {
			{'en' = {'^wayback%s+machine$', false},				'local' = nil},
			{'en' = {'are you a robot', true},					'local' = nil},
			{'en' = {'hugedomains', true},						'local' = nil},
			{'en' = {'^%(%{}%%)?$', false},		'local' = nil},
			{'en' = {'page not found', true},						'local' = nil},
			{'en' = {'subscribe to read', true},					'local' = nil},
			{'en' = {'^%(%{}%%)?$', false},		'local' = nil},
			{'en' = {'website is for sale', true},				'local' = nil},
			{'en' = {'^404', false},								'local' = nil},
			{'en' = {'error %-404', false},						'local' = nil},
			{'en' = {'internet archive wayback machine', true},	'local' = nil},
			{'en' = {'log into facebook', true},					'local' = nil},
			{'en' = {'login • instagram', true},					'local' = nil},
			{'en' = {'redirecting...', true},						'local' = nil},
			{'en' = {'usurped title', true},						'local' = nil},	-- added by a GreenC bot
			{'en' = {'webcite query result', true},				'local' = nil},
			{'en' = {'wikiwix\'s cache', true},					'local' = nil},
			}
		},
		-- boolean 'true' for plain-text searches, search string must be lowercase only
		-- boolean 'false' for pattern searches
		-- leave 'local' nil except when there is a matching generic name in your language
	'generic_names' = {
		'accept' = {
			{'en' = {'%%*%(author%) *|^%*%%', false},				'local' = nil},
			},
		'reject' = {
			{'en' = {'about us', true},										'local' = nil},
			{'en' = {'%f%aAadvisor%f%A', false},						'local' = nil},
			{'en' = {'allmusic', true},										'local' = nil},
			{'en' = {'%f%aAauthor%f%A', false},							'local' = nil},
			{'en' = {'^Bbureau$', false},									'local' = nil},
			{'en' = {'business', true},										'local' = nil},
			{'en' = {'cnn', true},											'local' = nil},
			{'en' = {'collaborator', true},									'local' = nil},
			{'en' = {'^Ccompany$', false},									'local' = nil},
			{'en' = {'contributor', true},									'local' = nil},
			{'en' = {'contact us', true},										'local' = nil},
			{'en' = {'correspondent', true},									'local' = nil},
			{'en' = {'^Ddesk$', false},										'local' = nil},
			{'en' = {'directory', true},										'local' = nil},
			{'en' = {'%f%(%%(%%s*eds?%.?%s*%)%?$', false},			'local' = nil},
			{'en' = {',%.%s%feeds?%.?$', false},							'local' = nil},
			{'en' = {'^eds?%.,;', false},									'local' = nil},
			{'en' = {'^%(%%s*EeDdSs?%.?%s*%)%', false},			'local' = nil},
			{'en' = {'%f%aEedited%f%A', false},							'local' = nil},
			{'en' = {'%f%aEeditors?%f%A', false},						'local' = nil},
			{'en' = {'%f%aEemail%f%A', false},							'local' = nil},
			{'en' = {'facebook', true},										'local' = nil},
			{'en' = {'google', true},											'local' = nil},
			{'en' = {'^Ggroup$', false},									'local' = nil},
			{'en' = {'home page', true},										'local' = nil},
			{'en' = {'^Iinc%.?$', false},									'local' = nil},
			{'en' = {'instagram', true},										'local' = nil},
			{'en' = {'interviewer', true},									'local' = nil},
			{'en' = {'^Llimited$', false},									'local' = nil},
			{'en' = {'linkedIn', true},										'local' = nil},
			{'en' = {'^Nnews$', false},										'local' = nil},
			{'en' = {'Nnews %-?Rroom', false},							'local' = nil},
			{'en' = {'pinterest', true},										'local' = nil},
			{'en' = {'policy', true},											'local' = nil},
			{'en' = {'privacy', true},										'local' = nil},
			{'en' = {'reuters', true},										'local' = nil},
			{'en' = {'translator', true},										'local' = nil},
			{'en' = {'tumblr', true},											'local' = nil},
			{'en' = {'twitter', true},										'local' = nil},
			{'en' = {'site name', true},										'local' = nil},
			{'en' = {'statement', true},										'local' = nil},
			{'en' = {'submitted', true},										'local' = nil},
			{'en' = {'super.?user', false},									'local' = nil},
			{'en' = {'%f'..is_Latn..'Uuser%f^'..is_Latn.., false},	'local' = nil},
			{'en' = {'verfasser', true},										'local' = nil},
			}
	}
	}
--------------------------------------------------------------------------------------
This table of tables lists local language date names and fallback English date names.
The code in Date_validation will look first in the local table for valid date names.
If date names are not found in the local table, the code will look in the English table.
Because citations can be copied to the local wiki from en.wiki, the English is
required when the date-name translation function date_name_xlate() is used.
In these tables, season numbering is defined by
Extended Date/Time Format (EDTF) Specification (https://www.loc.gov/standards/datetime/)
which became part of ISO 8601 in 2019.  See '§Sub-year groupings'. The standard
defines various divisions using numbers 21-41. CS1|2 only supports generic seasons.
EDTF does support the distinction between north and south hemisphere seasons
but CS1|2 has no way to make that distinction.
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
The standard does not address 'named' dates so, for the purposes of CS1|2,
Easter and Christmas are defined here as 98 and 99, which should be out of the
ISO 8601 (EDTF) range of uses for a while.
local_date_names_from_mediawiki is a boolean.  When set to:
	true – module will fetch local month names from MediaWiki for both date_names'locallong' and date_names'localshort'; this will unconditionally overwrite manual translations
	false – module will *not* fetch local month names from MediaWiki
Caveat lector:  There is no guarantee that MediaWiki will provide short month names.  At your wiki you can test
the results of the MediaWiki fetch in the debug console with this command (the result is alpha sorted):
	=mw.dumpObject (p.date_names'local')
While the module can fetch month names from MediaWiki, it cannot fetch the quarter, season, and named date names
from MediaWiki.  Those must be translated manually.
local local_date_names_from_mediawiki = false;									-- when false, manual translation required for date_names'locallong' and date_names'localshort'; overwrites manual translations
																				-- when true, module fetches long and short month names from MediaWiki
local date_names = {
	'en' = {																	-- English
		'long'	= {'January' = 1, 'February' = 2, 'March' = 3, 'April' = 4, 'May' = 5, 'June' = 6, 'July' = 7, 'August' = 8, 'September' = 9, 'October' = 10, 'November' = 11, 'December' = 12},
		'short'	= {'Jan' = 1, 'Feb' = 2, 'Mar' = 3, 'Apr' = 4, 'May' = 5, 'Jun' = 6, 'Jul' = 7, 'Aug' = 8, 'Sep' = 9, 'Oct' = 10, 'Nov' = 11, 'Dec' = 12},
		'quarter' = {'First Quarter' = 33, 'Second Quarter' = 34, 'Third Quarter' = 35, 'Fourth Quarter' = 36},
		'season'	= {'Winter' = 24, 'Spring' = 21, 'Summer' = 22, 'Fall' = 23, 'Autumn' = 23},
		'named'	= {'Easter' = 98, 'Christmas' = 99},
		},
																				-- when local_date_names_from_mediawiki = false
	'local' = {																-- replace these English date names with the local language equivalents
		'long'	= {'1月' = 1, '2月' = 2, '3月' = 3, '4月' = 4, '5月' = 5, '6月' = 6, '7月' = 7, '8月' = 8, '9月' = 9, '10月' = 10, '11月' = 11, '12月' = 12},
		'short'	= {'1月' = 1, '2月' = 2, '3月' = 3, '4月' = 4, '5月' = 5, '6月' = 6, '7月' = 7, '8月' = 8, '9月' = 9, '10月' = 10, '11月' = 11, '12月' = 12},
		'quarter' = {'第1四半期' = 33, '第2四半期' = 34, '第3四半期' = 35, '第4四半期' = 36},
		'season'	= {'冬' = 24, '春' = 21, '夏' = 22, '秋' = 23},
		'named'	= {'イースター' = 98, 'クリスマス' = 99},
		},
	'inv_en_long' = {},														-- used in date reformatting; copy of date_names'en'.long where k/v are inverted: 1= etc.
	'inv_en_short' = {},														-- used in date reformatting; copy of date_names'en'.short where k/v are inverted: 1= etc.
	'inv_en_quarter' = {},													-- 日本語版独自: 日本語入力からの変換のため
	'inv_en_season' = {},														-- 日本語版独自
	'inv_en_named' = {},														-- 日本語版独自
	'inv_local_long' = {},													-- used in date reformatting & translation; copy of date_names'local'.long where k/v are inverted: 1= etc.
	'inv_local_short' = {},													-- used in date reformatting & translation; copy of date_names'local'.short where k/v are inverted: 1= etc.
	'inv_local_quarter' = {},													-- used in date translation; copy of date_names'local'.quarter where k/v are inverted: 1= etc.
	'inv_local_season' = {},													-- used in date translation; copy of date_names'local'.season where k/v are inverted: 1= etc.
	'inv_local_named' = {},													-- used in date translation; copy of date_names'local'.named where k/v are inverted: 1= etc.
	'local_digits' = {'0' = '0', '1' = '1', '2' = '2', '3' = '3', '4' = '4', '5' = '5', '6' = '6', '7' = '7', '8' = '8', '9' = '9'},	-- used to convert local language digits to Western 0-9
	'xlate_digits' = {},
	}
if local_date_names_from_mediawiki then											-- if fetching local month names from MediaWiki is enabled
	local long_t = {};
	local short_t = {};
	for i=1, 12 do																-- loop 12x and 
		local name = lang_obj:formatDate('F', '2022-' .. i .. '-1');			-- get long month name for each i
		long_tname = i;														-- save it
		name = lang_obj:formatDate('M', '2022-' .. i .. '-1');					-- get short month name for each i
		short_tname = i;														-- save it
	end
	date_names'locallong' = long_t;										-- write the long table – overwrites manual translation
	date_names'localshort' = short_t;										-- write the short table – overwrites manual translation
end
																				-- create inverted date-name tables for reformatting and/or translation
for _, invert_t in pairs  do
	for name, i in pairs (date_names'local'invert_t1) do					-- this table is 'name' = i
		date_namesinvert_t2i = name;										-- invert to get i = 'name' for conversions from ymd
	end
end
for _, invert_t in pairs  do -- 日本語版独自: inv_en_seasonなど追加
	for name, i in pairs (date_names'en'invert_t1) do						-- this table is 'name' = i
		date_namesinvert_t2i = name;										-- invert to get i = 'name' for conversions from ymd
	end
end
if local_digits_from_mediawiki then												-- if fetching local digits from MediaWiki is enabled
	local digits_t = {};
	for i=0, 9 do																-- loop 10x and 
		digits_t lang_obj:formatNum (i) = tostring (i);						-- format the loop indexer as local lang table index and assign loop indexer (a string) as the value
	end
	date_names'local_digits' = digits_t;
end
for ld, ed in pairs (date_names.local_digits) do								-- make a digit translation table for simple date translation from en to local language using local_digits table
	date_names.xlate_digits ed = ld;											-- en digit becomes index with local digit as the value
end
-- 英語版の  や  に関連する処理は移入しない
--page(s)= parameters.  Cite conference and cite map require further qualification which
is handled in the main module.
local templates_using_volume = {'citation', 'audio-visual', 'book', 'conference', 'encyclopaedia', 'interview', 'journal', 'magazine', 'map', 'news', 'report', 'techreport', 'thesis'}
local templates_using_issue = {'citation', 'conference', 'episode', 'interview', 'journal', 'magazine', 'map', 'news', 'podcast'}
local templates_not_using_page = {'audio-visual', 'episode', 'mailinglist', 'newsgroup', 'podcast', 'serial', 'sign', 'speech'}
--
These tables control when it is appropriate for  to render |volume= and/or |issue=.  The parameter
names in the tables constrain  so that its renderings match the renderings of the equivalent cs1
templates.  For example,  does not support |volume= so the equivalent website=... must
not support |volume=.
local citation_no_volume_t = {													--  does not render |volume= when these parameters are used
	'website', 'mailinglist', 'script-website',
	}
local citation_issue_t = {														--  may render |issue= when these parameters are used
	'journal', 'magazine', 'newspaper', 'periodical', 'work',
	'script-journal', 'script-magazine', 'script-newspaper', 'script-periodical', 'script-work',
	}
--pages=
local vol_iss_pg_patterns = {
	good_ppattern = '^P^%.PpGg',												-- OK to begin with uppercase P: P7 (page 7 of section P), but not p123 (page 123); TODO: this allows 'Pages' which it should not
	bad_ppatterns = {															-- patterns for |page= and |pages=
		'^PpPpGg?%.? %d',
		'^PpPp?%. ',													-- from  and  templates
		'^Ppages?',
		'^Ppgs.?',
		},
	vi_patterns_t = {															-- combined to catch volume-like text in |issue= and issue-like text in |volume=
		'^volumes?',															-- volume-like text
		'^vols?%.:=?',
		'^issues?',																--issue-like text
		'^iss%.:=?',
		'^numbers?',
		'^nos?%A',																-- don't match 'november' or 'nostradamus'
		'^nr%.:=?',
		'^n%.:= ',															-- might be a valid issue without separator (space char is sep char here)
		'^n°',																	-- 'n' with degree sign (U+00B0)
		'^№',																	-- precomposed unicode numero character (U+2116)
		},
	}
-----------------------------------------------------------
These tables hold keywords for those parameters that have defined sets of acceptable keywords.
-----------------------------------------------
this is a list of keywords; each key in the list is associated with a table of
synonymous keywords possibly from different languages.
for I18N: add local-language keywords to value table; do not change the key.
For example, adding the German keyword 'ja':
	'affirmative' = {'yes', 'true', 'y', 'ja'},
Because CS1|2 templates from en.wiki articles are often copied to other local wikis,
it is recommended that the English keywords remain in these tables.
local keywords = {
	'amp' = {'&', 'amp', 'ampersand'}, 										-- |name-list-style=
	'and' = {'and', 'serial'},												-- |name-list-style=
	'affirmative' = {'yes', 'true', 'y'},										-- |no-tracking=, |no-pp= -- Used by InternetArchiveBot
	'afterword' = {'afterword'},												-- |contribution=
	'bot: unknown' = {'bot: unknown'},										-- |url-status= -- Used by InternetArchiveBot
	'cs1' = {'cs1'},															-- |mode=
	'cs2' = {'cs2'},															-- |mode=
	'cs-ja1' = {'cs-ja1', 'ja1'},												-- CS-ja独自: |mode=
	'cs-ja2' = {'cs-ja2', 'ja2'},												-- CS-ja独自: |mode=
	'dead' = {'dead', 'deviated'},											-- |url-status= -- Used by InternetArchiveBot
	'dmy' = {'dmy'},															-- |df=
	'dmy-all' = {'dmy-all'},													-- |df=
	'foreword' = {'foreword'},												-- |contribution=
	'free' = {'free'},														-- 
	'harv' = {'harv'},														-- |ref=; this no longer supported; is_valid_parameter_value() called with  = true
	'introduction' = {'introduction'},										-- |contribution=
	'ja' = {'ja'},															-- |df=
	'limited' = {'limited'},													-- |url-access= -- Used by InternetArchiveBot
	'live' = {'live'},														-- |url-status= -- Used by InternetArchiveBot
	'mdy' = {'mdy'},															-- |df=
	'mdy-all' = {'mdy-all'},													-- |df=
	'none' = {'none'},														-- |postscript=, |ref=, |title=, |type= -- Used by InternetArchiveBot
	'off' = {'off'},															-- |title= (potentially also: |title-link=, |postscript=, |ref=, |type=)
	'preface' = {'preface'},													-- |contribution=
	'registration' = {'registration'},										-- |url-access= -- Used by InternetArchiveBot
	'subscription' = {'subscription'},										-- |url-access= -- Used by InternetArchiveBot
	'unfit' = {'unfit'},														-- |url-status= -- Used by InternetArchiveBot
	'usurped' = {'usurped'},													-- |url-status= -- Used by InternetArchiveBot
	'vanc' = {'vanc'},														-- |name-list-style=
	'ymd' = {'ymd'},															-- |df=
	'ymd-all' = {'ymd-all'},													-- |df=
	--	'yMd' = {'yMd'},														-- |df=; not supported at en.wiki
	--	'yMd-all' = {'yMd-all'},												-- |df=; not supported at en.wiki
	}
-----------------------------------------------
this function builds a list, keywords_xlate{}, of the keywords found in keywords{} where the values from keywords{}
become the keys in keywords_xlate{} and the keys from keywords{} become the values in keywords_xlate{}:
	'affirmative' = {'yes', 'true', 'y'},		-- in keywords{}
becomes
	'yes' = 'affirmative',					-- in keywords_xlate{}
	'true' = 'affirmative',
	'y' = 'affirmative',
the purpose of this function is to act as a translator between a non-English keyword and its English equivalent
that may be used in other modules of this suite
local function xlate_keywords ()
	local out_table = {};														-- output goes here
	for k, keywords_t in pairs (keywords) do									-- spin through the keywords table
		for _, keyword in ipairs (keywords_t) do								-- for each keyword
			out_tablekeyword = k;												-- create an entry in the output table where keyword is the key
		end
	end
	
	return out_table;
end
local keywords_xlate = xlate_keywords ();										-- the list of translated keywords
---------------------------------------
this function assembles, for parameter-value validation, the list of keywords appropriate to that parameter.
keywords_lists{}, is a table of tables from keywords{}
local function make_keywords_list (keywords_lists)
	local out_table = {};														-- output goes here
	
	for _, keyword_list in ipairs (keywords_lists) do							-- spin through keywords_lists{} and get a table of keywords
		for _, keyword in ipairs (keyword_list) do								-- spin through keyword_list{} and add each keyword, ...
			table.insert (out_table, keyword);									-- ... as plain text, to the output list
		end
	end
	return out_table;
end
-----------------------------------------------
this is a list of lists of valid keywords for the various parameters in key.
Generally the keys in this table are the canonical en.wiki parameter names though
some are contrived because of use in multiple differently named parameters:
'yes_true_y', 'id-access'.
The function make_keywords_list() extracts the individual keywords from the
appropriate list in keywords{}.
The lists in this table are used to validate the keyword assignment for the
parameters named in this table's keys.
local keywords_lists = {
	'yes_true_y' = make_keywords_list ({keywords.affirmative}),
	'contribution' = make_keywords_list ({keywords.afterword, keywords.foreword, keywords.introduction, keywords.preface}),
	'df' = make_keywords_list ({keywords.dmy, keywords'dmy-all', keywords.ja, keywords.mdy, keywords'mdy-all', keywords.ymd, keywords'ymd-all'}),
	--	'df' = make_keywords_list ({keywords.dmy, keywords'dmy-all', keywords.mdy, keywords'mdy-all', keywords.ymd, keywords'ymd-all', keywords.yMd, keywords'yMd-all'}),	-- not supported at en.wiki
	'mode' = make_keywords_list ({keywords'cs-ja1', keywords'cs-ja2'}),
	'name-list-style' = make_keywords_list ({keywords.amp, keywords'and', keywords.vanc}),
	'ref' = make_keywords_list ({keywords.harv}),								-- inverted check; |ref=harv no longer supported
	'url-access' = make_keywords_list ({keywords.subscription, keywords.limited, keywords.registration}),
	'url-status' = make_keywords_list ({keywords.dead, keywords.live, keywords.unfit, keywords.usurped, keywords'bot: unknown'}),
	'id-access' = make_keywords_list ({keywords.free}),
	}
--display-authors=etal and the like is not supported).
local global_cs1_config_t = {};													-- TODO: add value returned from get_date_format() to this table?
local function get_cs1_config ()
	return nil;																	-- 日本語版独自：Template:Cs1 config未導入
--	if not content then															-- nil content when we're in template
--		return nil;																-- auto-formatting does not work in Template space so don't set global_df
--	end
--	local start = content:find('