Jump to content

Module:Citation/CS1/Utilities: Difference between revisions

no edit summary
m>Trappist the monk
No edit summary
m>Trappist the monk
No edit summary
Line 10: Line 10:


local cfg = mw.loadData ('Module:Citation/CS1/Configuration/sandbox');
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 >------------------------------------------------------------------
--[[--------------------------< I S _ S E T >------------------------------------------------------------------
Line 20: Line 36:
return not (var == nil or var == '');
return not (var == nil or var == '');
end
end


--[[--------------------------< I N _ A R R A Y >--------------------------------------------------------------
--[[--------------------------< I N _ A R R A Y >--------------------------------------------------------------
Line 38: Line 55:
return false;
return false;
end
end


--[[--------------------------< S U B S T I T U T E >----------------------------------------------------------
--[[--------------------------< S U B S T I T U T E >----------------------------------------------------------
Line 48: Line 66:
return args and mw.message.newRawMessage( msg, args ):plain() or msg;
return args and mw.message.newRawMessage( msg, args ):plain() or msg;
end
end


--[[--------------------------< E R R O R _ C O M M E N T >----------------------------------------------------
--[[--------------------------< E R R O R _ C O M M E N T >----------------------------------------------------
Line 57: Line 76:
return substitute( hidden and cfg.presentation['hidden-error'] or cfg.presentation['visible-error'], content );
return substitute( hidden and cfg.presentation['hidden-error'] or cfg.presentation['visible-error'], content );
end
end


--[[--------------------------< S E T _ E R R O R >--------------------------------------------------------------
--[[--------------------------< S E T _ E R R O R >--------------------------------------------------------------
Line 96: Line 116:
return error_comment( message, error_state.hidden );
return error_comment( message, error_state.hidden );
end
end


--[[-------------------------< I S _ A L I A S _ U S E D >-----------------------------------------------------
--[[-------------------------< I S _ A L I A S _ U S E D >-----------------------------------------------------
Line 202: Line 223:
set_error = set_error,
set_error = set_error,
select_one = select_one,
select_one = select_one,
add_maint_cat = add_maint_cat,
z = z,
z = z,
}
}
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.