45,660
edits
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
local export = {} | local export = {} | ||
function format_pos(poscat) | |||
if poscat == "noun" then | |||
return "'''" .. args[1] .. "'''" | |||
end | |||
end | |||
-- The main entry point. | -- The main entry point. | ||
-- This is the only function that can be invoked from a template. | -- This is the only function that can be invoked from a template. | ||
function export.show(frame) | function export.show(frame) | ||
local | local PAGENAME = mw.title.getCurrentTitle().text | ||
PAGENAME = | local params = { | ||
[1] = { default = PAGENAME }, | |||
[2] = { required = true }, | |||
} | |||
local args = require("Module:parameters").process(frame:getParent().args, params) | |||
local head = args[ | local head = args[1] | ||
if head == "" then | |||
head = nil | |||
end | |||
local poscat = args[2] | |||
local data = {lang = lang, pos_category = (postype and postype .. " " or "") .. poscat, categories = {}, heads = {head}, genders = {}, inflections = {}} | |||
local poscat = | |||
local data = {pos_category = poscat, categories = {}, heads = {head}, genders = {}, inflections = {}} | |||
if poscat == "adjectives" then | if poscat == "adjectives" then | ||
if PAGENAME:find("^-") then | if PAGENAME:find("^-") then | ||
data.pos_category = "suffixes" | data.pos_category = "suffixes" | ||
data.categories = {" | data.categories = {"Proto-Germanic adjective-forming suffixes"} | ||
end | end | ||
adjective(args, data) | adjective(args, data) | ||
elseif poscat == "adverbs" then | elseif poscat == "adverbs" then | ||
if | if SUBPAGENAME:find("^-") then | ||
data.pos_category = "suffixes" | data.pos_category = "suffixes" | ||
data.categories = {" | data.categories = {"Proto-Germanic adverb-forming suffixes"} | ||
end | end | ||
adverb(args, data) | adverb(args, data) | ||
elseif poscat == "determiners" then | elseif poscat == "determiners" then | ||
Line 36: | Line 42: | ||
if PAGENAME:find("^-") then | if PAGENAME:find("^-") then | ||
data.pos_category = "suffixes" | data.pos_category = "suffixes" | ||
data.categories = {" | data.categories = {"Proto-Germanic noun-forming suffixes"} | ||
end | end | ||
noun_gender(args, data) | noun_gender(args, data) | ||
elseif poscat == "proper nouns" then | elseif poscat == "proper nouns" then | ||
Line 45: | Line 50: | ||
if PAGENAME:find("^-") then | if PAGENAME:find("^-") then | ||
data.pos_category = "suffixes" | data.pos_category = "suffixes" | ||
data.categories = {" | data.categories = {"Proto-Germanic verb-forming suffixes"} | ||
end | end | ||
end | end | ||
return | return format_pos(poscat) | ||
end | end | ||
Line 56: | Line 61: | ||
function noun_gender(args, data) | function noun_gender(args, data) | ||
local valid_genders = { | local valid_genders = { | ||
[" | ["m"] = true, | ||
[" | ["f"] = true, | ||
[" | ["n"] = true, | ||
[" | ["m-p"] = true, | ||
["f-p"] = true, | |||
["n-p"] = true} | |||
-- Iterate over all gn parameters (g2, g3 and so on) until one is empty | -- Iterate over all gn parameters (g2, g3 and so on) until one is empty | ||
Line 71: | Line 77: | ||
end | end | ||
-- If any of the specifications is a "?", add the entry | |||
-- to a cleanup category. | |||
if g == "?" then | |||
table.insert(data.categories, "Requests for gender in Proto-Germanic entries") | |||
elseif g == "m-p" or g == "f-p" or g == "n-p" then | |||
table.insert(data.categories, "Proto-Germanic pluralia tantum") | |||
end | |||
table.insert(data.genders, g) | table.insert(data.genders, g) | ||
g = args["g" .. i] or "" | g = args["g" .. i] or "" | ||
Line 112: | Line 126: | ||
end | end | ||
end | end | ||
return export |