Module:Sandbox/SamuelRiv: Difference between revisions
Appearance
Content deleted Content added
Just comment setup before code import |
append to whitelist |
||
Line 12: | Line 12: | ||
each of these counts against the Lua upvalue limit |
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 = {}; -- 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, |
|||
['litigants'] = true, |
|||
['parties'] = true, |
|||
['court'] = true, |
|||
['jurisdiction'] = 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); |
|||
--[[ ### 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. |
|||
]] |
]] |
Revision as of 19:23, 13 July 2022
--[[ ### 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 = {}; -- 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,
['litigants'] = true,
['parties'] = true,
['court'] = true,
['jurisdiction'] = 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);
--[[ ### 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.
]]