5,078
edits
No edit summary |
mNo edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
local utils = {} | local utils = {} | ||
function utils.strip( str ) | |||
return mw.ustring.gsub(str, '^%s*(.-)%s*$', '%1') | |||
end | |||
function utils.empty( val ) | |||
return val == nil or val == '' | |||
end | |||
function utils.defaultIfEmpty( val, default ) | function utils.defaultIfEmpty( val, default ) | ||
Line 19: | Line 27: | ||
function generateErrorWikitext( message, type, category, template ) | function generateErrorWikitext( message, type, category, template ) | ||
local wikitext = [[''']] | local wikitext = [[''']] | ||
.. string.upper( type ) | .. string.upper( type ) | ||
.. [[:''' ]] | .. [[:''' ]] | ||
.. message | .. message | ||
if template ~= nil then | if template ~= nil then | ||
wikitext = wikitext .. ' (Template: [[Template:' | wikitext = wikitext .. ' (Template: [[Template:' |