Jump to content

Module:no-entry-subst

From Wiktionary, the free dictionary

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local p = {}
 
function p.main(frame)    
    lang = frame.args[1]
    templ = {}
    templ['verb'] = 'verb'; templ['adjective'] = 'adj'; templ['noun'] = 'noun'
    classl = string.lower(frame.args[2])
    classf = string.upper(string.sub(classl, 1,1))
    class = classf .. string.sub(classl, 2)
    class2 = frame.args[3]
    meaning = frame.args[4]
    etyl = ''
    entry_nn = ''
    entry_nb = ''
    if lang == 'nb' or lang == 'no' then
        start = '==Norwegian Bokmål=='
        entry_nb = string.format(start .. '\n\n===%s===\n{{nb-%s-%s}}\n\n# [[%s]]', class, templ[classl], class2, meaning)
    end
    if lang == 'nn' or lang == 'no' then
        if lang == 'no' then
            start = '\n\n----\n\n==Norwegian Nynorsk=='
        else
            start = '==Norwegian Nynorsk=='
        end
        entry_nn = string.format(start .. '\n\n===%s===\n{{nn-%s-%s}}\n\n# [[%s]]', class, templ[classl], class2, meaning)
    end
    entry = entry_nb .. entry_nn
    return entry
end
 
return p