Module:rad-pronunciation: Difference between revisions

m
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
(Fixed rhyme bug)
mNo edit summary
Line 21: Line 21:
local args_frame = getArgs(frame)
local args_frame = getArgs(frame)
local args = {}
local args = {}
local word = mw.title.getCurrentTitle.text()
local p = 1
local p = 1
mw.log("——— Processing arguments ———")
mw.log("——— Processing arguments ———")
while args_frame[p] do
while args_frame[p] do
if p == 2 and args_frame[p] == "" then break end
table.insert(args, args_frame[p])
table.insert(args, args_frame[p])
mw.log("Argument " .. p .. ": " .. args_frame[p])
mw.log("Argument " .. p .. ": " .. args_frame[p])
Line 35: Line 35:
local register = {["colloquial"] = "colloquial", ["formal"] = "formal"}
local register = {["colloquial"] = "colloquial", ["formal"] = "formal"}
local dialect = {["hjádvanþs"] = "hjádvanþs", ["coastal"] = "coastal", ["insular"] = "insular"}
local dialect = {["hjádvanþs"] = "hjádvanþs", ["coastal"] = "coastal", ["insular"] = "insular"}
local word = args[1]
-- get automations --
-- get automations --
Line 77: Line 75:
local working_syllables = ""
local working_syllables = ""
for i = 2, #args do
for i = 1, #args do
mw.log("Processing argument " .. i .. ".")
mw.log("Processing argument " .. i .. ".")
if parameter[args[i]] ~= nil then -- mode changer
if parameter[args[i]] ~= nil then -- mode changer
Line 217: Line 215:
rhymes_show = "\n* Rhymes:"
rhymes_show = "\n* Rhymes:"
for _, rhyme in ipairs(rhymes) do
for num, rhyme in ipairs(rhymes) do
if num > 1 then
rhymes_show = rhymes_show .. ","
end
rhymes_show = rhymes_show .. " <span class=\"IPA\">[[:Category:Rhymes:Radestrian/" .. rhyme .. "|-" .. rhyme .. "]]</span>[[Category:Rhymes:Radestrian/" .. rhyme .. "]]"
rhymes_show = rhymes_show .. " <span class=\"IPA\">[[:Category:Rhymes:Radestrian/" .. rhyme .. "|-" .. rhyme .. "]]</span>[[Category:Rhymes:Radestrian/" .. rhyme .. "]]"
end
end