Module:nn-adj-irreg
Appearance
- The following documentation is located at Module:nn-adj-irreg/documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
local export = {}
local lang = require("Module:languages").getByCode("nn")
function export.main(frame)
local args = frame:getParent().args
local PAGENAME = mw.title.getCurrentTitle().text
local meir = not not (args['meir'] or args['more'])
local masculine = args['mfn'] or args['fmn'] or args['mf'] or args['fm'] or args['m'] or args['masculine'] or PAGENAME
local feminine = args['mfn'] or args['fmn'] or args['mf'] or args['fm'] or args['f'] or args['feminine'] or PAGENAME
local neuter = args['mfn'] or args['fmn'] or args['n'] or args['neuter'] or PAGENAME .. 't'
local definite_singular = args['ds_pl'] or args['ds'] or args['definite_singular'] or PAGENAME .. 'e'
local plural = args['ds_pl'] or args['pl'] or args['plural'] or PAGENAME .. 'e'
local data = {lang = lang, pos_category = "adjectives", categories = {}, inflections = {}}
if masculine == feminine == neuter and masculine ~= '-' then
table.insert(data.inflections, { label = 'indefinite singular', masculine })
elseif masculine == feminine and masculine ~= '-' then
table.insert(data.inflections, { label = 'masculine and feminine', masculine })
table.insert(data.inflections, { label = 'neuter', neuter })
else
if masculine ~= '-' then
table.insert(data.inflections, {label = 'masculine', masculine})
end
if feminine ~= '-' then
table.insert(data.inflections, {label = 'feminine', feminine})
end
if neuter ~= '-' then
table.insert(data.inflections, {label = 'neuter', neuter})
end
end
if definite_singular == plural then
if args['ds_pl2'] then
local definite_singular2 = args['ds_pl2']
definite_singular = '[[' .. definite_singular .. ']]/[[' .. definite_singular2 .. ']]'
end
if plural ~= '-' then
table.insert(data.inflections, {label = 'definite singular and plural', definite_singular})
end
else
if args['ds2'] then
local definite_singular2 = args['ds2']
definite_singular = '[[' .. definite_singular .. ']]/[[' .. definite_singular2 .. ']]'
end
if args['ds3'] then
local definite_singular3 = args['ds3']
definite_singular = definite_singular .. '/[[' .. definite_singular3 .. ']]'
end
if args['pl2'] then
local plural2 = args['pl2']
plural = '[[' .. plural .. ']]/[[' .. plural2 .. ']]'
end
if definite_singular ~= '-' then
table.insert(data.inflections, {label = 'definite singular', definite_singular})
end
if plural ~= '-' then
table.insert(data.inflections, {label = 'plural', plural})
end
end
if not meir then
local comparative = args['comp'] or args['comparative'] or PAGENAME .. 'are'
if args['comp2'] or args['comparative2'] then
local comparative2 = args['comp2'] or args['comparative2']
comparative = '[[' .. comparative .. ']]/[[' .. comparative2 .. ']]'
end
local indefinite_superlative = args['sup_indef'] or PAGENAME .. 'ast'
if args['sup_indef2'] then
local indefinite_superlative2 = args['sup_indef2']
indefinite_superlative = '[[' .. indefinite_superlative .. ']]/[[' .. indefinite_superlative2 .. ']]'
end
local definite_superlative = args['sup_def'] or PAGENAME .. 'aste'
if args['sup_def2'] then
local definite_superlative2 = args['sup_def2']
definite_superlative = '[[' .. definite_superlative .. ']]/[[' .. definite_superlative2 .. ']]'
end
if args['sup'] or args['superlative'] then
indefinite_superlative = args['sup'] or args['superlative']
definite_superlative = indefinite_superlative .. 'e'
end
if args['sup2'] or args['superlative2'] then
indefinite_superlative2 = args['sup2'] or args['superlative2']
indefinite_superlative = '[[' .. indefinite_superlative .. ']]/[[' .. indefinite_superlative2 .. ']]'
definite_superlative2 = indefinite_superlative2 .. 'e'
definite_superlative = '[[' .. definite_superlative .. ']]/[[' .. definite_superlative2 .. ']]'
end
if comparative then
table.insert(data.inflections, {label = 'comparative', comparative})
end
if indefinite_superlative then
table.insert(data.inflections, {label = 'indefinite superlative', indefinite_superlative})
end
if definite_superlative then
table.insert(data.inflections, {label = 'definite superlative', definite_superlative})
end
elseif meir then
table.insert(data.inflections, { label = 'comparative', '[[meir]] ' .. PAGENAME })
table.insert(data.inflections, { label = 'superlative', '[[mest]] ' .. PAGENAME })
end
return require("Module:headword").full_headword(data)
end
return export