Module:el-decl-noun

This module page is experimental.
The details of its operation have not yet been fully decided upon. Do not deploy widely until the module page is finished.

-- create decl table for greek nouns
-- either with stem + endings
-- or with full words
-- Also an option
-- to select if only singular or only plural exists
_module ={}
--start of variable justanenter
justanenter = [=[
 
]=]
--end of variable justanenter
 
--TODO παραμετροποίηση χρωμάτων για ευκολότερη μελλοντική τροποποίηση
fulltable2 = function (args)
    local stitlestr = ''
    local ptitlestr = ''
    local onomenstr = ''
    local onomplstr = ''
    local genenstr = ''
    local genplstr = ''
    local aitenstr = ''
    local aitplstr = ''
    local klenstr = ''
    local klplstr = ''
    local notes = ''
    local width1 = '50em'
    local width2 = '100%'
    local width3 = '33%'
    local hassingular = true
    --if user wants only plural
    if args['plural'] ~= nil then hassingular = false end
    local hasplural = true
    --if user wants only singular
    if args['singular'] ~= nil then hasplural = false end
    if not (args['notes'] == nil or mw.ustring.len(args['notes']) < 1) then        
        notes = '|-' .. justanenter .. [=[| colspan="4" align="left" style="background:#d9ebff; font-size: 90%; font-style: italic;" | ]=] 
        notes = notes .. args['notes'] .. justanenter
    end
    if hassingular ~= hasplural then
        width1 = '40em'
        width2 = '40em'
        width3 = '50%'
    end        
    if hassingular then
        stitlestr =  [=[! style="background:#cce4fc" | singular <small>({{Grek|[[ενικός]]}})</small>]=] .. justanenter
        onomenstr = [=[| {{Grek|]=] .. args[1] .. '}}' .. justanenter
        genenstr =  [=[| {{Grek|]=] .. args[3] .. '}}' .. justanenter
        aitenstr =  [=[| {{Grek|]=] .. args[5] .. '}}' .. justanenter
        klenstr =  [=[| {{Grek|]=] .. args[7] .. '}}' .. justanenter
    end
    if hasplural then
        ptitlestr = [=[! style="background:#cce4fc" | plural <small>({{Grek|[[πληθυντικός]]}})</small>]=] .. justanenter
        onomplstr =  [=[| {{Grek|]=] .. args[2] .. '}}' .. justanenter
        genplstr =   [=[| {{Grek|]=] .. args[4] .. '}}' .. justanenter
        aitplstr =  [=[| {{Grek|]=] .. args[6] .. '}}' .. justanenter
        klplstr =   [=[| {{Grek|]=] .. args[8] .. '}}' .. justanenter
    end
 
    return '<div class="NavFrame" style="width:' .. width1 ..[=[">
<div class="NavHead" style="background:#cce4fc; text-align:left" >declension of {{Grek|{{PAGENAME}}}}</div>
<div class="NavContent">
{| style="background:#fdfdfd; text-align:center; width:]=] .. width2 .. [=[; border-collapse:separate; border-spacing:1px" class="inflection-table"
|-
! style="width:]=] .. width3 .. [=[;background:#cce4fc" |]=] .. justanenter .. stitlestr .. ptitlestr .. [=[|-
|-
! style="background:#e0f0ff" | nominative <small>({{Grek|[[ονομαστική]]}})</small>]=] .. justanenter .. onomenstr .. onomplstr .. [=[|-
! style="background:#e0f0ff" | genitive <small>({{Grek|[[γενική]]}})</small>]=] .. justanenter .. genenstr .. genplstr .. [=[|-
! style="background:#e0f0ff" | accusative <small>({{Grek|[[αιτιατική]]}})</small>]=] .. justanenter .. aitenstr .. aitplstr .. [=[|-
! style="background:#e0f0ff" | vocative <small>({{Grek|[[κλητική]]}})</small>]=] .. justanenter .. klenstr .. klplstr .. notes .. justanenter .. '|}</div></div>' 
end
 
-- @param
--  'εν' : έχει μόνο ενικό
--  'πλ' : έχει μόνο πληθυντικό
--  'θέμα1' : το θέμα 
--  'οε' : ονομαστική του ενικού (ή μόνο η κατάληξη)
--  'γε' : γενική του ενικού (ή μόνο η κατάληξη)
--  'αε' : αιτιατική του ενικού (ή μόνο η κατάληξη)
--  'κε' : κλητική του ενικού (ή μόνο η κατάληξη)
--  'οπ' : ονομαστική του πληθυντικού (ή μόνο η κατάληξη)
--  'γπ' : γενική του πληθυντικού (ή μόνο η κατάληξη)
--  'απ' : αιτιατική του πληθυντικού (ή μόνο η κατάληξη)
--  'κπ' : κλητική του πληθυντικού (ή μόνο η κατάληξη)
-- αν υπάρχει παράμετρος "θέμα1" τότε
-- οι παράμετροι περιέχουν μόνο τις καταλήξεις
-- οπότε προσθέτουμε και το θέμα1
function _module.declwithstem(frame)
    local args = frame.args 
    -- if stem1 exists then parameters are only endings
    if  args['stem1'] ~= nil or  args['stem1'] ~='' then
        -- concatenate them
        args[1] = args['stem1'] .. args[1]
        args[2] = args['stem1'] .. args[2]
        args[3] = args['stem1'] .. args[3]
        args[4] = args['stem1'] .. args[4]
        args[5] = args['stem1'] .. args[5]
        args[6] = args['stem1'] .. args[6]
        args[7] = args['stem1'] .. args[7]
        args[8] = args['stem1'] .. args[8]
    end
    -- else parameters are full words
-- preprocess is necessery because it includes Template Grek
    return frame:preprocess(fulltable2(args))    
end
 
return _module