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)
		thema = thema or '' -- otherwise, it does not work
    return '<span style="color:' .. c_stem ..'; font-weight:normal;">' .. thema .. '</span>'
end

-- ====================== Links
local function create_link (page, text)
	page = page or '' -- otherwise, it does not work
	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 INDIVIDUAL cells ένα ένα, 1η κολόνα
if args['αοε'] == "αρσ" then args['αοε'] = create_link('ο', stem_color('ο')) end
if args['αοε'] == "θηλ" then args['αοε'] = create_link('η', stem_color('η')) end
if args['αοε'] == "ουδ" then args['αοε'] = create_link('το', stem_color('το')) end
if args['αοε'] == "αθ" then args['αοε'] = create_link('ο', stem_color('ο')) .. '/' .. create_link('η', stem_color('η')) end
--if args['αοε'] == "-" then args['αοε'] = '' end -- for adjectives in plural like [[μύριοι]]

if args['αγε'] == "αρσ" then args['αγε'] = create_link('του', stem_color('του')) end
if args['αγε'] == "θηλ" then args['αγε'] = create_link('της', stem_color('της')) end
if args['αγε'] == "ουδ" then args['αγε'] = create_link('του', stem_color('του')) end
if args['αγε'] == "αθ" then args['αγε'] = create_link('του', stem_color('του')) .. '/' .. create_link('της', stem_color('της')) end
-- special, second line
if args['α2γε'] == "αθ" then args['α2γε'] = create_link('του', stem_color('του')) .. '/' .. create_link('της', stem_color('της')) end
--if args['αγε'] == "-" then args['αγε'] = '' end -- for adjectives in plural

if args['ααε'] == "αρσ" then args['ααε'] = create_link('τον', stem_color('τον')) end
if args['ααε'] == "θηλ" then args['ααε'] = create_link('την', stem_color(tinti.tin(args['λήμμα']))) end -- REQUIRE [[Module:tin]]
if args['ααε'] == "ουδ" then args['ααε'] = create_link('το', stem_color('το')) end
if args['ααε'] == "αθ" then args['ααε'] = '<span style="white-space:nowrap">' .. create_link('τον', stem_color('τον')) .. '/' 
	.. create_link('την', stem_color(tinti.tin(args['λήμμα']))) .. '</span>' end	-- REQUIRE [[Module:tin]]

if args['αοπ'] == "αρσ" then args['αοπ'] = create_link('οι', stem_color('οι')) end
if args['αοπ'] == "θηλ" then args['αοπ'] = create_link('οι', stem_color('οι')) end
if args['αοπ'] == "ουδ" then args['αοπ'] = create_link('τα', stem_color('τα')) end
if args['αοπ'] == "αθ" then args['αοπ'] = create_link('οι', stem_color('οι')) end
	
if args['αγπ'] == "αρσ" then args['αγπ'] = create_link('των', stem_color('των')) end
if args['αγπ'] == "θηλ" then args['αγπ'] = create_link('των', stem_color('των')) end
if args['αγπ'] == "ουδ" then args['αγπ'] = create_link('των', stem_color('των')) end
if args['αγπ'] == "αθ" then args['αγπ'] = create_link('των', stem_color('των')) end

if args['ααπ'] == "αρσ" then args['ααπ'] = create_link('τους', stem_color('τους')) end
if args['ααπ'] == "θηλ" then args['ααπ'] = create_link('τις', stem_color('τις')) end
if args['ααπ'] == "ουδ" then args['ααπ'] = create_link('τα', stem_color('τα')) end
if args['ααπ'] == "αθ" then args['ααπ'] = create_link('τους', stem_color('τους')) .. '/' .. create_link('τις', stem_color('τις')) end


-- =========== for INDIVIDUAL cells ένα ένα, 2η κολόνα (2nd columns e.g. singular2, plural2)
if args['αοε2'] == "αρσ" then args['αοε2'] = create_link('ο', stem_color('ο')) end
if args['αοε2'] == "θηλ" then args['αοε2'] = create_link('η', stem_color('η')) end
if args['αοε2'] == "ουδ" then args['αοε2'] = create_link('το', stem_color('το')) end
if args['αοε2'] == "αθ" then args['αοε2'] = create_link('ο', stem_color('ο')) .. '/' .. create_link('η', stem_color('η')) end

if args['αγε2'] == "αρσ" then args['αγε2'] = create_link('του', stem_color('του')) end
if args['αγε2'] == "θηλ" then args['αγε2'] = create_link('της', stem_color('της')) end
if args['αγε2'] == "ουδ" then args['αγε2'] = create_link('του', stem_color('του')) end
if args['αγε2'] == "αθ" then args['αγε2'] = create_link('του', stem_color('του')) .. '/' .. create_link('της', stem_color('της')) end

if args['ααε2'] == "αρσ" then args['ααε2'] = create_link('τον', stem_color('τον')) end
if args['ααε2'] == "θηλ" then args['ααε2'] = create_link('την', stem_color(tinti.tin(args['λήμμα']))) end -- REQUIRE [[Module:tin]]
if args['ααε2'] == "ουδ" then args['ααε2'] = create_link('το', stem_color('το')) end
if args['ααε2'] == "αθ" then args['ααε2'] = '<span style="white-space:nowrap">' .. create_link('τον', stem_color('τον')) .. '/' 
	.. create_link('την', stem_color(tinti.tin(args['λήμμα']))) .. '</span>' end	-- REQUIRE [[Module:tin]]

if args['αοπ2'] == "αρσ" then args['αοπ2'] = create_link('οι', stem_color('οι')) end
if args['αοπ2'] == "θηλ" then args['αοπ2'] = create_link('οι', stem_color('οι')) end
if args['αοπ2'] == "ουδ" then args['αοπ2'] = create_link('τα', stem_color('τα')) end
if args['αοπ2'] == "αθ" then args['αοπ2'] = create_link('οι', stem_color('οι')) end
	
if args['αγπ2'] == "αρσ" then args['αγπ2'] = create_link('των', stem_color('των')) end
if args['αγπ2'] == "θηλ" then args['αγπ2'] = create_link('των', stem_color('των')) end
if args['αγπ2'] == "ουδ" then args['αγπ2'] = create_link('των', stem_color('των')) end
if args['αγπ2'] == "αθ" then args['αγπ2'] = create_link('των', stem_color('των')) end

if args['ααπ2'] == "αρσ" then args['ααπ2'] = create_link('τους', stem_color('τους')) end
if args['ααπ2'] == "θηλ" then args['ααπ2'] = create_link('τις', stem_color('τις')) end
if args['ααπ2'] == "ουδ" then args['ααπ2'] = create_link('τα', stem_color('τα')) end
if args['ααπ2'] == "αθ" then args['ααπ2'] = create_link('τους', stem_color('τους')) .. '/' .. create_link('τις', stem_color('τις')) end


-- no articles	================== MAIN FUNCTION
if args['άρθρα'] == '0' or args['άρθρα'] == '-'
	then
		args['αοε'] = '&nbsp;&nbsp;&nbsp;&nbsp;'	args['αγε'] = ''	args['ααε'] = ''
		args['αοπ'] = '&nbsp;&nbsp;&nbsp;&nbsp;'	args['αγπ'] = ''	args['ααπ'] = ''	

else

-- for ALL the table plus control individually too
-- this works ONLY for nouns, not for adjectives.
-- 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

	end -- close if αρσ=1, if θηλ=1....
end -- close if άρθρα = 0



-- -------------------------------
end -- close  function articles

return {articles = articles}