Тағйирот байни саҳифаҳои "Модул:rhymes"
Зоҳир
Content deleted Content added
No edit summary |
No edit summary |
||
Сатри 39: | Сатри 39: | ||
elseif mw.title.getCurrentTitle().text == lang:getCanonicalName() .. "/" .. prefix .. last .. "-" then |
elseif mw.title.getCurrentTitle().text == lang:getCanonicalName() .. "/" .. prefix .. last .. "-" then |
||
table.insert(steps, "» [[Рхаймс:" .. lang:getCanonicalName() .. "/" .. prefix .. last .. "-|-" .. prefix .. last .. "-]]") |
table.insert(steps, "» [[Рхаймс:" .. lang:getCanonicalName() .. "/" .. prefix .. last .. "-|-" .. prefix .. last .. "-]]") |
||
table.insert(categories, "[[Category:Рхаймси " .. lang:getCanonicalName() .. " |
table.insert(categories, "[[Category:Рхаймси " .. lang:getCanonicalName() .. "/" .. prefix .. last .. "-|-]]") |
||
else |
else |
||
table.insert(steps, "» [[Рхаймс:" .. lang:getCanonicalName() .. "/" .. prefix .. last .. "|-" .. prefix .. last .. "]]") |
table.insert(steps, "» [[Рхаймс:" .. lang:getCanonicalName() .. "/" .. prefix .. last .. "|-" .. prefix .. last .. "]]") |
Нусха 14:07, 9 Январ 2016
local export = {}
function export.show_nav(frame)
-- Gather parameters
local args = frame:getParent().args
local lang = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "und") or error("Language code has not been specified. Please pass parameter 1 to the template.")
lang = require("Module:languages").getByCode(lang) or error("The language code \"" .. lang .. "\" is not valid.")
local parts = {}
local i = 2
while args[i] do
local part = args[i]; if part == "" then part = nil end
table.insert(parts, part)
i = i + 1
end
-- Create steps
local steps = {"» [[Wiktionary:Rhymes|Рхаймс]]", "» [[Рхаймс:" .. lang:getCanonicalName() .. "|" .. lang:getCanonicalName() .. "]]"}
local categories = {}
if #parts > 0 then
local last = parts[#parts]
parts[#parts] = nil
local prefix = ""
for i, part in ipairs(parts) do
prefix = prefix .. part
parts[i] = prefix
end
for _, part in ipairs(parts) do
table.insert(steps, "» [[Рхаймс:" .. lang:getCanonicalName() .. "/" .. part .. "-|-" .. part .. "-]]")
end
if last == "-" then
table.insert(steps, "» [[Рхаймс:" .. lang:getCanonicalName() .. "/" .. prefix .. "|-" .. prefix .. "]]")
table.insert(categories, "[[Category:Рхаймси " .. lang:getCanonicalName() (prefix == "" and "" or "/" .. prefix .. "-") .. "| ]]")
elseif mw.title.getCurrentTitle().text == lang:getCanonicalName() .. "/" .. prefix .. last .. "-" then
table.insert(steps, "» [[Рхаймс:" .. lang:getCanonicalName() .. "/" .. prefix .. last .. "-|-" .. prefix .. last .. "-]]")
table.insert(categories, "[[Category:Рхаймси " .. lang:getCanonicalName() .. "/" .. prefix .. last .. "-|-]]")
else
table.insert(steps, "» [[Рхаймс:" .. lang:getCanonicalName() .. "/" .. prefix .. last .. "|-" .. prefix .. last .. "]]")
table.insert(categories, "[[Category:Рхаймси " .. lang:getCanonicalName() .. " rhymes" .. (prefix == "" and "" or "/" .. prefix .. "-") .. "|" .. last .. "]]")
end
elseif lang ~= "und" then
table.insert(categories, "[[Category:Рхаймси " .. lang:getCanonicalName() .. " rhymes| ]]")
end
return table.concat(steps, " ") .. table.concat(categories)
end
return export