local p = require('Module:Module wikitext')._addText("")
function spellChecker(str, replacements) local function adjust_case(first, second, disable_case_transmission) if disable_case_transmission then return second end local first_char = first:sub(1, 1) if first_char:lower
local result = str for _, entry in ipairs(replacements) do local search, replace = entry[1], entry[2] local disable_case_transmission = entry[3] local replace_with_case = adjust_case(search, replace, disable_case_transmission) result = result:gsub(search, replace_with_case) if not disable_case_transmission then search = search:lower replace = replace:lower result = result:gsub(search, replace) end end return resultend
local correctSpellingTable = function p.main(frame) return frame:preprocess(spellChecker(frame.args[1], correctSpellingTable))end
return p