10,731
edits
TheNightAvl (talk | contribs) No edit summary |
TheNightAvl (talk | contribs) No edit summary |
||
Line 11: | Line 11: | ||
end | end | ||
return str | return str | ||
end | |||
-- provides initial capitalisation | |||
local function capitalize(word) | |||
if mw.ustring.len(word) > 1 then | |||
return mw.ustring.upper(mw.ustring.sub(word, 1, 1)) .. mw.ustring.sub(word, 2) | |||
elseif mw.ustring.len(word) == 1 then | |||
return mw.ustring.upper(word) | |||
end | |||
error("Empty input for capitalisation") | |||
end | end | ||
Line 24: | Line 34: | ||
local function to_pattern(pattern, categories) | local function to_pattern(pattern, categories) | ||
return {"^" .. capitalize(pattern) .. "$", categories} | return {"^" .. capitalize(pattern) .. "$", categories} | ||
end | end | ||