Χρήστης:Sarri.greek/luanotes

Από Βικιλεξικό
Μετάβαση στην πλοήγηση Πήδηση στην αναζήτηση
if xx == '' or xx == nil then
if xx ~= '' and xx ~= nil then
if data.label[cat_title]['parent2_show'] ~= '' and data.label[cat_title]['parent2_show'] ~= nil then

if mw.ustring.find(cat_title, "Λέξεις με ένθημα") then

-- require ('Module:grc-articles').articles (args) 



--	local args = frame:getParent().args --  for Template only
--	local args = frame.args -- for invoke only
output = x
return output
end -- close function


local export = {}
function export.yyy(arg)
	if type(arg) == 'table' and type(arg.getParent) == 'function' then
		local frame = arg
		local args = frame:getParent().args
		term = args['λήμμα'] or args['lemma'] or ''
	else
		term = arg
	end
 --...........
return vvvvv
end
function export.xx(frame)
--	args = frame:getParent().args --  for Template only
	args = frame.args -- for invoke only
-- ..........
return vvv
end

---
output =  text_for_trans
return output
end -- close function

--call params from a fulltable with require ('Module:grc-articles').articles (args)

syntaxhighlight lang="lua"  /syntaxhighlight>
-->{{#ifeq:{{NAMESPACENUMBER}}|0|[[Κατηγορία:Λήμματα με προφορά ΔΦΑ ({{{{{1|}}}|nolink=1}}){{#if:{{{sort|}}}|{{!}}{{{sort|}}}|}}]]|}}<!--


<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div>
<div style="font-size:small; background:#f8f8f8;">[[Βικιλεξικό:Κύρια Σελίδα|Βικιλεξικό]] » «</div>
|γεθ={{#invoke:grk-stems|word1i|lemma={{word-2|lemma={{{λήμμα|}}}}}}}
style="white-space:nowrap;">
mw.addWarning('<b><span style="color:#b22222; font-size:14px;">Αν χρειάζεται, συμπληρώστε με &#123;&#123;auto cat|xxx}} την κλείδα κατάταξης sort.</span></b>')

-- zz3
-- args['δεΛκειμ1-αρσ'] = '(' .. create_link((stem["θ"] .. "έϊ"), (stem_color(stem["θ"] .. "έ") .. ending_color("ϊ"))) .. ') '
-- args['δεΛκειμ1-αρσ'] = '(' .. linkcontrol3(stem["θ"], "έ", "ϊ") .. ') '


-- same thing:
local chapter = args['chapter'] or args['κεφάλαιο'] or ''
--YES--			if args['chapter'] ~= '' and args['chapter'] ~= nil then
			if chapter ~= '' and chapter ~= nil then

 {{formatnum:{{#expr:{{PAGESINCATEGORY:Επίθετα που κλίνονται όπως το 'όμορφος'|pages|R}}
+{{PAGESINCATEGORY:Μετοχές που κλίνονται όπως το 'αγαπημένος'|pages|R}}
+{{PAGESINCATEGORY:Μετοχές που κλίνονται όπως το 'εισαγόμενος'|pages|R}}}}}}&nbsp;λέξεις&nbsp;

{{formatnum:{{PAGESINCATEGORY:Μετοχές που κλίνονται όπως το 'λύσας' (αρχαία ελληνικά)|pages|R}}}}&nbsp;λέξεις&nbsp;

-- ==================== captures
if mw.ustring.find(args['λήμμα'], 'ίας') or mw.ustring.find(args['λήμμα'], 'ίαι')

if mw.ustring.find(cat_title, "Λέξεις με ένθημα") then
cat_title = mw.ustring.sub(mw.ustring.match(cat_title, cat_title), 1, -20) -- take off 'για τομείς γλωσσών'
if mw.ustring.find(stem["θ"], '[βγδζθκλμνξπστφχψΒΓΔΖΘΚΛΜΝΞΠΣΤΦΧΨ]$')
if mw.ustring.find(stem["θ"], '[ᾶᾷἆᾆἇᾇῆῇἦᾖἧᾗῖἶἷῗῦὖὗῧῶῷὦᾦὧᾧἎᾎἏᾏἮᾞἯᾟἾἿὟὮᾮὯᾯ]')
if mw.ustring.find(stem["θ"], '[αΑεΕηΗοΟ][ίὶῖἴἲἶἵἳἷΊῚἼἺἾἽἻἿύὺῦὔὒὖὑὕὓὗΎῪὝὛὟ]') -- NOT dialytics ΐῒῗΰῢῧ 

	elseif mw.ustring.find(header, "{{λ%|(.*[^{%|}])%|([%-a-z]*)%|(.*[^{%|}])}}")
		then lalthead1 = mw.ustring.gsub(header, "{{λ%|(.*[^{%|}])%|", "")
			lalthead2 = mw.ustring.gsub(lalthead1, "%|([%-a-z]*)%|", "")
			lalthead3 = mw.ustring.gsub(lalthead2, "}", "")
			head = mw.ustring.gsub(lalthead3, "[%|{}]", "")



	affix = mw.ustring.sub(mw.ustring.match(cat_title, "Λέξεις με πρόθημα (.*)"), 1, -1)  -- this is affix+hyphen
	linkit = '<b>[[' .. mw.ustring.sub(mw.ustring.match(cat_title, "Λέξεις με πρόθημα (.*)"), 1, -1) .. ']]</b>'
	if mw.ustring.sub(mw.ustring.match(cat_title, "Λέξεις με πρόθημα (.*)"), 1, -1):sub(-1) == '-'
	then
	autosort  = mw.ustring.sub(mw.ustring.match(cat_title, "Λέξεις με πρόθημα (.*)"), 1, -2) -- no hyphen

				cat = '[[Κατηγορία:Λέξεις με πρόθημα ' 
				.. mw.getContentLanguage():lcfirst(mw.ustring.sub(mw.ustring.match(cat_title, catword .. " με πρόθημα (.*)"), 1, -1))  .. '|' .. catword .. ']]' ..  "\n"
				.. '[[Κατηγορία:' .. catword .. ' κατά πρόθημα|' .. sort .. ']]' ..  "\n"
-- ++ -- NOT Λέξεις από: βλ. [[Πρότυπο:από]]
function get_apota_text(apota_text)
	if mw.ustring.find(cat_title, 'από') and not mw.ustring.find(cat_title, 'από το') and not mw.ustring.find(cat_title, 'αναδρομικό')
	and not............................
	then 
	apota_text = "από " .. mw.ustring.sub(mw.ustring.match(cat_title, "από (.*)"), 1, -1)
	end
return apota_text
end

function get_apota(iso2)
	lang_iso2 = require("Module:lang").langapota_to_langiso(get_apota_text(apota_text))
return lang_iso2
end

function get_apota_label(apota_label)
	length = mw.ustring.len(get_apota_text(apota_text))
	apota_label = mw.ustring.sub(cat_title, 1, -length-1) -- length gives me: Label α.  So, i substract one more.
return apota_label
end


-- ===========================================
-- ancient greek adjectives/participles 2021.06. Sarri.greek
--[=[ INSTRUCTIONS
See all parameters at the /param page.
STEMS: default stem is minus 2 letters from the end (stemnumber 3) args['μείον'] = 2 
		- otherwise stems should be written out
		If special features are needed (brackets, etc), then the full line should be written, 
		with create_link, as in /param page
	Examples:
	local stem = {}
	stem["θ"] = mw.ustring.sub(args['λήμμα'],1,-3)		-- stem as found in lemma -- start from 1st letter of lemma, stop at 3rd from the end (minus 2 letters)
	stem["θ0"] = m_stems.word0(stem["θ"])				-- remove accent
    stem["θ1"] = m_stems.word1(stem["θ0"])				-- accent on 1st syllable from the end (Accent is tonos or oksia. Used mainly for monotonic script)
    stem["θ1"] = m_stems.PerispomeniToOxia(stem["θ"])	-- convert oxia to perispomeni -- also named θ1ο
	stem["θ1π"] = m_stems.OxiaToPerispomeni(stem["θ"])	-- convert perispomeni to oxeia
    stem["θ2"] = m_stems.word2(stem["θ0"])				-- accent on 2nd syllable from the end

-- CAREFUL: θ1 is different of identical θ WHEN it is INITIAL e.g. τὸ Ἄργος τοῦ Ἀργους (here steady accent, do not substitute with θ1)

    	args['μείον'] = 1 -- override default stemnumber = 3 (μείον 2)
    	stem["θ"] = mw.ustring.sub(args['λήμμα'],1,-2)
]=]--
--[=[ CONTENTS
* [[καλός]], [[ξηρός]]
]=]--


---------------------------------------------- REQUIRE SUBPAGES with FUNCTIONS
module_path = 'Module:xx'
--m_all = require(module_path .. "/all") -- ?????????? how can I join xx/1, xx/2, xx/3 etc

m_1 = require(module_path .. "/1") -- or write require("Module:xx/1")
-- cannot call them all directly from here. They call each other, nested:
-- this module calls: m_1 = require(module_path .. "/1")
		-- m_1 calls: m_2 = require(module_path .. "/2") 
			-- m_2 .... calls m_3 etc

---------------------------------------------- SPLIT data pages (data only, no ifs)
--------------------------------------------------------------------------
--                 Module + data (ONLY data) pages
--------------------------------------------------------------------------

--[=[
ΟΔΗΓΙΕΣ - INSTRUCTIONS
	Load this module using mw.loadData(), not using require() which is intended for modules with functions.
	USE e.g.: local data = mw.loadData("Module:XXX/data")
		IF: local module_path = 'Module:YYY'
		USE: local data = mw.loadData(module_path .."/data")
	HOW to call it:
		data.xxxx, or: data[xxx]['the category keyword']
]=]--

-- ============== STYLE 1 as in [[Module:labels/data]] Make sure there is a COMMA after each entry
return {
-- α
['αγγλισμός'] = { link='αγγλισμός', linkshow='αγγλισμός', word_cat='Αγγλισμοί', key='αγγλισμοι', style=true },
}

-- STYLE1 b with subdivisions as in [[Module:auto cat/data]]
--[=[
How to call them:
-- i write: if data.level_1[cat_title]['thiskey'] then <do this> end
-- i write fields like:   .. data.label[cat_title]['key'] ..  or data.label[cat_title].anykey
]=]--

local label = {
level_1 = {
	['Modules'] = { key='modules' },
},
level_1bylang = {
	['Θεματικές κατηγορίες'] =  { key='θεματικεσ',  }, -- show='Θεματικές'
},
} -- close local label

-- =============== STYLE2 with key at beginning  as in [[Module:topos/kind]]
-- no comma need here
-- repeat the first keyword, so that we can RELATE other keywords with it See [[Module:lang]]

kind = {}

kind['αεροδρόμιο'] = { kind='αεροδρόμιο', word='αεροδρόμιο', word_pl='αεροδρόμια', word_cat='Αεροδρόμια', 
	key='αεροδρομια', parent='', extra1='Αεροπορικοί όροι' }

return kind





--------------------------------------------------------------------------
-- ========================MAIN FUNCTION=============================== --
--------------------------------------------------------------------------

local function main (args)

-- lemma. is defined at subfunctions at subpages of specific declensions

-- stems in main function
    local stemnumber
    local stem = {}
    if stemnumber == '' or stemnumber == nil then
    	stem["θ"] = mw.ustring.sub(args['λήμμα'],1,-3)
    else
    	stem["θ"] = stem["θ"]
    end

    local minusletters = args['μείον'] or ''
    	if args['μείον'] == '0' then stem["θ"] = mw.ustring.sub(args['λήμμα'],1,-1)
    	elseif args['μείον'] ~= '0' and args['μείον'] ~= '' and args['μείον'] ~= nil then
    		stemnumber = minusletters+1
    	end

-- .........BLOCK with all parameters

end -- close function main

return {main = main}




-- ========== specific declensions of Module:xxx as defined in Module:xxx/main ========== --
export = {}

-- require subpages of more declension here e.g. require ('Module:xxx/2')

export['ωωω'] = function(frame)		-- [[Template:el-κλίση-'ωωω']]
    local args = frame:getParent().args		-- for Templates
--    local args = frame.args					-- to invoke
-- lemma for specific declensions
	local lemma = args['λήμμα'] or ''
	PAGENAME = mw.title.getCurrentTitle().text
	if lemma  == '' or lemma == nil then args['λήμμα'] = PAGENAME:match( "^%s*(.-)%s*$" ) -- this trims some spaces (used in all modules)
		else lemma = args['λήμμα']
	end
-- stems for specific declensions - do not use the words lemma, stemnumber
-- stem 
    local stem = {}
	stem["θ"] = mw.ustring.sub(args['λήμμα'],1,-3)		-- start from 1st letter of lemma, stop at 3rd from the end (minus 2 letters)
	stem["θ0"] = m_stems.word0(stem["θ"])				-- remove accent
    stem["θ1"] = m_stems.word1(stem["θ0"])				-- accent on 1st syllable from the end
    stem["θ2"] = m_stems.word2(stem["θ0"])				-- accent on 2nd syllable from the end
--   stem["θ1ο"] = m_stems.PerispomeniToOxia(stem["θ"])
--   stem["θ1π"] = m_stems.OxiaToPerispomeni(stem["θ"])
--............. etc


return main(args) -- return args as in Module:xxx/main
end

--------------------------------------------------------------------------
--                        lemma - stem patterns                         --
--------------------------------------------------------------------------


-- this pattern1 covers both lemma and args['λήμμα'] at functions:
-- lemma or PAGENAME
    local lemma = ""
    if args['λήμμα'] ~= nil and args['λήμμα'] ~= "" then
        lemma = args['λήμμα']
    else
        PAGENAME = mw.title.getCurrentTitle().text
        lemma = PAGENAME:match( "^%s*(.-)%s*$" ) -- trim spaces - αφαίρεση κενών στην αρχή και στο τέλος. Υπάρχει σε όλα τα Module.
    end
--needs    
--    stem["θ"] = mw.ustring.sub(lemma,1,-stemnumber)
    
    
-- this pattern2 does not cover lemma in functions. Only args['λήμμα']
-- lemma or PAGENAME
	local lemma = args['λήμμα'] or '' --do not change
	PAGENAME = mw.title.getCurrentTitle().text
	if lemma  == '' or lemma == nil then args['λήμμα'] = PAGENAME:match( "^%s*(.-)%s*$" )  -- trim spaces - αφαίρεση κενών στην αρχή και στο τέλος. Υπάρχει σε όλα τα Module.
		else lemma = args['λήμμα']
	end
--needs
-- stem
    local stem = {}
	stem["θ"] = mw.ustring.sub(args['λήμμα'],1,-stemnumber)

	
    stem["θ"] = mw.ustring.sub(args['λήμμα'],1,-3)  -- start at 1st letter, stop at 3rd letter from end
    stem["θ0"] = m_stems.word0(stem["θ"])			-- function word0 removes accent	
	


--------------------------------------------------------------------------
--                       lemms-stem OLD, no minus                       --
--------------------------------------------------------------------------
-- lemma
	local lemma = args['λήμμα'] or ''
	PAGENAME = mw.title.getCurrentTitle().text
	if lemma  == '' then args['λήμμα'] = PAGENAME:match( "^%s*(.-)%s*$" ) 
		else lemma = args['λήμμα']
	end 	
-- stem
    local stemnumber = 2

    local stem = {}
    stem["θ"] = mw.ustring.sub(args['λήμμα'],1,-stemnumber-1)

 
--------------------------------------------------------------------------
--                  lemma - stem patterns OLD examples                  --
--------------------------------------------------------------------------


-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ old grc-nouns
klisi1 = function(args)
    local lemma = ""
    --αν χρησιμοποιηθεί η getargs μπορεί να παρακαμφθεί το if
    --και το local lemma να γίνει args['λήμμα'] κατευθείαν
    if args['λήμμα'] ~= nil and args['λήμμα'] ~= "" then
        lemma = args['λήμμα']
    else
        PAGENAME = mw.title.getCurrentTitle().text
        --αφαίρεση κενών στην αρχή και στο τέλος
        lemma = PAGENAME:match( "^%s*(.-)%s*$" )
    end
    local stemnumber = 0
    if args['α'] ~= "πλ" then
        stemnumber = tonumber(mw.ustring.len(args['οε']))
    else
        stemnumber = tonumber(mw.ustring.len(args['οπ']))
    end
    local stem1 = mw.ustring.sub(lemma,1,-stemnumber-1)

-- .......................
_module.thalassa = function(frame)
    local args = frame:getParent().args
    local lemma = ""
    if args['λήμμα'] ~= nil and args['λήμμα'] ~= "" then
        lemma = args['λήμμα']
    else
        PAGENAME = mw.title.getCurrentTitle().text
        --αφαίρεση κενών στην αρχή και στο τέλος
        lemma = PAGENAME:match( "^%s*(.-)%s*$" )
    end
    args['γε'] = 'ας'
    args['δε'] = 'ᾳ'
    local stemnumber = 2
    if args['α'] == "πλ" then stemnumber = 3 end
    local stem1 = mw.ustring.sub(lemma,1,-stemnumber)
    local stem2 = _module.removeaccent(stem1)
    local stem3 = _module.neostonos(stem2)
    local xaraktiras = mw.ustring.sub(stem1,-1)
    for  i, xar in ipairs({'β', 'γ', 'δ', 'ζ', 'θ', 'κ', 'λ', 'μ', 'ν', 'ξ', 'π', 'σ', 'τ', 'φ', 'χ', 'ψ'}) do
       if xaraktiras == xar then
       	args['γε'] = 'ης'
       	args['δε'] = 'ῃ'
       end
    end
    args['οε'] = stem1 .. _xk("α")
    args['γε'] = stem3 .. _xk(args['γε'])
    args['δε'] = stem3 .. _xk(args['δε'])
    args['αε'] = stem1 .. _xk("αν")
    args['κε'] = args['οε']
    args['οπ'] = stem1 .. _xk("αι")
    args['γπ'] = stem2 .. _xk("ῶν")
    args['δπ'] = stem3 .. _xk("αις")
    args['απ'] = stem3 .. _xk("ας")
    args['αδ'] = stem3 .. _xk("α")
    args['γδ'] = stem3 .. _xk("αιν")
    return frame:preprocess(fulltable2(args))
end

--------------------------------------------------------------------------
--                            COLOURS                             --
--------------------------------------------------------------------------

--GREY, too dull
-- =========== standard colours (GREY) and styles
-- borders
c_border = '#e3e5e8' -- same as c3 -- or, stronger: same as c_1
c_bord = '#eaf0fa' -- or '#eeeeee' -- inner lighter borders
c_bordR = '' -- right border: if there are more columns, it is soft c_bord. If it is the end, it is c_border
-- background colours
c_extra = '#b0c4de'
c_1 = '#aab1bb' -- ROW title1 MAIN, number names, and border for title2 if it exists
c_2 = '#c1c6cd' -- title2 (e.g. subtitles for dialects, genders of adjectives and border for title1
c_3 = '#e3e5e8' -- title3, all the subtitles 
c_4 = '#f1f2f4' -- background for notes - also test: #f8f8ff
]=]--
--[=[ == LightSteelBlue =  #b0c4de 70%-75%-85%-95%) -- too similar to modern greek
-- =========== standard colours (LightSteelBlue =  #b0c4de 70%-75%-85%-95%) and styles
-- borders
c_border = '#c9d7e8' -- same as c3 or stronger: same as c_1
c_bord = '#f4f4f4' -- or '#eeeeee' -- inner lighter borders
c_bordR = '' -- right border: if there are more columns, it is soft c_bord. If it is the end, it is c_border
-- background colours
c_extra = '#b0c4de'
c_1 = '#93aed2' -- ROW title1 MAIN, number names, and border for title2 if it exists
c_2 = '#a5bcd9' -- title2 (e.g. subtitles, genders of adjectives and border for title1
c_3 = '#c9d7e8' -- title3, all the subtitles 
c_4 = '#edf2f7' -- background for notes 

-- use 'local' when in /... argspages
local c_ending = '#eb0000'			-- is DeepPink. For wikitext, template [[Πρότυπο:χκ]], never bold
local c_stem = '#002000'			-- For wikitext, template [[Πρότυπο:χθ]], never bold

--------------------------------------------------------------------------
--                        3. ΘΕΜΑΤΑ / STEMS                             --
--------------------------------------------------------------------------
--==================================== TRIAL: NOTTTTTTT used yet
stems = function(stem)
-- lemma
	local lemma = args['λήμμα'] or ''
	PAGENAME = mw.title.getCurrentTitle().text
	if lemma  == '' then args['λήμμα'] = PAGENAME:match( "^%s*(.-)%s*$" ) 
		else lemma = args['λήμμα']
	end
-- stems
    local stem = {}
    
    minusletters = args['μείον'] or ''
    if args['μείον'] == '' and args['μείον'] == nil then
    	if args['α'] == 'πλ' or args['α2'] == 'πλ' or args['α'] == 'πλδ' or args['α2'] == 'πλδ' then
    		args['μείον'] = 2
    	else
    		args['μείον'] = args['μείον'] or ''
    	end
    end
	
    args["θ"] = mw.ustring.sub(args['λήμμα'],1,-(minusletters+1))
    -- unaccented:
    args["θ0"] = m_stems.word0(args["θ"])
    
    -- accent on ultima:
    args["θ1"] = m_stems.word1(args["θ0"])
    	-- add peripsomeni_to_oxia = args["θ1ο"]  ????? or just ["θ1"]
    	-- add oxia_to_perispomeni = args["θ1π"]
    
    -- on penultima
    args["θ2"] = m_stems.word2(args["θ0"])
return stem
end


-- =========== Errors -- use it with writing: if blahblah then return errorhere('xxxxxx') end
errorhere = function(errstring)
	return '<div class="error">' .. errstring .. '</div>[[Κατηγορία:Σελίδες με σφάλματα στο πρότυπο κλίσης ουσιαστικών (αρχαία ελληνικά)]]'
end





--cf [[Module:test/param]]

---------------------------------------------- SPLIT param pages (with ifs) By [[w:en:User talk:Trappist the monk]] at wikipedia
-- examples: [[wikt:el:Module:grc-nouns-decl/param]]
-- ========== Module:xxx/param  === parameters of Module:xxx ========== --
-- INSTRUCTIONS:
-- Call if from the central declension module by placing EXACTLY where it is needed:
	-- require ('Module:xxx/param').param (args)
	-- DO NOT change anything else. DO NOT add at top of page a m_main = require this and that.
	
-- USE: local for the functions

--------------------------------------------------------------------------
-- COPY HERE what is needed for THIS page, from the Module 
-- put here local zzzz require("...)
-- put here local xxxx, local yyyy parameters
-- ARRANGE the functions needed from the Module adding: local... and adding local args = {}
--------------------------------------------------------------------------
--[=[ EXAMPLE:
local function create_link (page, text)
	local args = {}
	if text then
		return '[[' .. page .. '|' .. text .. ']]'
	else
		return '[[' .. page .. ']]'
	end
end
]=]--



--[[--------------------------< I S _ S E T >------------ 

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

---------------------------------------------------------------------------
-- ========================MAIN FUNCTION================================ --
---------------------------------------------------------------------------
local function param (args) -- this is closed at the end of this page
--	local xxxx = args['ωωω'] or ''
	-- if this, do that, end e.g.
--[=[ EXAMPLE: get pagename or λήμμα='...'
	local lemma = args['λήμμα'] or ''
	PAGENAME = mw.title.getCurrentTitle().text
	if lemma  == '' or lemma == nil then args['λήμμα'] = PAGENAME:match( "^%s*(.-)%s*$" ) 
		else lemma = args['λήμμα']
	end	
]=]--


---------------------------------------------------------------------------
-- ============== START HERE ALL PARAMETERS ============== --
---------------------------------------------------------------------------


	-- ADD BLOCK HERE



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

end -- close  function param

return {param = param}