Module:descendants: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
(Fixed bug in which descendants of direct borrowings were not showing up)
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
local export = {}
local export = {}
local getArgs = require("Module:Arguments").getArgs
local getArgs = require("Module:Arguments").getArgs
Line 23: Line 21:
local see_desc = args["see"]
local see_desc = args["see"]
local noname = args["noname"]
local noname = args["noname"]
local nocat = args["nocat"]
local lostcap = args["lost"] or "lost"
local lostcap = args["lost"] or "lost"
if not nocat then out = out .. "[[Category:Terms with " .. lang.name .. " descendants|" .. mw.title.getCurrentTitle().subpageText .. "]]" end
if borrowed then out = "<span class=\"desc-arrow\" title=\"borrowed\">→</span>" .. out end
if borrowed then out = "<span class=\"desc-arrow\" title=\"borrowed\">→</span>" .. out end
if not noname then out = out .. lang.name .. ":&nbsp;" end
if not noname then out = out .. lang.name .. ":&nbsp;" end
Line 79: Line 79:
for piece, delim in mw.ustring.gmatch(lang, "([^%>%_]+)([%>%_])") do
for piece, delim in mw.ustring.gmatch(lang, "([^%>%_]+)([%>%_])") do
ancestor_path = ancestor_path .. piece
ancestor_path = ancestor_path .. piece
if mw.ustring.gmatch(lang, "^%>") then
if mw.ustring.match(lang, "^%>") then
ancestor_path = ">" .. ancestor_path
ancestor_path = ">" .. ancestor_path
end
end
Line 197: Line 197:
for lang, lang_args in pairs(terms) do
for lang, lang_args in pairs(terms) do
table.insert(lang_args, 1, lang)
table.insert(lang_args, 1, lang)
lang_args["nocat"] = args["nocat"]
items[lang] = export.descendant(lang_args)
items[lang] = export.descendant(lang_args)
end
end