Module:mg-pron: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 52: Line 52:
}
}


function export.crux(term)
function export.crux(term, pos)
term = mw.ustring.lower(term)
term = mw.ustring.lower(term)
Line 59: Line 59:
end
end
term = syllabify(term)
term = syllabify(term, pos)
for _, rule in ipairs(rules) do
for _, rule in ipairs(rules) do
Line 88: Line 88:
end
end


function separate_word(term)
function separate_word(term, pos)
local result = {}
local result = {}
for word in gsplit(term, " ") do
for word in gsplit(term, " ") do
table.insert(result, export.crux(word))
table.insert(result, export.crux(word , pos))
end
end
Line 101: Line 101:
local params = {
local params = {
[1] = { default = mw.title.getCurrentTitle().text }, -- PAGENAME
[1] = { default = mw.title.getCurrentTitle().text }, -- PAGENAME
[2] = {},
}
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
local term = frame.args[1] or mw.title.getCurrentTitle().nsText == 'Template' and "gueizuñe" or args[1]
local term = frame.args[1] or mw.title.getCurrentTitle().nsText == 'Template' and "gueizuñe" or args[1]
local pos = frame.args[2] or args[2]
local ipa = "* "
local ipa = "* "
ipa = ipa .. line_format(separate_word(term))
ipa = ipa .. line_format(separate_word(term, pos))
return ipa
return ipa

Navigation menu