Modifiche

Modulo:Headword/templates

432 byte rimossi, 23:54, 24 mar 2017
nessun oggetto della modifica
}
 function export.head_t(frame) local params = { [1] = {required = true, default = "und"}, ["sc"] = {}, ["cat sc"] = {}, ["sort"] = {}, [2] = {required = true, default = "nouns"}, ["cat2"] = {}, ["cat3"] = {}, ["cat4"] = {}, ["head"] = {list = true, allow_holes = true, default = ""}, ["tr"] = {list = true, allow_holes = true}, ["g"] = {list = true}, [3] = {list = true, allow_holes = true}, ["f=accel"] = {list = true, allow_holes = true}, ["f=request"] = {list = true, allow_holes = true}, ["f=alt"] = {list = true, allow_holes = true}, ["f=sc"] = {list = true, allow_holes = true}, ["f=id"] = {list = true, allow_holes = true}, ["f=tr"] = {list = true, allow_holes = true}, ["f=g"] = {list = true, allow_holes = true}, ["f=qual"] = {list = true, allow_holes = true}, ["f=nolink"] = {list = true, allow_holes = true, type = "boolean"}, ["f=lang"] = {list = true, allow_holes = true}, } local args = require("Module:parameters").process(frame:getParent().args, params)
[2] -- Get language and script information local data = {required } data.lang = true}require("Module:languages").getByCode(args[1]) or require("Module:languages").err(args[1],1) data.sort_key = args["cat2sort"] data.categories = {}, data.heads = args["cat3head"] data.translits = {},args["tr"] data.genders = args["cat4g"] data.inflections = {},
["head"] = {list = true, allow_holes = true, default = ""},-- Script ["tr"] = {list = true, allow_holes = true}, ["g"] = {list = true},local cat_sc
if args[3"cat sc"] then data.sc = {list (args["cat sc"] and (require("Module:scripts").getByCode(args["cat sc"]) or error("The script code \"" .. args["cat sc"] .. "\" is not valid.")) or nil) cat_sc = true, allow_holes cat_sc else data.sc = true},(args["sc"] and (require("Module:scripts").getByCode(args["sc"]) or error("The script code \"" .. args["sc"] .. "\" is not valid.")) or nil) end
["f=accel"] = {list = true, allow_holes = true},-- Part-of-speech category ["fdata.pos_category =request"] = {list = true, allow_holes = true}, ["f=alt"] = {list = true, allow_holes = true}, ["f=sc"] = {list = true, allow_holes = true}, ["f=id"] = {list = true, allow_holes = true}, args["f=tr"2] = {list = true, allow_holes = true}, ["f=g"] = {list = true, allow_holes = true}, ["f=qual"] = {list = true, allow_holes = true}, ["f=nolink"] = {list = true, allow_holes = true, type = "boolean"}, ["f=lang"] = {list = true, allow_holes = true},} function export.head_t(frame) local args = require("Module:parameters").process(frame:getParent().args, params)
-- Get language if not data.pos_category:find("s$") and script information local lang = argsnot invariable[1data.pos_category]then -- Make the plural form of the part of speech local sc = args[ if data.pos_category:find("scx$"]) then local cat_sc data.pos_category = args[data.pos_category .. "cat sces"] lang else data.pos_category = require("Module:languages")data.pos_category ..getByCode(lang) or require("Module:languagess").err(lang, 1) end end
if cat_sc then
cat_sc data.pos_category = (cat_sc and (require("Module:scripts")data.pos_category ..getByCode(cat_sc) or error("The script code \"in " .. cat_sc .. "\" is not valid.")) or nil:getCategoryName() sc = cat_sc end -- Additional categories elseif args["cat2"] then sc = table.insert(sc and (requiredata.categories, lang:getCanonicalName("Module:scripts").getByCode(sc) or error("The script code \. "" .. sc .. args["\cat2" is not valid.")) or nil])
end
-- Gather basic parameters local sort_key = if args["sortcat3"]then local pos = args[2] local cat2 = args[ table.insert(data.categories, lang:getCanonicalName() .. "cat2"] local cat3 = args["cat3"] local cat4 = .. args["cat4"]) local heads = args["head"] local translits = args["tr"] local genders = args["g"] local accels = args["faccel"] local requests = args["frequest"] local alts = args["falt"] local gs = args["fg"] local ids = args["fid"] local langs = args["flang"] local nolinks = args["fnolink"] local quals = args["fqual"] local scs = args["fsc"] local trs = args["ftr"]end
-- Gather inflected formsif args["cat4"] then table.insert(data.categories, lang:getCanonicalName() .. " " .. args["cat4"]) local inflections = {}end
-- Go over all the inflection parametersInflected forms
for i = 1, math.ceil(args[3].maxindex / 2) do
local infl_part = {
label = args[3][i * 2 - 1],
accel = accelsargs["faccel"][i], request = requestsargs["frequest"][i],
}
local form = {
term = args[3][i * 2],
alt = altsargs["falt"][i], genders = {gsargs["fg"][i]}, id = idsargs["fid"][i], lang = langsargs["flang"][i], nolink = nolinksargs["fnolink"][i], qualifiers = {qualsargs["fqual"][i]}, sc = scsargs["fsc"][i], translit = trsargs["ftr"][i],
}
if form.lang ~= nil then
form.lang = require("Module:languages").getByCode(form.lang) or require("Module:languages").err(form.lang, "f" .. i .. "lang")
end
if form.sc ~= nil then
form.sc = require("Module:scripts").getByCode(form.sc) or error("The script code \"" .. form.sc .. "\" is not valid.")
end
if infl_part.label == "or" then
-- Append to the previous inflection part, if one exists
if #infl_part > 0 and data.inflections[1] then table.insert(data.inflections[#data.inflections], form)
end
elseif infl_part.label then
-- Add a new inflection part
table.insert(data.inflections, infl_part) end end -- Get/set categories local categories = {} local tracking_categories = {} if pos then if not pos:find("s$") and not invariable[pos] then -- Make the plural form of the part of speech if pos:find("x$") then pos = pos .. "es" else pos = pos .. "s" end
end
table.insert(categories, lang:getCanonicalName() .. " " .. pos .. (cat_sc and " in " .. cat_sc:getCategoryName() or ""))
end
if cat2 then
table.insert(categories, lang:getCanonicalName() .. " " .. cat2)
end
if cat3 then
table.insert(categories, lang:getCanonicalName() .. " " .. cat3)
end
if cat4 then
table.insert(categories, lang:getCanonicalName() .. " " .. cat4)
end
if #categories == 0 and mw.title.getCurrentTitle().nsText == "Template" then
categories = {"Undetermined nouns"}
end
return require("Module:headword").full_headword(lang, sc, heads, translits, genders, inflections, categories, sort_key) .. require("Module:utilities").format_categories(tracking_categories, lang, sort_keydata)
end
return export
Utente anonimo

Menu di navigazione