Module:Citation/CS1/Utilities: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 10:
 
local cfg = mw.loadData ('Module:Citation/CS1/Configuration/sandbox');
 
--[[--------------------------< A D D _ M A I N T _ C A T >------------------------------------------------------
 
Adds a category to z.maintenance_cats using names from the configuration file with additional text if any.
To prevent duplication, the added_maint_cats table lists the categories by key that have been added to z.maintenance_cats.
 
]]
 
local added_maint_cats = {} -- list of maintenance categories that have been added to z.maintenance_cats
local function add_maint_cat (key, arguments)
if not added_maint_cats [key] then
added_maint_cats [key] = true; -- note that we've added this category
table.insert( z.maintenance_cats, substitute (cfg.maint_cats [key], arguments)); -- make name then add to table
end
end
 
 
--[[--------------------------< I S _ S E T >------------------------------------------------------------------
Line 20 ⟶ 36:
return not (var == nil or var == '');
end
 
 
--[[--------------------------< I N _ A R R A Y >--------------------------------------------------------------
Line 38 ⟶ 55:
return false;
end
 
 
--[[--------------------------< S U B S T I T U T E >----------------------------------------------------------
Line 48 ⟶ 66:
return args and mw.message.newRawMessage( msg, args ):plain() or msg;
end
 
 
--[[--------------------------< E R R O R _ C O M M E N T >----------------------------------------------------
Line 57 ⟶ 76:
return substitute( hidden and cfg.presentation['hidden-error'] or cfg.presentation['visible-error'], content );
end
 
 
--[[--------------------------< S E T _ E R R O R >--------------------------------------------------------------
Line 96 ⟶ 116:
return error_comment( message, error_state.hidden );
end
 
 
--[[-------------------------< I S _ A L I A S _ U S E D >-----------------------------------------------------
Line 202 ⟶ 223:
set_error = set_error,
select_one = select_one,
add_maint_cat = add_maint_cat,
z = z,
}