Module:stems >> Module:stems/τεκμηρίωση (documentation)

  • Πρότυπο:word-1 λέξη μείον το τελευταίο γράμμα, οποιασδήποτε γλώσσας
  • Πρότυπο:word-2 λέξη μείον 2 τελευταία γράμματα, οποιασδήποτε γλώσσας
  • Πρότυπο:word-3 λέξη μείον 3 τελευταία γράμματα, οποιασδήποτε γλώσσας
  • Πρότυπο:word2- λέξη μείον το 1ο γράμμα, αρχίζουμε από το 2ο γράμμα, σε οποιαδήποτε γλώσσα

-- 2020.04.11. Sarri.greek
--[=[
ΠΑΡΑΓΩΓΗ ΘΕΜΑΤΩΝ - STEM PRODUCTION
1) minus letters from end. Templates like word-1, word-2 etc.
	χρήσιμα σε πίνακες κλίσης - for inflection tables
	από το λήμμα ή δοσμένο λήμμα=ωωωω - from lemma or a given λήμμα=xxxx, minus letters from the end
	word_0 = μείον 0 γράμματα από το τέλος ([[Πρότυπο:word-0]])
	word_1 = μείον 1 γράμμα από το τέλος  ([[Πρότυπο:word-1]])
	word_2 = μείον 2 γράμματα από το τέλος  ([[Πρότυπο:word-2]])
	word_3 = μείον 3 γράμματα από το τέλος  ([[Πρότυπο:word-3]])
2) minus letters from beginning. Templates like word2- (starts from 2nd letter)
	word2- = μείον 1ος χαρακτήρας από την αρχή, όπως ο αστερίσκος σε υποθετικούς τύπους
			= minus 1st character from beginning, e.g. the asterisc of hypthetical forms
]=]--

local export = {}

--------------------------------------------------------------------------
--         lemma minus letters from the end for templates               --
--                 plus i variants for direct invoke                    --
--------------------------------------------------------------------------


-- ============= word_0 =============== --
-- lemma minus 0 letters from the end for Template [[Πρότυπο:word-0]]
function export.word_0(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
    PAGENAME = mw.title.getCurrentTitle().text
    lemma = PAGENAME:match( "^%s*(.-)%s*$" )
	if term ~= '' then lemma = term end
    if lemma == '' then lemma = PAGENAME:match( "^%s*(.-)%s*$" ) end
return mw.ustring.sub(lemma,1,-1)	
end


-- ============= wordi_0 =============== --
-- wordi= word invoked
-- lemma minus 0 letters, direct invoke
function export.wordi_0(frame)
--	myarg = frame:getParent().args --  for Template only
	myarg = frame.args -- for invoke only
    PAGENAME = mw.title.getCurrentTitle().text
    lemma = PAGENAME:match( "^%s*(.-)%s*$" )
	lemma_target = myarg['lemma'] or myarg['λήμμα'] or ''
	if lemma_target ~= '' then lemma = lemma_target end
    if lemma == '' then lemma = PAGENAME:match( "^%s*(.-)%s*$" ) end
return mw.ustring.sub(lemma,1,-1)
end


-- ============= word_1 =============== --
-- lemma minus 1 letter from the end for Template [[Πρότυπο:word-1]]
function export.word_1(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
    PAGENAME = mw.title.getCurrentTitle().text
    lemma = PAGENAME:match( "^%s*(.-)%s*$" )
	if term ~= '' then lemma = term end
    if lemma == '' then lemma = PAGENAME:match( "^%s*(.-)%s*$" ) end
return mw.ustring.sub(lemma,1,-2)	
end


-- ============= wordi_1 =============== --
-- wordi= word invoked
-- lemma minus 1 letter, direct invoke
function export.wordi_1(frame)
--	myarg = frame:getParent().args --  for Template only
	myarg = frame.args -- for invoke only
    PAGENAME = mw.title.getCurrentTitle().text
    lemma = PAGENAME:match( "^%s*(.-)%s*$" )
	lemma_target = myarg['lemma'] or myarg['λήμμα'] or ''
	if lemma_target ~= '' then lemma = lemma_target end
    if lemma == '' then lemma = PAGENAME:match( "^%s*(.-)%s*$" ) end
return mw.ustring.sub(lemma,1,-2)
end


-- ============= word_2 =============== --
-- lemma minus 2 letters, for [[Template:word-2]]
function export.word_2(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
    PAGENAME = mw.title.getCurrentTitle().text
    lemma = PAGENAME:match( "^%s*(.-)%s*$" )
	if term ~= '' then lemma = term end
    if lemma == '' then lemma = PAGENAME:match( "^%s*(.-)%s*$" ) end
return mw.ustring.sub(lemma,1,-3)	
end


-- ============= wordi_2 =============== --
-- lemma minus 2 letters, direct invoke
function export.wordi_2(frame)
--	myarg = frame:getParent().args --  for Template only
	myarg = frame.args -- for invoke only
    PAGENAME = mw.title.getCurrentTitle().text
    lemma = PAGENAME:match( "^%s*(.-)%s*$" )
	lemma_target = myarg['lemma'] or myarg['λήμμα'] or ''
	if lemma_target ~= '' then lemma = lemma_target end
    if lemma == '' then lemma = PAGENAME:match( "^%s*(.-)%s*$" ) end
return mw.ustring.sub(lemma,1,-3)
end


-- ============= word_3 =============== --
-- lemma minus 3 letters, for Template [[Πρότυπο:word-3]]
function export.word_3(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
    PAGENAME = mw.title.getCurrentTitle().text
    lemma = PAGENAME:match( "^%s*(.-)%s*$" )
	if term ~= '' then lemma = term end
    if lemma == '' then lemma = PAGENAME:match( "^%s*(.-)%s*$" ) end
return mw.ustring.sub(lemma,1,-4)	
end


-- ============= wordi_3 =============== --
-- lemma minus 3 letters, direct invoke
function export.wordi_3(frame)
--	myarg = frame:getParent().args --  for Template only
	myarg = frame.args -- for invoke only
    PAGENAME = mw.title.getCurrentTitle().text
    lemma = PAGENAME:match( "^%s*(.-)%s*$" )
	lemma_target = myarg['lemma'] or myarg['λήμμα'] or ''
	if lemma_target ~= '' then lemma = lemma_target end
    if lemma == '' then lemma = PAGENAME:match( "^%s*(.-)%s*$" ) end
return mw.ustring.sub(lemma,1,-4)
end


--------------------------------------------------------------------------
--        lemma minus letters from beginning for templates              --
--                 plus i variants for direct invoke                    --
--------------------------------------------------------------------------


-- ============= word2- =============== --
-- lemma minus 1 letter from the beginning, start from 2nd letter. For Template [[Πρότυπο:word2-]]
-- used e.g. to omit asterisc for hypothetical forms
function export.word2_(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
    PAGENAME = mw.title.getCurrentTitle().text
    lemma = PAGENAME:match( "^%s*(.-)%s*$" )
	if term ~= '' then lemma = term end
    if lemma == '' then lemma = PAGENAME:match( "^%s*(.-)%s*$" ) end
return mw.ustring.sub(lemma,2,-1)	
end


-- ============= wordi2- =============== --
-- wordi= word invoked
-- lemma minus 1 letter from beginning, start from 2nd letter. For direct invoke
function export.wordi2_(frame)
--	myarg = frame:getParent().args --  for Template only
	myarg = frame.args -- for invoke only
    PAGENAME = mw.title.getCurrentTitle().text
    lemma = PAGENAME:match( "^%s*(.-)%s*$" )
	lemma_target = myarg['lemma'] or myarg['λήμμα'] or ''
	if lemma_target ~= '' then lemma = lemma_target end
    if lemma == '' then lemma = PAGENAME:match( "^%s*(.-)%s*$" ) end
return mw.ustring.sub(lemma,2,-1)
end


return export