Module:User:Sarri.greek/grk-nouns-decl

Hello, you have come here looking for the meaning of the word Module:User:Sarri.greek/grk-nouns-decl. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:User:Sarri.greek/grk-nouns-decl, but we will also tell you about its etymology, its characteristics and you will know how to say Module:User:Sarri.greek/grk-nouns-decl in singular and plural. Everything you need to know about the word Module:User:Sarri.greek/grk-nouns-decl you have here. The definition of the word Module:User:Sarri.greek/grk-nouns-decl will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:User:Sarri.greek/grk-nouns-decl, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

-- 2024.03.06. ]
--[=[
Inflectional table for noun declensions in Greek (various phases, ] or ])
PRINCIPLES
	Allow complete freedom for the editor.
	Make declension Templates, Categories of declensions, of exceptions too.
	Make modules easy to edit. SEE the full declension and its Categories at /function pages.
	Grammatical terms of titles in English
		and tooltips in English (the host language of en.wiktionary)
		plus translation to the target language.
STRUCTURE of module
	main page has rules and tables
	/param page has a wide collection of parameters.
		They follow every function of the /1 function page.
		No need to rewrite at declension Templates the parameters again and again.
	/1(, 2, 3...) pages for functions: set sequences of declensions to make Templates.
	Parameters with the suffix mod- are the parameters set in this module's functions.
		Without the suffix mod-, is the editor's overriding of each parameter.
		
STRUCTURE of cells (example for genitive singular SG)
aGS = the cell and the word.article for GS. Required from other modules.
GScell has two lines GSline and GS2line
	GSline has: GStxt1 .. GSterm .. GSflag .. GStxt
	The term has: common1 .. GSword .. common. The term can be transliterated as a whole.
	The word has link for: GSstem .. GSsuf (alternative output: GSstem+, GSsuf+)
A second singular column or/and a second plural column are possible (for nouns with double genders).
Sections of the table, titles, params can be altered according to the language code used
	For example, no dual for Medieval Greek, no datives for vulgar Medieval or Modern Greek, ...
CONTENTS
	1) stem production, required modules
	2) links & style
	3) the table
	4) categories
PROBLEMS
	many.
	term and word and transliteration are not done yet.
]=]--

export = {} -- DO NOT write local export. It does not work.

--------------------------------------------------------------------------
--                 1. STEM PRODUCTION, REQUIRED MODULES                 --
--------------------------------------------------------------------------

--languages = require("Module:languages") -- choose grk language: grc, grc-koi, gkm, el-kth, el, etc
	-- e.g. require("Module:languages").getByCode("grc")
	-- lang_iso is the official ISO code as in ]
	-- lang choices like parameters grc=1, gkm=1, el-kth=1 are for special titles etc of each table.

module_path = 'Module:User:Sarri.greek/grk-nouns-decl'

m_1 = require(module_path .. "/1") 
-- cannot call all subpages directly from here. Each one will call the next:
-- here we call m_1 = require(module_path .. "/1")
		-- m_1 calls: m_2 = require(module_path .. "/2")
			-- m_2 calls m_3 and so forth

m_stems = require("Module:User:Sarri.greek/stems") -- cut parts of words to create stems

m_stems_grk = require("Module:User:Sarri.greek/grk-stems") -- stem production for grk
	-- conversions of diacritics on a  stem
m_data = require("Module:User:Sarri.greek/grk-stems/data") -- write sequences of letters
	-- e.g. m_data.brachy_oxia = ''

-- articles: Write below, exactly at where they are needed:
		-- polytonic: require ('Module:grc-articles').articles (args)
		-- monotonic: require ('Module:el-articles').articles (args)

-- parameters: call the page /param (it has all parameters) at bottom of this page

--------------------------------------------------------------------------
--                          2. links & styles                           --
--------------------------------------------------------------------------
-- also, see below, at languages, special colours for different language ISO
-- possible: different colour for stems - endings

-- =============== colours
-- borders (sample 1)
c_border = '#c9d7e8'		-- same as c3 or stronger: same as c_1
c_bord = '#f4f4f4'			-- inner soft borders
c_bordR = '' 
	-- If there are more columns, it is soft c_bord.
	-- If it is an outer border, it is stronger c_border.

-- background colours (sample 1)
c_extra = '#b0c4de'	-- very dark. For extratitle.
c_1 = '#93aed2'		-- dark. For title1 MAIN, number names - border for title2 if it exists
c_2 = '#a5bcd9'		-- not so dark. For title2, subtitles, genders of adjectives - border for title1
c_3 = '#e3e5e8'		-- grey. For title3, all the subtitles.
c_4 = '#edf2f7'		-- very soft. For background for notes.

-- font colours (sample 1: all black)
c_ending = '#000000'		-- black. At el.wikt is DeepPink #eb0000
c_stem = '#000000'		-- black. Also try #002000
c_black = '#000000'		-- for subtitles
-- to do
-- expected: grey?
-- attested: bold?

-- =============== styles
-- for table style, cf. the beginning of fulltable

font_cell = "font-family:; letter-spacing:1px;"		-- tested, rejected: Palatino linotype; font-family:Times; 
fontsize_cell = "font-size:110%;"	-- 105%?

--  ============== apply font colours
-- for parts of a word
ending_color = function(suffix)
    return '<span style="color:' .. c_ending ..'; font-weight:normal;">' .. suffix .. '</span>'
end

stem_color = function(thema)
    return '<span style="color:' .. c_stem ..'; font-weight:normal;">' .. thema .. '</span>'
end

infix_color = function(infix)
    return '<span style="color:' .. c_stem ..'; font-weight:normal;">' .. infix .. '</span>'
end
	-- this is not exactly an inifix. It is extra letters of a 2nd stem.
	-- possible different colour or weight

-- for subtitles:
black_color = function(black_thing)
    return '<span style="color:' .. c_black ..'; font-weight:normal;">' .. black_thing .. '</span>'
end

-- ====================== Links for the words in the table
-- create_link = function(page, text) -- see at /param page


-- it controls stem (thema) and ending (suffix)
linkcontrol2 = function(thema, suffix)
	thema = thema or ''
	suffix = suffix or ''
	return create_link(thema .. suffix, stem_color(thema) ..  ending_color(suffix))
end

-- it controls stem, infixed letters and ending
linkcontrol3 = function(thema, infix, suffix)
	thema = thema or ''
	infix = infix or ''
	suffix = suffix or ''
	return create_link(thema .. infix .. suffix, stem_color(thema) ..  infix_color(infix) .. ending_color(suffix))
end

-- ====================== Errors -- use it with writing: if blahblah then return errorhere('xxxxxx') end
errorhere = function(errstring)
	return '<div class="error">' .. errstring .. '</div>]'
end


-- NOT USED HERE
-- only for grc (Ancient Greek) when dichrona letters α, ι, υ NEED prosody
error_dichr = function(errordichrstring)
	page = mw.title.getCurrentTitle()
	page.name = page.text:match( "^%s*(.-)%s*$" )
	if page.namespace == 0 then	-- Categories work only in MAIN namespace	
	return '<div style="font-size:15px; color:red;">* Declension needs prosody with |dichr=b (brachy) or  |dichr=m (macron).'
		..'<br>If there is no information, |dichr=? Probable, |dichr=uncertain (puts brachy)</div>'
		.. ']'	
	else
	return  '<div style="font-size:15px; color:red;">* Declension needs prosody with |dichr=b (brachy) or  |dichr=m (macron).'
		..'<br>If there is no information, |dichr=? Probable, |dichr=uncertain (puts brachy)</div>'
	end
end

--------------------------------------------------------------------------
--                            3. TABLE                                  --
--------------------------------------------------------------------------

fulltable = function(args)
	
	
-- table: DEFAULT at LEFT -- for some browsers need border="1"
local float = args or ''
	if args == 'right' then
table_style1 = 'style="clear:right; float:right; margin-left:0.5em; margin-bottom:0.5em;'
	.. 'background:#ffffff; color:#000000; border:1px solid' .. c_border ..'; text-align:right;"'
	.. 'rules="none" border="1" cellpadding="3" cellspacing="0"'
	elseif args == 'center' then
table_style1 = 'style="margin-left:auto; margin-right:auto; margin-bottom:0.5em;'
	.. 'background:#ffffff; color:#000000; border:1px solid' .. c_border ..'; text-align:center;"'
	.. 'rules="none" border="1" cellpadding="3" cellspacing="0"'	
	else
table_style1 = 'style="clear:left; float:left; position:relative; margin:0px 1.5em 0.5em 0px;'
	.. 'background:#ffffff; color:#000000; border:1px solid' .. c_border ..'; text-align:left;"'
	.. 'rules="none" border="1" cellpadding="3" cellspacing="0"'
	end

-- also see /param page
-- mod- = as in the module
	if args ~= '' and args ~=  nil then
		args = args .. '<br>' .. args
	end


-- =============== LANGUAGES for categories and notes 
-- see /param page


-- =============== OTHER PARAMs
	local columns = args or ''
		-- number of columns: 1+2 if only one number, 1+4 if 2 numbers 1+6 if double plural or double singular, 1+8 double sing & double pl
	local dichr = args or ''		-- for dichronous (either macron or brachy δίχρ=β is brachy)

-- NOT USED
--[=[
	if args == '1' or args == '1' or args == '1' or args == '1' then
		cat_pos = 'Proper nouns'
]=]--

-- typos, declension -- 	cat = args or ''	-- this does not work from here
	typos = args or ''		-- this is name of declension
	local declension = args or ''		-- also see notes and Categories
		if args == '1' then declension = '1st' end
		if args == '2' then declension = '2nd' end
		if args == '2att' then declension = '2nd attic' end
		if args == '3' then declension = '3rd' end
		if args == 'irregular' then declension = 'irregular' end 
		if args == '0' then declension = 'irregular' end
		if args == 'm' then declension = 'masculine' end
		if args == 'f' then declension = 'feminine' end
		if args == 'n' then declension = 'neuter' end
		if args == 'c' then declension = 'common gender' end
		-- mf, fm, fn?


-- =============== lines and rows
	local stem_line = ''
	local stem_cell = ''
	-- stem line MUST be placed at Section ROWS

-- row for subtitles
	local subtitle = ''
	local subtitle_sg = args or ''
	-- TODONOW MUST add these:
			if args == 'm' then args = ']'
		elseif args == 'f' then args = ']'
		elseif args == 'n' then args = ']'
		elseif args == 'c' then args = '<span title="common gender - κοινού γένους">common</span> [[masculine|<span title="masculine gender - αρσενικό γένος">' 
			.. black_color('masculine') .. '</span>]]/]'
		elseif args == 'mf' then args = '[[masculine|<span title="masculine gender - αρσενικό γένος">' 
			.. black_color('masculine') .. '</span>]] or ]'
		elseif args == 'fm' then args = '[[feminine|' 
			.. black_color('feminine') .. ']] or ]'
		elseif args == 'fn' then args = '] or ]'
-- do I need to negate all the above here?
		else args = args or ''
		end
	local subtitle_sg2 = args or ''
			if args == 'm' then args = ']'
		elseif args == 'f' then args = ']'
		elseif args == 'n' then args = ']'
		elseif args == 'c' then args = '<span title="common gender - κοινού γένους">common</span> [[masculine|<span title="masculine gender - αρσενικό γένος">' 
			.. black_color('masculine') .. '</span>]]/]'
		elseif args == 'mf' then args = '[[masculine|<span title="masculine gender - αρσενικό γένος">' 
			.. black_color('masculine') .. '</span>]] or ]'
		elseif args == 'fm' then args = '[[feminine|' 
			.. black_color('feminine') .. ']] or ]'
		elseif args == 'fn' then args = '] or ]'
		else args = args or ''
		end
	local subtitle_pl = args or ''
			if args == 'm' then args = ']'
		elseif args == 'f' then args = ']'
		elseif args == 'n' then args = ']'
		elseif args == 'c' then args = '<span title="common gender - κοινού γένους">common</span> [[masculine|<span title="masculine gender - αρσενικό γένος">' 
			.. black_color('masculine') .. '</span>]]/]'
		elseif args == 'mf' then args = '[[masculine|<span title="masculine gender - αρσενικό γένος">' 
			.. black_color('masculine') .. '</span>]] or ]'
		elseif args == 'fm' then args = '[[feminine|' 
			.. black_color('feminine') .. ']] or ]'
		elseif args == 'fn' then args = '] or ]'
		else args = args or ''
		end
	local subtitle_pl2 = args or ''
			if args == 'm' then args = ']'
		elseif args == 'f' then args = ']'
		elseif args == 'n' then args = ']'
		elseif args == 'c' then args = '<span title="common gender - κοινού γένους">common</span> [[masculine|<span title="masculine gender - αρσενικό γένος">' 
			.. black_color('masculine') .. '</span>]]/]'
		elseif args == 'mf' then args = '[[masculine|<span title="masculine gender - αρσενικό γένος">' 
			.. black_color('masculine') .. '</span>]] or ]'
		elseif args == 'fm' then args = '[[feminine|' 
			.. black_color('feminine') .. ']] or ]'
		elseif args == 'fn' then args = '] or ]'
		else args = args or ''
		end
--TODO subtitles for multiple variation of genders

-- =============== NEED all parameters of the fulltable
	-- numbers
	local sg_title_str = ''			-- singularis title string / ἑνικός
	local sg2_title_str = ''		-- 2nd singualr title / 2ος ενικός αν υπάρχει
	local pl_title_str = ''			-- pluralis  title / πληθυντικός
	local pl2_title_str = ''		-- 2nd plural title / 2ος πληθυντικός αν υπάρχει
	local dualrow = ''				-- not always
	local du_title_str = ''			-- dualis title / δυϊκός
	-- cases
	local nom_sg_str = ''			-- nominativus singularis / ὀνομαστική ἑνικός
	local nom_sg2_str = ''
	local nom_pl_str = ''
	local nom_pl2_str = ''
	local nom_du_str = ''
	local gen_sg_str = ''			-- genitivus / γενική
	local gen_sg2_str = ''
	local gen_pl_str = ''
	local gen_pl2_str = ''
	local gen_du_str = ''
	local dat_sg_str = ''			-- dativus / δοτική
	local dat_sg2_str = ''
	local dat_pl_str = ''
	local dat_pl2_str = ''
	local dat_du_str = ''
	local acc_sg_str = ''			-- accusativus / αἰτιατική
	local acc_sg2_str = ''
	local acc_pl_str = ''
	local acc_pl2_str = ''
	local acc_du_str = ''
	local voc_sg_str = ''			-- vocativus / κλητική
	local voc_sg2_str = ''
	local voc_pl_str = ''
	local voc_pl2_str = ''
	local voc_du_str = ''
	-- articles / ἄρθρα (see Module for grc or el  articles (Also parameter άρθρα=0 to omit all articles)
	local a_nom_sg_str = ''
	local a_nom_sg2_str = ''
	local a_nom_pl_str = ''
	local a_nom_pl2_str = ''
	local a_nom_du_str = ''
	local a_gen_sg_str = ''
	local a_gen_sg2_str = ''
	local a_gen_pl_str = ''
	local a_gen_pl2_str = ''
	local a_gen_du_str = ''
	local a_dat_sg_str = ''
	local a_dat_sg2_str = ''
	local a_dat_pl_str = ''
	local a_dat_pl2_str = ''
	local a_dat_du_str = ''
	local a_acc_sg_str = ''
	local a_acc_sg2_str = ''
	local a_acc_pl_str = ''
	local a_acc_pl2_str = ''
	local a_acc_du_str = ''
	local a_voc_sg_str = ''
	local a_voc_sg2_str = ''
	local a_voc_pl_str = ''
	local a_voc_pl2_str = ''
	local a_voc_du_str = ''


-- ARTICLES ===========================================================
-- monotonic, phonemic transliteration
	if args == '1' -- or also pnt, tsd, etc check all dialects
	then
	require ('Module:User:Sarri.greek/el-articles').articles (args)
	
--[=[
-- polytonic + datives, no dual, phonemic transliteration
	elseif args == '1' or args == '2'
		or args == '1' or args == '2'
		or args == '1' or args == '2'
	then
	require ('Module:User:Sarri.greek/gkm-articles').articles (args)
]=]--

-- need a default  -- full aritcles (duals and datives as in Ancient Greek)
-- polytonic + dual, exact symbol transliteration
	else
	require ('Module:User:Sarri.greek/grc-articles').articles (args)
	end

-- ============== grammatical terms (English) with tooltips according to language
-- put at the table, writing: .. singular ..
-- separately gkm (just in case there will be differences)
-- tooltips in English and Greek (polytonic also has accent bareia)
-- Declare with xxxx = args or '' is needed otherwise NOTHING works
-- Then, make the arg zero, otherwise we see an empty cell
singular = args or ''	args = args or ''
if args then
	if args == '1' or args == '1' or args == '2' then
		singular = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
	elseif args == '1' or args == '1' or args == '2' or args == '2' then
		singular = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
	elseif args == '1' then
		singular = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
	else
		singular = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
	end
end
plural = args or ''	args = args or ''
	if args == '1' or args == '1' or args == '2' then
		plural = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
	elseif args == '1' or args == '1' or args == '2' or args == '2' then
		plural = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
	elseif args == '1' then
		plural = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
	else
		plural = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
	end
dual  = args or ''	args = args or '' -- to omit dual, args = '-'
	if args == '1' or args == '1' or args == '2' then
		dual = ']'
	elseif args == '1' or args == '1' or args == '2' or args == '2' then
		dual = ']'
			-- normally, not needed at gkm
	elseif args == '1' then
		dual = ']'
			-- normally, not needed at el
	else
		dual = ']'
	end

nominative = args or ''	args = args or ''
	if args == '1' or args == '1' or args == '2' then
		nominative = ']'
	elseif args == '1' or args == '1' or args == '2' or args == '2' then
		nominative = ']'
	elseif args == '1' then
		nominative = ']'
	else
		nominative = ']'
	end

genitive = args or ''	args = args or ''
	if args == '1' or args == '1' or args == '2' then
		genitive = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]'
	elseif args == '1' or args == '1' or args == '2' or args == '2' then
		genitive = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]'
	elseif args == '1' then
		genitive = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]'
	else
		genitive = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]'
	end

dative = args or ''	args = args or ''
	if args == '1' or args == '1' or args == '2' then
		dative = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]'
	elseif args == '1' or args == '1' or args == '2' or args == '2' then
		dative = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]'
			-- normally, not needed at gkm
	elseif args == '1' then
		dative = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]'
			-- normally, not needed at el
	else
		dative = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]'
	end

accusative = args or ''	args = args or ''
	if args == '1' or args == '1' or args == '2' then
		accusative = '&nbsp;&nbsp;&nbsp;&nbsp;]'
	elseif args == '1' or args == '1' or args == '2' or args == '2' then
		accusative = '&nbsp;&nbsp;&nbsp;&nbsp;]'
	elseif args == '1' then
		accusative = '&nbsp;&nbsp;&nbsp;&nbsp;]'
	else
		accusative = '&nbsp;&nbsp;&nbsp;&nbsp;]'
	end

vocative = args or ''	args = args or ''
	if args == '1' or args == '1' or args == '2' then
		vocative = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]'
		.. ' ]!'
	elseif args == '1' or args == '1' or args == '2' or args == '2' then
		vocative = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]'
		.. ' ]!'
	elseif args == '1' then
		vocative = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]'
		.. ' ]!'
  -- need a default -- no greek tooltip	
	else
		vocative = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]'
	end



-- NUMBERS ============================================================
	local hassingular = true		-- (args ~= nil)
	local hasplural = true			-- (args ~= nil)
	local hasdual = true			-- (args ~= '-')

	-- num=		The other number does NOT exist and is NOT expected. For pluralia and singularia tantum.
	-- num2=	The other number grammatically exists. For special sense in this number.
	-- SD		yes dual together with singular
	-- PD		yes dual together with plural
	-- get singular and dual
	if args == "SD" or args == "SD" then
		hasplural = false
	end
	-- get singular only
	if args == "S" or args == "S" then							
		hasplural = false
		hasdual = false
	end
	-- get plural and dual
	if args == "PD" or args == "PD" then
		hassingular = false
	end
	-- get plural only
	if args == "P" or args == "P" then
		hassingular = false
		hasdual = false
	end
	



-- TODO number of columns for full rows ?????? may write e.g. columns = '10' and it is ok
	-- cf local columns above
	columns = '10' -- ????
	
-- NOTES & whole LINES ===============================================
    local note = args or ''				-- notes by editor
    local comment = args or ''	-- standard notes by Template
    local appendix = ''			-- standard link to Appendix (by language)
	local append = ''			-- link to gourp, category and specific paradigm at Appendix

-- group is a super-umbrella category if needed for similar declensions
-- Used at specific declension-functions.
    local group = args or ''
--[=[
    if args ~= '' and args ~= nil then
    	if args == 'συγκοπτόμενα' then
		group = "]," 
		else
    	-- make the group standard index, as cat_decl is
    	group = "]," 
		end
		-- NEED to WRITE AGAIN at CATEGORIES under if mainspace and under nocat
    end
]=]--

-- cat_decl (κατηγορία κλίσης) NOT for el -category for all 'type' subcategores like pluralia, exceptions, dialects
-- Used at specific declension-functions. E.g. cat-decl like large declensions with many variants στρατιώτης φύλαξ etc
    local cat_decl = args or ''
-- test also el, or withdraw
	if args ~= '' and args ~= nil then
			if args == 'defective' then
	   		cat_decl_str = " ]"
    		else
			cat_decl_str = " ]"
			end
	elseif (args ~= '' and args ~= nil) or (args ~= '' and args ~= nil) then
		cat_decl_str = " ]"
	else -- all grc, grc-koi, ancient dialects.
		if args == "-" or args == '' or args == nil then 
		cat_decl_str = '' -- control cat:
		elseif args ~= "-" and args ~= '' and args ~= nil then 
		  	if args == 'irregular' then
		  	cat_decl_str = " ]"
			elseif args == 'defective' then
	   		cat_decl_str = " ]"
    		else
    		cat_decl_str = " ]"
			end
		end
   end -- close if el, else if gkm, etc

-- as in =  a link to Appendix's clitic paradigm
    local as_in = args or ''
    if as_in ~= '' and as_in ~= nil then
		if args == '1' then
    		as_in = ' as in «]»'
    	elseif args == '2' then
    		as_in = ' as in «]»'
    	else -- all grc, grc-koi, gkm=1 etc
    		if args == 'irregular' or args == '0' then
    		as_in = ' as in  «]»'
    		elseif args == '2att' then
    		as_in = ' as in  «]»'
    		elseif args == '1' then
    		as_in = ' as in  «]»'
    		elseif args == '2' then
    		as_in = ' as in  «]»'
    		elseif args == '3' then
    		as_in = ' as in  «]»'
    		end
    	end -- close if language...
    end

-- append WRITE the first part of the appendix line
	if args == 'irregular' or args == '0' then
		append = '], ' .. group .. cat_decl_str .. as_in .. ' - '
	elseif args == '2att' then
		append = '], ' .. group .. cat_decl_str .. as_in .. ' - '
	elseif args == '1st' or args == '2nd' or args == '3rd' then
		append = '], ' .. group .. cat_decl_str .. as_in .. ' - '
	end


-- ============== note lines / comment, note
-- TODO?? Do I need if 5 columns only??? when only one number?

-- I need thin bar for legend with explanations of flags. Especially for gkm.
	-- See param page, if gkm...

	if args ~= '' or args ~= nil then -- TODO check or = and?
		if not (args == nil or mw.ustring.len(args) < 1) then
		note = '|-' .. "\n" .. =] .. columns .. =] .. c_4 .. =]
		note = note .. comment .. '<br>' .. args .. "\n"
		else
		note = '|-' .. "\n" .. =] .. columns .. =] .. c_4 .. =]
		note = note .. comment .. "\n"
		end
	end
	if args == '' or args == nil then
		if not (args == nil or mw.ustring.len(args) < 1) then
		note = '|-' .. "\n" .. =] .. columns .. =] .. c_4 .. =]
		note = note .. args .. "\n"
		else
		note = ''
		end
	end
	-- appendix
	if args == '-' then appendix = ''
	elseif args ~= '-'  and args ~= '' and args ~= nil  then
		appendix = '|-' .. "\n" .. =] .. columns .. =] .. c_4 .. =]
		appendix = appendix .. append .. args .. "\n"
	else
		appendix = '|-' .. "\n" .. =] .. columns .. =] .. c_4 .. =]
		appendix = appendix .. append .. '[[Appendix:' .. lang_name .. ' ' .. mw.getContentLanguage():lcfirst(pos) 
		.. '|<span title="Appendix:Nouns">Appendix:' .. lang_name .. ' ' .. mw.getContentLanguage():lcfirst(pos) ..  '</span>]]' .. "\n"
	end



-- CELLS  ============================================================
-- extra title string
	if args ~= '' and args ~= nil then
		extratitle_str =  args .. "\n"
	end
    
-- stem_cell --this is a full row, but it does not come first, it goes UNDER last row
	if args ~= '' and args ~= nil then
		-- colspan as in columms

		stem_cell = =] .. c_3 .. =] .. c_border .. =] .. font_cell .. fontsize_cell ..
		=] .. columns .. =] .. args .. "\n"
 
	end -- close stem_cell

----------- has singular

-- (spaces added for good copy-paste result)
if hassingular then
	-- for 2 columns only (table_style1's border does not apply)
	if args == 'S' or args == 'S' or args == 'SD' or args == 'SD' then
		c_bordR = c_border
    	
        sg_title_str = =] .. c_1 .. =] .. c_border ..
=] .. singular .. "\n"

        subtitle_sg = =] .. c_2 .. =] .. c_border ..
=] .. args .. "\n"

	else -- different right border
		c_bordR = c_bord -- soft right border if more columns follow
-- ?????????? why not .. args .. 	
        sg_title_str =  =] .. c_1 .. =] .. c_2 ..
=] .. singular .. "\n"
 
        subtitle_sg = =] .. c_2 .. =] .. c_1 ..
=] .. args .. "\n"	
	end

		--article nominative singular aNS
        a_nom_sg_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        nom_sg_str = =] .. c_bord .. =] .. c_bordR .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_gen_sg_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        gen_sg_str = =] .. c_bord .. =] .. c_bordR .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_dat_sg_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        dat_sg_str = =] .. c_bord .. =] .. c_bordR .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_acc_sg_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        acc_sg_str = =] .. c_bord .. =] .. c_bordR .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_voc_sg_str = =] .. font_cell .. fontsize_cell ..  =] .. args ..  "\n"
        voc_sg_str = =] .. c_bordR .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"

end -- close hassingular

----------- has plural
if hasplural then
	-- if 2nd plural follows, right borders are soft
	if args ~= '' and args ~= nil then
        	
        pl_title_str = =] .. c_1 .. =] .. c_2 ..
]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]=] .. "\n"

        subtitle_pl = =] .. c_2 .. =] .. c_1 ..
=] .. args .. "\n"

		--article nominative plural aNP 
        a_nom_pl_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        nom_pl_str = =] .. c_bord .. =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_gen_pl_str =  =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        gen_pl_str = =] .. c_bord .. =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_dat_pl_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        dat_pl_str = =] .. c_bord .. =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_acc_pl_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        acc_pl_str = =] .. c_bord .. =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_voc_pl_str = =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        voc_pl_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        
	else -- if 2nd plural does not follow we need strong right borders
        	
        pl_title_str = =] .. c_1 .. =] .. c_border ..
]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]=] .. "\n"

        subtitle_pl = =] .. c_2 .. =] .. c_border .. 
=] .. args .. "\n"
        
        a_nom_pl_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        nom_pl_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_gen_pl_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        gen_pl_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_dat_pl_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        dat_pl_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_acc_pl_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        acc_pl_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_voc_pl_str = =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        voc_pl_str = =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        
	end -- close if 2nd plural
        
end -- close hasplural

-- 2nd singular ------------
		--  DO i need these? YES
		args = args or ''
		args = args or ''
		args = args or ''
		args = args or ''
		args = args or ''
		args = args or ''
		args = args or ''
		args = args or ''
		args = args or ''

--[=[
-- need to open this column whenever there ANY element (word or article)
-- or the general command  subtitle-sg2=... 
	-- a) if any of this exists (oops i have =  '-' too)
--	if (args ~= '' and args ~= nil)
--	if (args ~= '' and args ~= nil) or (args ~= '' and args ~= nil)
--	or (args ~= '' and args ~= nil) or (args ~= '' and args ~= nil)
if args ~= '' and args ~= nil then errorhere('what gender?') end
--	if (args ~= '' and args ~= nil) or (args ~= '' and args ~= nil)
--	or (args ~= '' and args ~= nil) or (args ~= '' and args ~= nil)
--	or (args ~= '' and args ~= nil)
	-- then consider the general command open
--	then
--		args = args
--	end
]=]--

	if (args ~= '' and args ~= nil)
	then

        sg2_title_str = =] .. c_1 ..
=] .. singular .. "\n"

        subtitle_sg2 = =] .. c_2 ..
=] .. c_1 .. =] .. args .. "\n"
        
        a_nom_sg2_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        nom_sg2_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_gen_sg2_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        gen_sg2_str = =] .. c_bord  .. =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_dat_sg2_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        dat_sg2_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_acc_sg2_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        acc_sg2_str = =] .. c_bord  .. =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_voc_sg2_str = =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        voc_sg2_str = =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
	end	-- close sg2 exists


-- 2nd plural  ------------
		--  DO i need these? YES
		args = args or ''
		args = args or ''
		args = args or ''
		args = args or ''
		args = args or ''
		args = args or ''
		args = args or ''
		args = args or ''
		args = args or ''

-- need to open this column whenever there ANY element (word or article)
-- or the general command  subtitle-pl2=... 

	if (args ~= '' and args ~= nil)
	then

        pl2_title_str = =] .. c_1 ..
]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]=] .. "\n"

        subtitle_pl2 = =] .. c_2 ..
=] .. c_1 .. =] .. args .. "\n"
        
        a_nom_pl2_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        nom_pl2_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_gen_pl2_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        gen_pl2_str = =] .. c_bord  .. =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_dat_pl2_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        dat_pl2_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_acc_pl2_str = =] .. c_bord .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        acc_pl2_str = =] .. c_bord  .. =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        a_voc_pl2_str = =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
        voc_pl2_str = =] .. c_border .. =] .. font_cell .. fontsize_cell ..
        =] .. args ..  "\n"
	end	-- close pl2 exists



if hasdual then -- need lines only for nom, gen
-- yes dual ----------------

-- 2 cols	sing+dual OR plur+dual
	if (args == 'SD' or args == 'SD' or args == 'PD' or args == 'PD') and args ~= '-'
	and (args == '' or args == nil)
	and (args == '' or args == nil)
	then
    	
        du_title_str =  =] .. c_2 .. =] .. c_border ..
]]=] .. "\n"
        
        a_nom_du_str = =] .. c_bord ..
        =] .. args .. "\n"
        nom_du_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell ..
        =] .. args .. "\n"
        a_gen_du_str = =] .. c_bord ..
        =] .. args .. "\n"
        gen_du_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell ..
        =] .. args .. "\n"
    
-- 4 cols 
	elseif (args ~= 'SD' and args ~= 'SD' and args ~= 'PD' and args ~= 'PD') and args ~= '-'
	and (args == '' or args == nil)
	and (args == '' or args == nil)
	then
        du_title_str =  =] .. c_2 .. =] .. c_border ..
]]=] .. "\n"
        
        a_nom_du_str = =] .. c_bord ..
        =] .. args .. '&nbsp;' .. "\n"
        nom_du_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell ..
        =] .. args .. "\n"
        a_gen_du_str = =] .. c_bord ..
        =] .. args .. '&nbsp;' .. "\n"
        gen_du_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell ..
        =] .. args .. "\n"
        
-- 6 cols for  en en2 pl
	elseif (args ~= 'SD' and args ~= 'SD' and args ~= 'PD' and args ~= 'PD') and args ~= '-'
	and (args ~= '' and args ~= nil)
	and (args == '' or args == nil)
	then
        du_title_str =  =] .. c_2 .. =] .. c_border ..
]]=] .. "\n"
        
        a_nom_du_str = =] .. c_bord ..
        =] .. args .. '&nbsp;' .. "\n"
        nom_du_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell ..
        =] .. args .. "\n"
        a_gen_du_str = =] .. c_bord ..
        =] .. args .. '&nbsp;' .. "\n"
        gen_du_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell ..
        =] .. args .. "\n"
        
       
-- 6 cols for  en pl pl2
	elseif (args ~= 'SD' and args ~= 'SD' and args ~= 'PD' and args ~= 'PD') and args ~= '-'
	and (args == '' or args == nil)
	and (args ~= '' and args ~= nil)
	then
        du_title_str =  =] .. c_2 .. =] .. c_border ..
]]=] .. "\n"
        
        a_nom_du_str = =] .. c_bord ..
        =] .. args .. '&nbsp;' .. "\n"
        nom_du_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell ..
        =] .. args .. "\n"
        a_gen_du_str = =] .. c_bord ..
        =] .. args .. '&nbsp;' .. "\n"
        gen_du_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell ..
        =] .. args .. "\n"
        
       
-- 8 cols for  en en2 pl pl2
	elseif (args ~= 'SD' and args ~= 'SD' and args ~= 'PD' and args ~= 'PD') and args ~= '-'
	and (args ~= '' and args ~= nil)
	and (args ~= '' and args ~= nil)
	then
        du_title_str =  =] .. c_2 .. =] .. c_border ..
]]=] .. "\n"
        
        a_nom_du_str = =] .. c_bord ..
        =] .. args .. '&nbsp;' .. "\n"
        nom_du_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell ..
        =] .. args .. "\n"
        a_gen_du_str = =] .. c_bord ..
        =] .. args .. '&nbsp;' .. "\n"
        gen_du_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell ..
        =] .. args .. "\n"

-- 4 cols  for other combinations........ hope it is ok
	else
        du_title_str =  =] .. c_2 .. =] .. c_border ..
]]=].. "\n"
        
        a_nom_du_str = =] .. c_bord ..
        =] .. args .. '&nbsp;' .. "\n"
        nom_du_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell ..
        =] .. args .. "\n"
        a_gen_du_str = =] .. c_bord ..
        =] .. args .. '&nbsp;' .. "\n"
        gen_du_str = =] .. c_bord .. =] .. c_border .. =] .. font_cell ..
        =] .. args .. "\n"

	end -- close if ... numbers exist
end -- close dual

-- ============================= ROWS
-- extra title
	if args ~= '' and args ~= nil then extratitle =
'|-' .. extratitle_str .. "\n" ..   =]
	end

-- stem_line
	if args ~= '' and args ~= nil then stem_line =
'|-' .. "\n" .. =] .. c_3 .. =] .. c_4 .. =] .. "\n" .. stem_cell .. =]
	end


-- subtitle line
	-- sg, pl have different number
	if (args ~= '' or args ~= '') then subtitle =
'|-' .. "\n" .. =] .. c_2 .. =] .. c_1 ..
=] .. "\n" .. subtitle_sg .. subtitle_pl .. =]
	end
	-- 2 singulars, pl
	if args ~= '' and args ~= nil then subtitle =
'|-' .. "\n" .. =] .. c_2 .. =] .. c_1 ..
=] .. "\n" .. subtitle_sg .. subtitle_sg2 .. subtitle_pl .. =]
	end
	-- sg, 2 plurals
	if args ~= '' and args ~= nil then subtitle =
'|-' .. "\n" .. =] .. c_2 .. =] .. c_1 ..
=] .. "\n" .. subtitle_sg .. subtitle_pl .. subtitle_pl2 .. =]
	end
	-- 2 singulars + 2 plurals
	if args ~= '' and args ~= nil and args ~= '' and args ~= nil then subtitle =
'|-' .. "\n" .. =] .. c_2 .. =] .. c_1 ..
=] .. "\n" .. subtitle_sg .. subtitle_sg2 .. subtitle_pl .. subtitle_pl2 .. =]
	end	
	
	
	-- output WITHOUT dual
	if args == 'S' or args == 'S' or args == 'P' or args == 'P' or args == '-' or args == '1' or args == '1' then
	
	-- + extratitle_str	
	if args ~= '' and args ~= nil then
			-- FOR mediaeval GKM output without datives - test ]
			if args == '-' then
    output = =] .. table_style1 .. [=[
|-
| style="background:]=] .. c_extra .. =] .. c_extra ..
	=] .. extratitle_str ..
	   [=[|-
| style="background:]=] .. c_1 .. =] .. c_2 ..
	=] ..
	"\n" .. sg_title_str.. sg2_title_str .. pl_title_str .. pl2_title_str .. stem_line .. subtitle .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. nominative ..
	"\n" .. a_nom_sg_str .. nom_sg_str .. a_nom_sg2_str .. nom_sg2_str .. a_nom_pl_str .. nom_pl_str .. a_nom_pl2_str .. nom_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. genitive ..
	"\n" .. a_gen_sg_str .. gen_sg_str .. a_gen_sg2_str .. gen_sg2_str .. a_gen_pl_str .. gen_pl_str .. a_gen_pl2_str .. gen_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. accusative ..
	"\n" .. a_acc_sg_str .. acc_sg_str .. a_acc_sg2_str .. acc_sg2_str .. a_acc_pl_str .. acc_pl_str .. a_acc_pl2_str .. acc_pl2_str .. [=[|-
| style="background:]=] .. c_3 ..
	=] .. vocative ..
	"\n" .. a_voc_sg_str .. voc_sg_str .. a_voc_sg2_str .. voc_sg2_str .. a_voc_pl_str .. voc_pl_str .. a_voc_pl2_str .. voc_pl2_str .. note .. appendix .. =]				
				
				
			else --yes datives (when no dual, yes extratitles)
    output = =] .. table_style1 .. [=[
|-
| style="background:]=] .. c_extra .. =] .. c_extra ..
	=] .. extratitle_str ..
	   [=[|-
| style="background:]=] .. c_1 .. =] .. c_2 ..
	=] ..
	"\n" .. sg_title_str.. sg2_title_str .. pl_title_str .. pl2_title_str .. stem_line .. subtitle .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. nominative ..
	"\n" .. a_nom_sg_str .. nom_sg_str .. a_nom_sg2_str .. nom_sg2_str .. a_nom_pl_str .. nom_pl_str .. a_nom_pl2_str .. nom_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. genitive ..
	"\n" .. a_gen_sg_str .. gen_sg_str .. a_gen_sg2_str .. gen_sg2_str .. a_gen_pl_str .. gen_pl_str .. a_gen_pl2_str .. gen_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. dative ..
	"\n" .. a_dat_sg_str .. dat_sg_str .. a_dat_sg2_str .. dat_sg2_str .. a_dat_pl_str .. dat_pl_str .. a_dat_pl2_str .. dat_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. accusative ..
	"\n" .. a_acc_sg_str .. acc_sg_str .. a_acc_sg2_str .. acc_sg2_str .. a_acc_pl_str .. acc_pl_str .. a_acc_pl2_str .. acc_pl2_str .. [=[|-
| style="background:]=] .. c_3 ..
	=] .. vocative ..
	"\n" .. a_voc_sg_str .. voc_sg_str .. a_voc_sg2_str .. voc_sg2_str .. a_voc_pl_str .. voc_pl_str .. a_voc_pl2_str .. voc_pl2_str .. note .. appendix .. =]
		end -- close if dat=-
	else -- no extratitle_str
			-- FOR mediaeval GKM output without datives when no dual, no extratitles - test ]
			if args == '-' then
		
    output = =] .. table_style1 .. [=[
|-
| style="background:]=] .. c_1 .. =] .. c_2 ..
	=] ..
	"\n" .. sg_title_str.. sg2_title_str .. pl_title_str .. pl2_title_str .. stem_line .. subtitle .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. nominative ..
	"\n" .. a_nom_sg_str .. nom_sg_str .. a_nom_sg2_str .. nom_sg2_str .. a_nom_pl_str .. nom_pl_str .. a_nom_pl2_str .. nom_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. genitive ..
	"\n" .. a_gen_sg_str .. gen_sg_str .. a_gen_sg2_str .. gen_sg2_str .. a_gen_pl_str .. gen_pl_str .. a_gen_pl2_str .. gen_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. accusative ..
	"\n" .. a_acc_sg_str .. acc_sg_str .. a_acc_sg2_str .. acc_sg2_str .. a_acc_pl_str .. acc_pl_str .. a_acc_pl2_str .. acc_pl2_str .. [=[|-
| style="background:]=] .. c_3 ..
	=] .. vocative ..
	"\n" .. a_voc_sg_str .. voc_sg_str .. a_voc_sg2_str .. voc_sg2_str .. a_voc_pl_str .. voc_pl_str .. a_voc_pl2_str .. voc_pl2_str .. note .. appendix .. =]
	

			else --yes datives (when no dual, no extratitles)

		
    output = =] .. table_style1 .. [=[
|-
| style="background:]=] .. c_1 .. =] .. c_2 ..
	=] ..
	"\n" .. sg_title_str.. sg2_title_str .. pl_title_str .. pl2_title_str .. stem_line .. subtitle .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. nominative ..
	"\n" .. a_nom_sg_str .. nom_sg_str .. a_nom_sg2_str .. nom_sg2_str .. a_nom_pl_str .. nom_pl_str .. a_nom_pl2_str .. nom_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. genitive ..
	"\n" .. a_gen_sg_str .. gen_sg_str .. a_gen_sg2_str .. gen_sg2_str .. a_gen_pl_str .. gen_pl_str .. a_gen_pl2_str .. gen_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. dative ..
	"\n" .. a_dat_sg_str .. dat_sg_str .. a_dat_sg2_str .. dat_sg2_str .. a_dat_pl_str .. dat_pl_str .. a_dat_pl2_str .. dat_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. accusative ..
	"\n" .. a_acc_sg_str .. acc_sg_str .. a_acc_sg2_str .. acc_sg2_str .. a_acc_pl_str .. acc_pl_str .. a_acc_pl2_str .. acc_pl2_str .. [=[|-
| style="background:]=] .. c_3 ..
	=] .. vocative ..
	"\n" .. a_voc_sg_str .. voc_sg_str .. a_voc_sg2_str .. voc_sg2_str .. a_voc_pl_str .. voc_pl_str .. a_voc_pl2_str .. voc_pl2_str .. note .. appendix .. =]
				end -- close if dat=-

	end -- close extratitle_str
		
		
	else -- WITH dual
	
	-- + extratitle_str	
	if args ~= '' and args ~= nil then
		
    output = =] .. table_style1 .. [=[
|-
| style="background:]=] .. c_extra .. =] .. c_extra ..
	=] .. extratitle_str ..
	   [=[|-
| style="background:]=] .. c_1 .. =] .. c_2 ..
	=] ..
	"\n" .. sg_title_str .. sg2_title_str .. pl_title_str .. pl2_title_str .. stem_line .. subtitle .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. nominative ..
	"\n" .. a_nom_sg_str .. nom_sg_str .. a_nom_sg2_str .. nom_sg2_str .. a_nom_pl_str .. nom_pl_str .. a_nom_pl2_str .. nom_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. genitive ..
	"\n" .. a_gen_sg_str .. gen_sg_str .. a_gen_sg2_str .. gen_sg2_str .. a_gen_pl_str .. gen_pl_str .. a_gen_pl2_str .. gen_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. dative ..
	"\n" .. a_dat_sg_str .. dat_sg_str .. a_dat_sg2_str .. dat_sg2_str .. a_dat_pl_str .. dat_pl_str .. a_dat_pl2_str .. dat_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. accusative ..
	"\n" .. a_acc_sg_str .. acc_sg_str .. a_acc_sg2_str .. acc_sg2_str .. a_acc_pl_str .. acc_pl_str .. a_acc_pl2_str .. acc_pl2_str .. [=[|-
| style="background:]=] .. c_3 ..
	=] .. vocative ..
	"\n" .. a_voc_sg_str .. voc_sg_str .. a_voc_sg2_str .. voc_sg2_str .. a_voc_pl_str .. voc_pl_str .. a_voc_pl2_str .. voc_pl2_str .. [=[|-
! style="background:]=] .. c_3 .. =] .. c_4 .. =] .. c_4 ..
	=] ..
	"\n" .. du_title_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] ..
	"\n" .. a_nom_du_str .. nom_du_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] ..
	"\n" .. a_gen_du_str .. gen_du_str .. note .. appendix .. =]
	
	else -- no extratitle_str
		
    output = =] .. table_style1 .. [=[
|-
| style="background:]=] .. c_1 .. =] .. c_2 ..
	=] ..
	"\n" .. sg_title_str .. sg2_title_str .. pl_title_str .. pl2_title_str .. stem_line .. subtitle .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. nominative ..
	"\n" .. a_nom_sg_str .. nom_sg_str .. a_nom_sg2_str .. nom_sg2_str .. a_nom_pl_str .. nom_pl_str .. a_nom_pl2_str .. nom_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. genitive ..
	"\n" .. a_gen_sg_str .. gen_sg_str .. a_gen_sg2_str .. gen_sg2_str .. a_gen_pl_str .. gen_pl_str .. a_gen_pl2_str .. gen_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. dative ..
	"\n" .. a_dat_sg_str .. dat_sg_str .. a_dat_sg2_str .. dat_sg2_str .. a_dat_pl_str .. dat_pl_str .. a_dat_pl2_str .. dat_pl2_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] .. accusative ..
	"\n" .. a_acc_sg_str .. acc_sg_str .. a_acc_sg2_str .. acc_sg2_str .. a_acc_pl_str .. acc_pl_str .. a_acc_pl2_str .. acc_pl2_str .. [=[|-
| style="background:]=] .. c_3 ..
	=] .. vocative ..
	"\n" .. a_voc_sg_str .. voc_sg_str .. a_voc_sg2_str .. voc_sg2_str .. a_voc_pl_str .. voc_pl_str .. a_voc_pl2_str .. voc_pl2_str .. [=[|-
! style="background:]=] .. c_3 .. =] .. c_4 .. =] .. c_4 ..
	=] ..
	"\n" .. du_title_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] ..
	"\n" .. a_nom_du_str .. nom_du_str .. [=[|-
| style="background:]=] .. c_3 .. =] .. c_4 ..
	=] ..
	"\n" .. a_gen_du_str .. gen_du_str .. note .. appendix .. =]
	end -- close extratitle_str

	end -- close output if dual exists



--------------------------------------------------------------------------
--                           4. Categories                              --
--------------------------------------------------------------------------
-- TODO
-- Categories only in mainspace
--[=[ test - need to see them
local page = mw.title.getCurrentTitle()
page.name = page.text:match( "^%s*(.-)%s*$" )
if page.namespace == 0 then	-- Categories work only in MAIN namespace
]=]--

-- nocat= 1
-- if (args ~= '' and args ~= nil) or (args ~= '' and args ~= nil) then
if args == '1' then -- DO NOT add the following categories - Just give us the table
	output = output
else

	-- category= overrides everything
	if args ~= '' and args ~= nil then -- free text for Category
		output = output .. ' .. ']]'
	else

		local group = args	or ''	-- need to write it AGAIN HERE
		if args ~= '' and args ~= nil then
		-- see above the appendix line
			if args == 'syncopated' then
		output = output .. "]"
			else
		output = output .. "]"
--    	output = output .. "]"
			end
		end

--	if args ~= "-" and args ~= '' and args ~= nil then 
    	-- see above the appendix line
    	-- SEE notes & add the category at ΚΑΤΗΓΟΡΙΕΣ under mainspace and uner nocat
    	-- all the neuter plurals:
    if args == '2' then
    	if args == '' or args == nil then
    		-- do nothgin
    	else
		output = output .. "]"
		end
    elseif args == '1' then
		-- do nothing
	else
		-- all grc, grc-koi, grc-... UNDER αρχαία ελληνικά
    	if args == 'irregular'
    	or args == 'defective'
    	then
    		if args == '1' then
		    	output = output .. "]"
    		elseif args == '1' or args == '1' then
    			output = output .. "]"
     		else -- all grc, grc-koi
    			output = output .. "]"
    		end
-- no specific cat-decls needed
--    	else
--    		if args == '2' or args == '2' then
--    			output = output .. "]" 
--    		else -- all grc, grc-koi, gkm=1
-- ALREADY HAVE Category:Ancient Greek first-declension nouns
--    			output = output .. "]"
--    		end
    	end
    end -- close if gkm


	end -- close if args


-- ======= EXTRA CATEGORIES: zero is reserved for the module ONLY, not for editors
-- free category, ελεύθερη κατηγορία +part of speech + language
	if args ~= '' and args  ~= nil then
		output = output .. ' ..  mw.getContentLanguage():lcfirst(pos) .. ']]'
	end
	if args ~= '' and args  ~= nil then
		output = output .. ' ..  mw.getContentLanguage():lcfirst(pos) .. ']]'
	end
	if args ~= '' and args  ~= nil then
		output = output .. ' ..  mw.getContentLanguage():lcfirst(pos) .. ']]'
	end
	-- for Module use ONLY 
	if args ~= '' and args  ~= nil then
		output = output .. ' ..  mw.getContentLanguage():lcfirst(pos) .. ']]'
	end
	if args ~= '' and args  ~= nil then
		output = output .. ' ..  mw.getContentLanguage():lcfirst(pos) .. ']]'
	end
	if args ~= '' and args  ~= nil then
		output = output .. ' ..  mw.getContentLanguage():lcfirst(pos) .. ']]'
	end

-- free category + language
	if args ~= '' and args ~= nil then
			output = output .. ' .. ']]'
	end
	if args ~= '' and args ~= nil then
			output = output .. ' .. ']]'
	end
	if args ~= '' and args ~= nil then
			output = output .. ' .. ']]'
	end
	-- for module use ONLY
	if args ~= '' and args ~= nil then
			output = output .. ' .. ']]'
	end
	if args ~= '' and args ~= nil then
			output = output .. ' .. ']]'
	end
	if args ~= '' and args ~= nil then
			output = output .. ' .. ']]'
	end


-- free category, NO LANGUAGE no restrictions, write free text
	if args ~= '' and args ~= nil then
			output = output .. ' .. ']]'
	end
	if args ~= '' and args ~= nil then
			output = output .. ' .. ']]'
	end
	if args ~= '' and args ~= nil then
			output = output .. ' .. ']]'
	end
	-- for module use ONLY
	if args ~= '' and args ~= nil then
			output = output .. ' .. ']]'
	end
	if args ~= '' and args ~= nil then
			output = output .. ' .. ']]'
	end
	if args ~= '' and args ~= nil then
			output = output .. ' .. ']]'
	end


end -- close in nocat=1

-- end -- close 'if namespace'
-- !!FAILTEST put at main page: if args then args = frame:preprocess(args) or '' end

return output -- close fulltable

end

----------------------------------------------------------------------------------------
--                  GENERAL PATTERNS of DECLENSIONS
-----------------------------------------------------------------------------------------

--------------------------------5. DECL--------------------------------------
-- decl - it creates functions for specific declensions at the function pages
-- otherwise, it is EXACTLY like free
-----------------------------------------------------------------------------
decl = function(args)	-- creates functions at the subpages pages

-- all the declension parameters & functions: ======================
require ('Module:User:Sarri.greek/grk-nouns-decl/param').param (args)
-- !!TEST put at main page: if args then args = frame:preprocess(args) or '' end
--no--args = frame:preprocess(args) or ''
--if args then args = frame:preprocess(args) or '' end
------------
return fulltable(args)
end




--------------------------------------------------------------------------
--            CREATE a DECLENSION TABLE directly at lemma page          --
--------------------------------------------------------------------------
-- invoke directly from pages -- use with caution; better created a function

export.free = function(frame)
--local args = frame:getParent().args	-- for Templates
local args = frame.args		-- invoke

-- all the declension parameters & functions: ======================
require ('Module:User:Sarri.greek/grk-nouns-decl/param').param (args)
-- !!TEST put at main page: if args then args = frame:preprocess(args) or '' end
if args then args = frame:preprocess(args) or '' end
------------
return fulltable(args) .. ']'
end


--------------------------------------------------------------------------
--           SPECIFIC TEMPLATES
--------------------------------------------------------------------------

-- may created pages /1, /2, /3, /4



return export