Module:rad-pronunciation: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 66: Line 66:


     local function insert_rhyme(input, pos)
     local function insert_rhyme(input, pos)
        local function insert_to_rhymes(rhyme)
    if show_rhymes then
        if not (rhyme == nil or m_table.contains(rhymes, rhyme)) and show_rhymes then
        local function insert_to_rhymes(rhyme)
            if pos == nil then
        if not (rhyme == nil or m_table.contains(rhymes, rhyme)) then
                table.insert(rhymes, rhyme)
            if pos == nil then
            else
                table.insert(rhymes, rhyme)
                table.insert(rhymes, pos, rhyme)
            else
                pos = pos + 1
                table.insert(rhymes, pos, rhyme)
            end
                pos = pos + 1
        -- mw.log("Rhyme registered: " .. rhyme)
            end
        end
        -- mw.log("Rhyme registered: " .. rhyme)
        end
        end
insert_to_rhymes(m_rad_IPA.get_rhyme(input))
        end
local weak_rhymes = m_rad_IPA.get_weak_rhyme(input)
insert_to_rhymes(m_rad_IPA.get_rhyme(input))
if weak_rhymes then
local weak_rhymes = m_rad_IPA.get_weak_rhyme(input)
for _, weak_rhyme in ipairs(weak_rhymes) do
if weak_rhymes then
insert_to_rhymes(weak_rhyme)
for _, weak_rhyme in ipairs(weak_rhymes) do
insert_to_rhymes(weak_rhyme)
end
end
end
end
end