Module:User:Njardarlogar/nn-adj-irreg

local export = {} local linker = require('Module:nn-link')

local m_headword = require("Module:headword") local lang = require("Module:languages").getByCode("nn") function export.main(frame) args = frame:getParent.args PAGENAME = mw.title.getCurrentTitle.text length = PAGENAME:len if args['meir'] or args['more'] then meir = true end masculine = args['mfn'] or args['fmn'] or args['mf'] or args['fm'] or args['m'] feminine = args['mfn'] or args['fmn'] or args['mf'] or args['fm'] or args['f'] neuter = args['mfn'] or args['fmn'] or args['n'] definite_singular = args['ds_pl'] or args['ds'] plural = args['ds_pl'] or args['pl']

local inflections = {} if masculine == feminine == neuter then inflections[1] = {label = 'indefinite singular', masculine} elseif masculine == feminine then inflections[1] = {label = 'masculine and feminine', masculine} inflections[2] = {label = 'neuter', neuter} else inflections[1] = {label = 'masculine', masculine} inflections[2] = {label = 'feminine', feminine} inflections[3] = {label = 'neuter', neuter} end if definite_singular == plural then table.insert(inflections, {label = 'definite singular and plural', definite_singular}) else table.insert(inflections, {label = 'definite singular', definite_singular}) table.insert(inflections, {label = 'plural', plural}) end if not meir then comparative = args['comp'] or args['comparative'] if args['comp2'] or args['comparative2'] then comparative2 = args['comp2'] or args['comparative2'] comparative = linker.link(PAGENAME, comparative) .. '/' .. linker.link(PAGENAME, comparative2) end indefinite_superlative = args['super_indef'] if args['super_indef2'] then indefinite_superlative2 = args['super_indef2'] indefinite_superlative = linker.link(PAGENAME, indefinite_superlative) .. '/' .. linker.link(PAGENAME, indefinite_superlative2) end definite_superlative = args['super_def'] if args['super_def2'] then definite_superlative2 = args['super_def2'] definite_superlative = linker.link(PAGENAME, definite_superlative) .. '/' .. linker.link(PAGENAME, definite_superlative2) end if comparative then table.insert(inflections, {label = 'comparative', comparative}) end if indefinite_superlative then table.insert(inflections, {label = 'indefinite superlative', indefinite_superlative}) end if definite_superlative then table.insert(inflections, {label = 'definite superlative', definite_superlative}) end end return m_headword.format_headword(PAGENAME, lang, nil) .. m_headword.format_inflections(inflections, lang, nil) end

return export