Module:Sandbox/SamuelRiv/Configuration explained

----MODIFICATIONS TO Citation/CS1/Configuration FOR LEGAL CITATION TEMPLATE CODE ADAPTED PER WikiMedia CC-BY-SA AND WITH HOPES OF MERGE; Configuration file necessary for new class name & aliases. (All base CS1 code edits will begin and end as this comment, with username removed in Template-space release.) --

local lang_obj = mw.language.getContentLanguage; -- make a language object for the local language; used here for languages and dates

--

local uncategorized_namespaces = ;local uncategorized_subpages = ; -- list of Lua patterns found in page names of pages we should not categorize

----------------------------< M E S S A G E S >--------------------------------------------------------------

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 thismodule.

local messages = templates have errors; messages may be hidden (help).'; -- $1 is template link ['warning_msg_m'] = '

One or more {} templates have maintenance messages; messages may be hidden (help).'; -- $1 is template link }

--CitationClass= in the cs1|2 templates to the canonical template name whenthe value assigned to |CitationClass= is different from the canonical template name. |CitationClass= values areused as class attributes in the tag that encloses the citation so these names may not contain spaces whilethe canonical template name may. These names are used in warning_msg_e and warning_msg_m to create links to thetemplate's documentation when an article is displayed in preview mode.

Most cs1|2 template |CitationClass= values at en.wiki match their canonical template names so are not listed here.

local citation_class_map_t =

--[=[-------------------------< E T _ A L _ P A T T E R N S >-------------------------------------------------- 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 =

----------------------------< P R E S E N T A T I O N >------------------------

Fixed presentation markup. Originally part of citation_config.messages it hasbeen moved into its own, more semantically correct place.

local presentation =

----------------------------< A L I A S E S >---------------------------------

Aliases table for commonly passed parameters.

Parameter names on the right side in the assignments in this table must have beendefined in the Whitelist before they will be recognized as valid parameter names

local aliases =

----------------------------< P U N C T _ S K I P >---------------------------

builds a table of parameter names that the extraneous terminal punctuation check should not check.

local punct_meta_params =

local url_meta_params =

local function build_skip_table (skip_t, meta_params) for _, meta_param in ipairs (meta_params) do -- for each meta parameter key local params = aliases[meta_param]; -- get the parameter or the table of parameters associated with the meta parameter name if 'string'

type (params) then skip_t[params] = 1; -- just a single parameter else for _, param in ipairs (params) do -- get the parameter name skip_t[param] = 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_t[param] = 1; -- add param name without enumerator marker end end end end return skip_t;end

local punct_skip = ;local url_skip = ;

-------------< S P E C I A L C A S E T R A N S L A T I O N S >------------

This table is primarily here to support internationalization. Translations inthis table are used, for example, when an error message, category name, etc.,is extracted from the English alias key. There may be other cases wherethis 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';local special_case_translation =

--2 only supports generic seasons.EDTF does support the distinction between north and south hemisphere seasonsbut 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 theISO 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['local']['long'] and date_names['local']['short'] 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 testthe 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 namesfrom MediaWiki. Those must be translated manually.

local local_date_names_from_mediawiki = true; -- when false, manual translation required for date_names['local']['long'] and date_names['local']['short'] -- when true, module fetches long and short month names from MediaWikilocal date_names =

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_t[name] = i; -- save it name = lang_obj:formatDate('M', '2022-' .. i .. '-1'); -- get short month name for each i short_t[name] = i; -- save it end date_names['local']['long'] = long_t; -- write the long table – overwrites manual translation date_names['local']['short'] = short_t; -- write the short table – overwrites manual translationend -- create inverted date-name tables for reformatting and/or translationfor _, invert_t in pairs do for name, i in pairs (date_names['local'][invert_t[1]]) do -- this table is ['name'] = i date_names[invert_t[2]][i] = name; -- invert to get [i] = 'name' for conversions from ymd endend

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 valueend

local df_template_patterns =