Module:rad-pronunciation: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 6: Line 6:
local m_links = require("Module:links")
local m_links = require("Module:links")
local m_languages = require("Module:languages")
local m_languages = require("Module:languages")
local m_rhymes = require("Module:rhymes")
local m_table = require("Module:table")
local m_table = require("Module:table")


Line 303: Line 304:


     if #rhymes > 0 and show_rhymes then
     if #rhymes > 0 and show_rhymes then
     rhymes_show = "\n* Rhyme"
     rhymes_show = "\n* " .. m_rhymes.generate("rad", rhymes)
    if #rhymes > 1 then rhymes_show = rhymes_show .. "s" end
    rhymes_show = rhymes_show .. ":"
 
        for num, rhyme in ipairs(rhymes) do
            if num > 1 then
                rhymes_show = rhymes_show .. ","
            end
            local rhyme_cat = "Rhymes:Radestrian/" .. rhyme
            local rhyme_count = mw.site.stats.pagesInCategory(rhyme_cat, "pages")
            if rhyme_count < 2 then
            rhymes_show = rhymes_show ..
            " <span class=\"IPA\">-" .. rhyme .. "</span>[[Category:" .. rhyme_cat .. "]]"
        else
            rhymes_show = rhymes_show ..
                " <span class=\"IPA\">[[:Category:" .. rhyme_cat .. "|-" .. rhyme .. "]]</span>[[Category:" .. rhyme_cat .. "]]" ..
                "<sup> (" .. rhyme_count .. ")</sup>"
            end
        end
     end
     end