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 21: Line 21:
end
end


return {is_set = is_set, z=z} -- return exported functions and tables
--[[--------------------------< I N _ A R R A Y >--------------------------------------------------------------
 
Whether needle is in haystack
 
]]
 
local function in_array( needle, haystack )
if needle == nil then
return false;
end
for n,v in ipairs( haystack ) do
if v == needle then
return n;
end
end
return false;
end
 
--[[--------------------------< S U B S T I T U T E >----------------------------------------------------------
 
Populates numbered arguments in a message string using an argument table.
 
]]
 
local function substitute( msg, args )
return args and mw.message.newRawMessage( msg, args ):plain() or msg;
end
 
--[[--------------------------< E R R O R _ C O M M E N T >----------------------------------------------------
 
Wraps error messages with css markup according to the state of hidden.
 
]]
local function error_comment( content, hidden )
return substitute( hidden and cfg.presentation['hidden-error'] or cfg.presentation['visible-error'], content );
end
 
return {is_set=is_set, in_array=in_array, substitute=substitute, error_comment=error_comment, z=z} -- return exported functions and tables
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.