Modulo:categoria gramategałe
Inpostasion de letura
La documentazione per questo modulo può essere creata in Modulo:categoria gramategałe/man
--DA CA.WIKT--
--[=[
This module creates standardised displays for gender and number.
It converts a gender specification into Wiki/HTML format.
A gender specification is a list of one of the elements listed below,
separated by hyphens. Examples are: "c", "n", "f-p", "m-an-p"
]=]--
local export = {}
local codes = {}
-- A list of all possible "parts" that a specification can be made out of.
codes["?"] = '<abbr title="zènero inconpleto">?</abbr>'
-- Genders
codes["m"] = '<abbr title="mascułin">m.</abbr>'
codes["f"] = '<abbr title="femenin">f.</abbr>'
codes["f pl"] = '<abbr title="femenin plùremo">f. pl.</abbr>'
codes["m pl"] = '<abbr title="mascułin plùremo">m. pl.</abbr>'
codes["f s"] = '<abbr title="femenin sìnguło">f. s.</abbr>'
codes["m s"] = '<abbr title="mascułin sìnguło">m. s.</abbr>'
codes["c"] = '<abbr title="zènare comun">c.</abbr>'
codes["coll"] = '<abbr title="cołetivo>coll.</abbr>'
codes["col"] = '<abbr title="cołetivo>coll.</abbr>'
codes["n"] = '<abbr title="nèutro">n.</abbr>'
codes["i"] = '<abbr title="invariàbiłe inte el zènaro">inv.</abbr>'
codes["inv"] = '<abbr title="invariàbiłe inte el zènaro">inv.</abbr>'
codes["m, f"] = '<abbr title="invariàbiłe inte el zènaro">inv.</abbr>'
codes["prom"] = '<abbr title="promìscuo">prom.</abbr>'
-- Numeri
codes["s"] = '<abbr title="nome singołare">sing.</abbr>'
codes["d"] = '<abbr title="nome duałe">dual.</abbr>'
codes["p"] = '<abbr title="nome plurałe">pl.</abbr>'
-- Additional qualifiers
codes["an"] = '<abbr title="anemà">anem.</abbr>'
codes["in"] = '<abbr title="inanemà">inan.</abbr>'
codes["anml"] = '<abbr title="animałe">animałe</abbr>' -- ucrain, bieloruso, polonezo
codes["animal"] = '<abbr title="animałe">animałe</abbr>' -- ucrain, bieloruso, polonezo
codes["per"] = '<abbr title="personałe">pers.</abbr>' -- ucrain, bieloruso, polonezo
codes["vir"] = '<abbr title="viriłe">vir.</abbr>' -- polonezo
codes["nv"] = '<abbr title="no viriłe">nvir.</abbr>' -- polonezo
codes["loc"] = '<abbr title="locusion">loc.</abbr>'
-- Verbi
codes["vt"] = '<abbr title="verbo doparà tranzitivamente">tranz.</abbr>'
codes["vi"] = '<abbr title="verbo doparà intranzitivamente">intr.</abbr>'
codes["vp"] = '<abbr title="verbo pronominal">pron.</abbr>'
codes["va"] = '<abbr title="verbo auziłiare">auz.</abbr>'
codes["vm"] = '<abbr title="verbo inpersonałe">inpers.</abbr>'
-- Version of format_list that can be invoked from a template.
function export.show_list(frame)
local args = frame.args
local lang = args["lang"]; if lang == "" then lang = nil end
local list = {}
local i = 1
while args[i] and args[i] ~= "" do
table.insert(list, args[i])
i = i + 1
end
return export.format_list(list, lang)
end
-- Format one or more gender specifications, in the form of a table of specifications.
function export.format_list(list, lang)
for key, spec in ipairs(list) do
local parts = mw.text.split(spec, "")
for key, code in ipairs(parts) do
if codes[code] then
parts[key] = codes[code]
else
error("El zènaro \"" .. code .. "\" no el ze vàłido.")
end
end
list[key] = table.concat(parts, " ")
end
return "<span class=\"gender\">" .. table.concat(list, ", ") .. "</span>"
end
return export