Module:rad-pronunciation: Difference between revisions

m
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
mNo edit summary
mNo edit summary
Line 19: Line 19:


function export.show(frame)
function export.show(frame)
local args_frame = getArgs(frame)
local args = getArgs(frame)
local args = {}
local word = mw.title.getCurrentTitle().subpageText
local word = mw.title.getCurrentTitle().subpageText
local p = 1
local p = 1
if args_frame["entry"] ~= nil then
if args["entry"] ~= nil then
word = args_frame["entry"]
word = args["entry"]
end
mw.log("——— Processing arguments ———")
while args_frame[p] do
table.insert(args, args_frame[p])
mw.log("Argument " .. p .. ": " .. args_frame[p])
p = p + 1
end
end
Line 79: Line 71:
local working_syllables = ""
local working_syllables = ""
if #args > 0 and args ~= nil then
local i = 1
for i = 1, #args do
 
mw.log("Processing argument " .. i .. ".")
while args[i] do
if parameter[args[i]] ~= nil then -- mode changer
mw.log("Processing argument " .. i .. ".")
mode = args[i]
if parameter[args[i]] ~= nil then -- mode changer
mode_dialect = "standard"
mode = args[i]
mode_register = "plain"
mode_dialect = "standard"
elseif dialect[args[i]] ~= nil then
mode_register = "plain"
mode_dialect = args[i]
elseif dialect[args[i]] ~= nil then
mode_register = "plain"
mode_dialect = args[i]
elseif register[args[i]] ~= nil then
mode_register = "plain"
mode_register = args[i]
elseif register[args[i]] ~= nil then
mode_register = args[i]
-- begin adding data to tables --  
elseif mode == "IPA" then
-- begin adding data to tables --  
if args[i] == "no auto" then
elseif mode == "IPA" then
IPA_no_auto = true
if args[i] == "no auto" then
else
IPA_no_auto = true
table.insert(IPA[mode_dialect][mode_register], args[i])
else
mw.log("IPA: added '" .. args[i] .. "' to IPA[" .. mode_dialect .. "][" .. mode_register .. "]")
table.insert(IPA[mode_dialect][mode_register], args[i])
mw.log("IPA: added '" .. args[i] .. "' to IPA[" .. mode_dialect .. "][" .. mode_register .. "]")
if mode_dialect == "standard" or mode_dialect == "hjádvanþs" then
local just_phonemic = mw.ustring.match(args[i], "%/(.*)%/")
if mode_dialect == "standard" or mode_dialect == "hjádvanþs" then
insert_rhyme(just_phonemic)
local just_phonemic = mw.ustring.match(args[i], "%/(.*)%/")
end
insert_rhyme(just_phonemic)
end
end
elseif mode == "syllables" then
end
if args[i] == "no auto" then
elseif mode == "syllables" then
syllables_no_auto = true
if args[i] == "no auto" then
elseif args[i] == "" then
syllables_no_auto = true
if mw.ustring.find(working_syllables, "(%|)") then
elseif args[i] == "" then
table.insert(syllables, working_syllables)
if mw.ustring.find(working_syllables, "(%|)") then
mw.log("Syllables: " .. working_syllables .. " registered.")
table.insert(syllables, working_syllables)
end
mw.log("Syllables: " .. working_syllables .. " registered.")
working_syllables = ""
elseif args[i+1] == nil then
working_syllables = working_syllables .. "|" .. args[i]
if mw.ustring.find(working_syllables, "(%|)") then
table.insert(syllables, working_syllables)
mw.log("Syllables: " .. working_syllables .. " registered.")
end
else
working_syllables = working_syllables .. "|" .. args[i]
end
end
elseif mode == "homophones" then
working_syllables = ""
table.insert(homophones, args[i])
elseif args[i+1] == nil then
mw.log("Homophones: " .. args[i] .. " registered.")
working_syllables = working_syllables .. "|" .. args[i]
if mw.ustring.find(working_syllables, "(%|)") then
table.insert(syllables, working_syllables)
mw.log("Syllables: " .. working_syllables .. " registered.")
end
else
working_syllables = working_syllables .. "|" .. args[i]
end
end
elseif mode == "homophones" then
table.insert(homophones, args[i])
mw.log("Homophones: " .. args[i] .. " registered.")
end
end
i = i + 1
end
end
i = nil
-- add auto values --
-- add auto values --
if IPA_no_auto == false then
if IPA_no_auto == false then