Module:validate IPA

Definition from Wiktionary, the free dictionary
Jump to: navigation, search
The following documentation is located at Module:validate IPA/documentation. [edit]
Text-x-generic with pencil.svg This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}
 
local badchars = {
    [0x02A6] = true
}
 
function export.validate(frame)
    local args = frame:getParent().args
    local IPA = args[1]
 
    if contains_invalid_char(IPA) == false then
        return "[[Category:Pages with invalid IPA characters]]"
    end
end
 
function contains_invalid_char(str)
    for c in mw.ustring.gcodepoint(str) do
        if badchars[c] ~= nil then
            return false
        end
    end
    return true
end
 
return export