Bu modul uchun Modul:nn-verb-common-irreg/doc nomli hujjat sahifasini yaratishingiz mumkin

local export = {}

local lang = require("Module:languages").getByCode("nn")
 
function export.main(frame)
    args = frame:getParent().args
    PAGENAME = mw.title.getCurrentTitle().text
    if PAGENAME:find('[ae]$') and mw.ustring.len(PAGENAME) > 2 then
        root = mw.ustring.sub(PAGENAME, 1,  mw.ustring.len(PAGENAME)-1)
    else
        root = PAGENAME
    end
    
    length = mw.ustring.len(root)
    
    local data = {lang = lang, pos_category = "verbs", categories = {lang:getCanonicalName() .. " irregular verbs"}, inflections = {}}
    
    local present_tense = {label = 'present tense'}
    local past_tense = {label = 'past tense'}
    local past_participle = {label = 'past participle'}
    local passive_infinitive = {label = 'passive infinitive'}
    local present_participle = {label = 'present participle'}
    local imperative = {label = 'imperative'}
    
    t5 = mw.ustring.sub(root, length-4, length)
    t4 = mw.ustring.sub(root, length-3, length)
    t3 = mw.ustring.sub(root, length-2, length)
    t2 = mw.ustring.sub(root, length-1, length)
    
    if t5 == 'leggj' or t4 == 'legg' then
        if t5 == 'leggj' then
            p1 = mw.ustring.sub(root, 1, length-5)
            j = 'j'
        else
            p1 = mw.ustring.sub(root, 1, length-4)
            j = ''
        end
        
        table.insert(present_tense, p1 .. 'legg')
        table.insert(past_tense, p1 .. 'la')
        table.insert(past_participle, p1 .. 'lagt')
        table.insert(passive_infinitive, p1 .. 'legg' .. j .. 'ast')
        table.insert(present_participle, p1 .. 'legg' .. j .. 'ande')
        table.insert(imperative, p1 .. 'legg')
            
    elseif t4 == 'setj' or t4 == 'sett' then
        if t4 == 'setj' then
            p1 = mw.ustring.sub(root, 1, length-4)
            j = 'j'
            table.insert(imperative, p1 .. 'set')
        else
            p1 =  mw.ustring.sub(root, 1, length-4)
            j = 't'
            table.insert(imperative, p1 .. 'sett')
        end
        
        table.insert(present_tense, p1 .. 'set')
        table.insert(past_tense, p1 .. 'sette')
        table.insert(past_participle, p1 .. 'sett')
        table.insert(passive_infinitive, p1 .. 'set' .. j .. 'ast')
        table.insert(present_participle, p1 .. 'set' .. j .. 'ande') 
    
    elseif t3 == 'stå' then
        p1 = mw.ustring.sub(PAGENAME, 1, length-3)
       
        table.insert(present_tense, p1 .. 'står')
        table.insert(past_tense, p1 .. 'stod')
        table.insert(past_participle, p1 .. 'stått')
        table.insert(passive_infinitive, p1 .. 'ståast')
        table.insert(present_participle, p1 .. 'ståande')
        table.insert(imperative, p1 .. 'stå')
        
    elseif t2 == 'gå' then
        p1 = mw.ustring.sub(PAGENAME, 1, length-2)
       
        table.insert(present_tense, p1 .. 'går')
        table.insert(past_tense, p1 .. 'gjekk')
        table.insert(past_participle, p1 .. 'gått')
        table.insert(passive_infinitive, p1 .. 'gåast')
        table.insert(present_participle, p1 .. 'gåande')
        table.insert(imperative, p1 .. 'gå')
    else
    	return "<span style=\"color:Red\">'''The verb ''" .. PAGENAME .. "'' is not supported by this template.'''</span> Use {{[[Template:nn-verb-irreg|nn-verb-irreg]]|<present tense>|etc.}} instead" 
    end
    
    table.insert(data.inflections, present_tense)
    table.insert(data.inflections, past_tense)
    table.insert(data.inflections, past_participle)
  
    if not no_passive_inf then
        table.insert(data.inflections, passive_infinitive)
    end
 
    if not no_present_part then
        table.insert(data.inflections, present_participle)
    end
 
    if not no_imp then
        table.insert(data.inflections, imperative)
    end
    
    return require("Module:headword").full_headword(data)
end

return export