Module:el-articles

Από Βικιλεξικό
Μετάβαση στην πλοήγηση Πήδηση στην αναζήτηση

Module:el-articles >> Module:el-articles/τεκμηρίωση
Modern Greek articles as added in declension modules. e.g. for nouns at Module:el-nouns-decl. Examples at χώρα, θάλασσα.
Call if from a declension module by placing EXACTLY where it is needed:

require ('Module:el-articles').articles (args)
DO NOT change anything else.

Similar: also see Module:grc-articles

Many thanks to Trappist the monk, from wikipedia for his help.


-- 2021.04.26.
-- Modern Greek articles as added in declension tables
	-- e.g. for nouns at [[Module:el-nouns-decl]] -- test e.g. [[θάλασσα]]
	-- Many thanks to [[User:Trappist the monk]] from wikipedia
	
-- INSTRUCTIONS:
-- Call if from a declension module by placing EXACTLY where it is needed:
	--	require ('Module:el-articles').articles (args)
	-- DO NOT change anything else. DO NOT add at top of page a m_articles = require this and that.
	
-- USE local for the functions of THIS module


local tinti = require("Module:tin")
	--tinti function:tin; chooses the correct acc.singular feminine article την (tin) or τη (ti)

-- font colours
local c_stem = '#002000'

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

-- ====================== Links
local function create_link (page, text)
	if text then
		return '[[' .. page .. '|' .. text .. ']]'
	else
		return '[[' .. page .. ']]'
	end
end


--[[--------------------------< I S _ S E T >------------may by used optionally

Returns true if argument is set; false otherwise. Argument is 'set' when it exists (not nil) or when it is not an empty string.

]]
--[=[ explanation:
The is_set() function may be added so that tests like this:
	if args['ακε'] ~= '' and args['ακε'] ~= nil then args['ακε'] = args['ακε'] else args['ακε'] = '' end
can be reduced to:
	if not is_set (args['ακε']) then args['ακε'] = '' end
]=]--

local function is_set (var)
	return not (var == nil or var == '');
end


--------------------------------------------------------------------------
--                     Modern Greek articles                            --
--------------------------------------------------------------------------
local function articles (args)
 
-- ARTICLES  -- This section was placed in a declension module and is moved here. 
	-- vocatives are empty. (The ε! was placed outside, as it is not an article: withdrawn)
	if args['ακε'] ~= '' and args['ακε'] ~= nil then args['ακε'] = args['ακε'] else args['ακε'] = '' end
	if args['ακπ'] ~= '' and args['ακπ'] ~= nil then args['ακπ'] = args['ακε'] else args['ακπ'] = '' end
	args['ακε2'] = ''
	args['ακπ2'] = ''
-- for ALL the table plus control individually too
-- MASCULINE ARTICLES
	if args['αρσ'] == '1' then
		if args['αοε'] == '-' then args['αοε'] = ''
			elseif args['αοε'] ~= '-' and args['αοε'] ~= '' and args['αοε'] ~= nil then args['αοε'] = args['αοε']
			else args['αοε'] = create_link('ο', stem_color('ο'))
		end
		if args['αγε'] == '-' then args['αγε'] = ''
			elseif args['αγε'] ~= '-' and args['αγε'] ~= '' and args['αγε'] ~= nil then args['αγε'] = args['αγε']
			else args['αγε'] = create_link('του', stem_color('του'))
		end
		if args['ααε'] == '-' then args['ααε'] = ''
			elseif args['ααε'] ~= '-' and args['ααε'] ~= '' and args['ααε'] ~= nil then args['ααε'] = args['ααε']
			else args['ααε'] = create_link('τον', stem_color('τον'))
		end
		if -- vocative is empty
			args['ακε'] ~= '' and args['ακε'] ~= nil then args['ακε'] = args['ακε']
			else args['ακε'] = ''
		end
		-- plural masculine
		if args['αοπ'] == '-' then args['αοπ'] = ''
			elseif args['αοπ'] ~= '-' and args['αοπ'] ~= '' and args['αοπ'] ~= nil then args['αοπ'] = args['αοπ']
			else args['αοπ'] = create_link('οι', stem_color('οι'))
		end
		if args['αγπ'] == '-' then args['αγπ'] = ''
			elseif args['αγπ'] ~= '-' and args['αγπ'] ~= '' and args['αγπ'] ~= nil then args['αγπ'] = args['αγπ']
			else args['αγπ'] = create_link('των', stem_color('των'))
		end
		if args['ααπ'] == '-' then args['ααπ'] = ''
			elseif args['ααπ'] ~= '-' and args['ααπ'] ~= '' and args['ααπ'] ~= nil then args['ααπ'] = args['ααπ']
			else args['ααπ'] = create_link('τους', stem_color('τους'))
		end
		if -- vocative is empty
			args['ακπ'] ~= '' and args['ακπ'] ~= nil then args['ακπ'] = args['ακπ']
			else args['ακε'] = ''
		end
-- FEMININE ARTICLES
	elseif args['θηλ'] == '1' then
		if args['αοε'] == '-' then args['αοε'] = ''
			elseif args['αοε'] ~= '-' and args['αοε'] ~= '' and args['αοε'] ~= nil then args['αοε'] = args['αοε']
			else args['αοε'] = create_link('η', stem_color('η'))
		end
		if args['αγε'] == '-' then args['αγε'] = ''
			elseif args['αγε'] ~= '-' and args['αγε'] ~= '' and args['αγε'] ~= nil then args['αγε'] = args['αγε']
			else args['αγε'] = create_link('της', stem_color('της'))
		end
		if args['ααε'] == '-' then args['ααε'] = ''
			elseif args['ααε'] ~= '-' and args['ααε'] ~= '' and args['ααε'] ~= nil then args['ααε'] = args['ααε']
			else args['ααε'] = create_link('την', stem_color(tinti.tin(args['λήμμα'])))				 -- REQUIRE [[Module:tin]]
		end
		if -- vocative is empty
			args['ακε'] ~= '' and args['ακε'] ~= nil then args['ακε'] = args['ακε']
			else args['ακε'] = ''
		end
		-- plural feminine
		if args['αοπ'] == '-' then args['αοπ'] = ''
			elseif args['αοπ'] ~= '-' and args['αοπ'] ~= '' and args['αοπ'] ~= nil then args['αοπ'] = args['αοπ']
			else args['αοπ'] = create_link('οι', stem_color('οι'))
		end
		if args['αγπ'] == '-' then args['αγπ'] = ''
			elseif args['αγπ'] ~= '-' and args['αγπ'] ~= '' and args['αγπ'] ~= nil then args['αγπ'] = args['αγπ']
			else args['αγπ'] = create_link('των', stem_color('των'))
		end
		if args['ααπ'] == '-' then args['ααπ'] = ''
			elseif args['ααπ'] ~= '-' and args['ααπ'] ~= '' and args['ααπ'] ~= nil then args['ααπ'] = args['ααπ']
			else args['ααπ'] = create_link('τις', stem_color('τις'))
		end
		if -- vocative is empty
			args['ακπ'] ~= '' and args['ακπ'] ~= nil then args['ακπ'] = args['ακπ']
			else args['ακε'] = ''
		end
-- COMMON MASCULINE+FEMININE ARTICLES
	elseif args['αθ'] == '1' then
		if args['αοε'] == '-' then args['αοε'] = ''
			elseif args['αοε'] ~= '-' and args['αοε'] ~= '' and args['αοε'] ~= nil then args['αοε'] = args['αοε']
			else args['αοε'] = create_link('ο', stem_color('ο')) .. '/' .. create_link('η', stem_color('η'))
		end
-- γενική ενικού με άρθρο δεύτερης γραμμής: επιλέγουμε τι θέλουμε	/ 2 articles in 2 lines		
		if args['α2γε'] ~= '' and args['α2γε'] ~= nil then
			args['αγε'] = args['αγε'] .. "<br />" .. args['α2γε']
		else
			if args['αγε'] == '-' then args['αγε'] = ''
				elseif args['αγε'] ~= '-' and args['αγε'] ~= '' and args['αγε'] ~= nil then args['αγε'] = args['αγε']
				else args['αγε'] = '<span style="white-space:nowrap">' .. create_link('του', stem_color('του')) .. '/' .. create_link('της', stem_color('της')) .. '</span>'
			end
		end
-- ατιατική ενικού με άρθρο δεύτερης γραμμής: επιλέγουμε τι θέλουμε	/ 2 articles in 2 lines
		if args['α2αε'] ~= '' and args['α2αε'] ~= nil then
			args['ααε'] = args['ααε'] .. "<br />" .. args['α2αε']
		else
			if args['ααε'] == '-' then args['ααε'] = ''
				elseif args['ααε'] ~= '-' and args['ααε'] ~= '' and args['ααε'] ~= nil then args['ααε'] = args['ααε']
				else args['ααε'] = '<span style="white-space:nowrap">' .. create_link('τον', stem_color('τον')) .. '/' .. create_link('την', stem_color(tinti.tin(args['λήμμα']))) .. '</span>'		 -- REQUIRE [[Module:tin]]
			end
		end
		if -- vocative is empty
			args['ακε'] ~= '' and args['ακε'] ~= nil then args['ακε'] = args['ακε']
			else args['ακε'] = ''
		end
		-- plural common masc+fem
		if args['αοπ'] == '-' then args['αοπ'] = ''
			elseif args['αοπ'] ~= '-' and args['αοπ'] ~= '' and args['αοπ'] ~= nil then args['αοπ'] = args['αοπ']
			else args['αοπ'] = create_link('οι', stem_color('οι'))
		end
		if args['αγπ'] == '-' then args['αγπ'] = ''
			elseif args['αγπ'] ~= '-' and args['αγπ'] ~= '' and args['αγπ'] ~= nil then args['αγπ'] = args['αγπ']
			else args['αγπ'] = create_link('των', stem_color('των'))
		end
-- αιτιατική πληθ με άρθρο δεύτερης γραμμής: επιλέγουμε τι θέλουμε	/ 2 articles in 2 lines		
		if args['α2απ'] ~= '' and args['α2απ'] ~= nil then
			args['ααπ'] = args['ααπ'] .. "<br />" .. args['α2απ']
		else
			if args['ααπ'] == '-' then args['ααπ'] = ''
				elseif args['ααπ'] ~= '-' and args['ααπ'] ~= '' and args['ααπ'] ~= nil then args['ααπ'] = args['ααπ']
				else args['ααπ'] = '<span style="white-space:nowrap">' .. create_link('τους', stem_color('τους')) .. '/' .. create_link('τις', stem_color('τις')) .. '</span>'
			end
		end
		if -- vocative is empty
			args['ακπ'] ~= '' and args['ακπ'] ~= nil then args['ακπ'] = args['ακπ']
			else args['ακε'] = ''
		end
-- NEUTER ARTICLES
	elseif args['ουδ'] == '1' then
		if args['αοε'] == '-' then args['αοε'] = ''
			elseif args['αοε'] ~= '-' and args['αοε'] ~= '' and args['αοε'] ~= nil then args['αοε'] = args['αοε']
			else args['αοε'] = create_link('το', stem_color('το'))
		end
		if args['αγε'] == '-' then args['αγε'] = ''
			elseif args['αγε'] ~= '-' and args['αγε'] ~= '' and args['αγε'] ~= nil then args['αγε'] = args['αγε']
			else args['αγε'] = create_link('του', stem_color('του'))
		end
		if args['ααε'] == '-' then args['ααε'] = ''
			elseif args['ααε'] ~= '-' and args['ααε'] ~= '' and args['ααε'] ~= nil then args['ααε'] = args['ααε']
			else args['ααε'] = create_link('το', stem_color('το'))
		end
		if -- vocative is empty
			args['ακε'] ~= '' and args['ακε'] ~= nil then args['ακε'] = args['ακε']
			else args['ακε'] = ''
		end
		-- plural neuter
		if args['αοπ'] == '-' then args['αοπ'] = ''
			elseif args['αοπ'] ~= '-' and args['αοπ'] ~= '' and args['αοπ'] ~= nil then args['αοπ'] = args['αοπ']
			else args['αοπ'] = create_link('τα', stem_color('τα'))
		end
		if args['αγπ'] == '-' then args['αγπ'] = ''
			elseif args['αγπ'] ~= '-' and args['αγπ'] ~= '' and args['αγπ'] ~= nil then args['αγπ'] = args['αγπ']
			else args['αγπ'] = create_link('των', stem_color('των'))
		end
		if args['ααπ'] == '-' then args['ααπ'] = ''
			elseif args['ααπ'] ~= '-' and args['ααπ'] ~= '' and args['ααπ'] ~= nil then args['ααπ'] = args['ααπ']
			else args['ααπ'] = create_link('τα', stem_color('τα'))
		end
		if -- vocative is empty
			args['ακπ'] ~= '' and args['ακπ'] ~= nil then args['ακπ'] = args['ακπ']
			else args['ακε'] = ''
		end
	
	else
-- if double plural, για editing άρθρων, π.χ. στα ιδιόκλιτα όπως [[πλούτος]] με διαφορετικό γένος σε κάθε αριθμό
		-- = αθ ειδικά για κοινό γένος όπως στο [[βουλευτής]]
		if args['αοε'] == 'αθ' then
			args['αοε'] = create_link('ο', stem_color('ο')) .. '/' .. create_link('η', stem_color('η'))
		elseif args['αοε'] ~= '' and args['αοε'] ~= '-' and args['αοε'] ~= 'αθ' then
			args['αοε'] = create_link(args['αοε'], stem_color(args['αοε']))
			else args['αοε'] = ''
		end
		if args['αγε'] == 'αθ' then
			args['αγε'] = create_link('του', stem_color('του')) .. '/' .. create_link('της', stem_color('της'))
		elseif args['αγε'] ~= '' and args['αγε'] ~= '-' and args['αγε'] ~= 'αθ' and args['α2γε'] == '' and args['α2γε'] == nil then
			args['αγε'] = create_link(args['αγε'], stem_color(args['αγε']))
		elseif args['αγε'] ~= '' and args['αγε'] ~= '-' and args['αγε'] ~= 'αθ' and args['α2γε'] ~= '' and args['α2γε'] ~= nil then -- αν υπάρχει και 2ο άρθρο, edit them
			args['αγε'] = args['αγε'] .. "<br />" .. args['α2γε']
		--else args['αγε'] = '' -- πρόβλημα στο [[ναύλος]]: κενό αγε
		end
		if args['ααε'] == 'αθ' then
			args['ααε'] = create_link('τον', stem_color('τον')) .. '/' .. create_link('την', stem_color(tinti.tin(args['λήμμα'])))
		elseif args['ααε'] ~= '' and args['ααε'] ~= '-' and args['ααε'] ~= 'αθ' then
			args['ααε'] = create_link(args['ααε'], stem_color(args['ααε']))
			else args['ααε'] = ''
		end

		-- δεύτεροι πληθυντικοί
		if args['αοπ2'] ~= '' and args['αοπ2'] ~= '-' then args['αοπ2'] = create_link(args['αοπ2'], stem_color(args['αοπ2'])) else args['αοπ2'] = '' end
		if args['αγπ2'] ~= '' and args['αγπ2'] ~= '-' then args['αγπ2'] = create_link(args['αγπ2'], stem_color(args['αγπ2'])) else args['αγπ2'] = '' end
		if args['ααπ2'] ~= '' and args['ααπ2'] ~= '-' then
			if args['ααπ2'] == 'αθ' then
				args['ααπ2'] = create_link('τους', stem_color('τους')) .. '/' .. create_link('τις', stem_color('τις')) -- όπως [[Οικονόμου]]
			else
				args['ααπ2'] = create_link(args['ααπ2'], stem_color(args['ααπ2']))
			end
		 else args['ααπ2'] = ''
		 end
	end	
end
	

--[[--------------------------< E X P O R T E D   F U N C T I O N S >------------------------------------------
]]


return {articles = articles}