Modul:taxonomy
A modult a Modul:taxonomy/doc lapon tudod dokumentálni
local export = {}
local lang_en = require("Module:languages").getByCode("en")
local lang_mul = require("Module:languages").getByCode("mul")
function export.taxon(frame)
local params = {
[1] = {required = true, default = "{{{1}}}"},
[2] = {required = true, default = "{{{2}}}"},
[3] = {required = true, default = "{{{3}}}"},
[4] = {},
["i"] = {type = "boolean"},
["nodot"] = {type = "boolean"},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local ret = {}
local categories = {"mul:Taxonomic names (" .. args[1] .. ")"}
table.insert(ret, "A taxonomic ")
table.insert(ret, require("Module:links").language_link{lang = lang_en, term = args[1]})
table.insert(ret, " within the ")
table.insert(ret, require("Module:links").language_link{lang = lang_en, term = args[2]})
table.insert(ret, " ")
local parent = require("Module:links").language_link{lang = lang_mul, term = args[3]}
if args[2] == "genus" or args[2] == "species" or args["i"] then
parent = "''" .. parent .. "''"
end
table.insert(ret, parent)
-- Track missing taxonomic name
parent = mw.title.new(args[3])
if not (parent and parent.exists) then
table.insert(categories, "Entries using missing taxonomic name (" .. args[2] .. ")")
end
-- Vernacular name
if args[4] then
table.insert(ret, " – ")
table.insert(ret, args[4])
else
table.insert(categories, "Taxonomic names needing vernacular names")
end
if not args["nodot"] then
table.insert(ret, ".")
end
return table.concat(ret) .. require("Module:utilities").format_categories(categories, lang_mul)
end
return export