Jump to content

Module:Sandbox/SamuelRiv

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SamuelRiv (talk | contribs) at 21:03, 13 July 2022 (append config aliases; now I know import tables are read-only (default?); let's just copy them). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
--[[ ### Begin code mod block - Cite Legal - User:SamuelRiv ### ]]
--[[ MODIFICATIONS TO CITATION/CS1 FOR LEGAL CITATION TEMPLATE
     CODE ADAPTED PER WikiMedia CC-BY-AT AND WITH HOPES OF MERGE
     (All base CS1 code edits will begin and end as this comment,
     with username removed in Template-space release.)
     ]]
--[[ ### End code mod block - Cite Legal - User:SamuelRiv ### ]]

require ('Module:No globals');

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

each of these counts against the Lua upvalue limit

]]


local validation;																-- functions in Module:Citation/CS1/Date_validation

local utilities;																-- functions in Module:Citation/CS1/Utilities
local z ={};																	-- table of tables in Module:Citation/CS1/Utilities

local identifiers;																-- functions and tables in Module:Citation/CS1/Identifiers
local metadata;																	-- functions in Module:Citation/CS1/COinS
local cfg = {};																	-- table of configuration tables that are defined in Module:Citation/CS1/Configuration
local whitelist = {}; --mw.loadData ('Module:Citation/CS1/Whitelist');
 -- = {};															-- table of tables listing valid template parameter names; defined in Module:Citation/CS1/Whitelist

--[[ ### Begin code mod block - Cite Legal - User:SamuelRiv ### ]]
--[[ modifying CS1/Whiespace here so we don't have too many mirrors ]]
local citelegal_basic_args = {
	['country'] = true,
	['state'] = true,
	['jurisdiction'] = true,
	['litigants'] = true,
	['parties'] = true,
	['court'] = true,
	['assembly'] = true,
	['executive'] = true,
	['reporter'] = true,
	['law'] = true,
	['order'] = true,
	['decision'] = true,
	['pinpoint'] = true,
	['ecli'] = true,
	['celex'] = true,
	}
--[[ local citelegal_unique_args = {
	legal = citelegal_basic_args;
	} ]]
for k,v in pairs(citelegal_basic_args) do whitelist.basic_arguments[k] = v end;
for k,v in pairs(citelegal_basic_args) do whitelist.unique_arguments.legal[k] = v end;
table.insert (whitelist.unique_param_template_list, legal);
--[[ modifying CS1/Configuration here so we don't have too many mirrors; We had to whitelist aliases first ]]
local citelegal_aliases = {
	['country'] = {'jurisdiction','state'},
	['litigants'] = {'parties'},
	['court'] = {'assembly','executive'},
	['law'] = {'order','decision'},
	}
for k,v in pairs(citelegal_aliases) do cfg.aliases[k] = v end;
--[[ ### End code mod block - Cite Legal - User:SamuelRiv ### ]]


--[[------------------< P A G E   S C O P E   V A R I A B L E S >---------------

declare variables here that have page-wide scope that are not brought in from
other modules; that are created here and used here

]]

local added_deprecated_cat;														-- Boolean flag so that the category is added only once
local added_vanc_errs;															-- Boolean flag so we only emit one Vancouver error / category
local added_generic_name_errs;													-- Boolean flag so we only emit one generic name error / category and stop testing names once an error is encountered
local Frame;																	-- holds the module's frame table
local is_preview_mode;															-- true when article is in preview mode; false when using 'Preview page with this template' (previewing the module)
local is_sandbox;																-- true when using sandbox modules to render citation


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

Locates and returns the first set value in a table of values where the order established in the table,
left-to-right (or top-to-bottom), is the order in which the values are evaluated.  Returns nil if none are set.

This version replaces the original 'for _, val in pairs do' and a similar version that used ipairs.  With the pairs
version the order of evaluation could not be guaranteed.  With the ipairs version, a nil value would terminate
the for-loop before it reached the actual end of the list.

]]