Module:siwa-headword: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 35: Line 35:


local lang = require("Module:languages").getByCode("siwa")
local lang = require("Module:languages").getByCode("siwa")
local function pre_sort(word)
local morphemes = mw.text.split(word, "‧")
table.remove(morphemes, 1)
table.concat(morphemes, "")
return lang:makeSortKey(morphemes)
end


local function glossary_link(entry, text)
local function glossary_link(entry, text)
Line 82: Line 73:
["decl"] = {},
["decl"] = {},
["cat2"] = {},
["cat2"] = {},
["pr"] = {type = "boolean"},
["sort"] = {},
}
}
Line 97: Line 88:
if args.cat2 then table.insert(data.categories, "Siwa " .. args["cat2"]) end
if args.cat2 then table.insert(data.categories, "Siwa " .. args["cat2"]) end
data.sort_key = args.pr and pre_sort(data.heads[1][1]) or nil
data.sort_key = args["sort"]
end
end


Line 110: Line 101:
[3] = {list = "p", required = true},
[3] = {list = "p", required = true},
["head"] = {},
["head"] = {},
["pr"] = {type = "boolean"},
["sort"] = {},
}
}
Line 128: Line 119:
table.insert(data.inflections, args[3])
table.insert(data.inflections, args[3])
data.sort_key = args.pr and pre_sort(data.heads[1][1]) or nil
data.sort_key = args["sort"]
end
end


return export
return export

Navigation menu