Hopp til innhald

Modul:Nynorskordboka og Bokmålsordboka

Frå Wiktionary - den frie ordboka

Dokumentasjon for modulen kan opprettast på Modul:Nynorskordboka og Bokmålsordboka/dok

local p = {}
 
function p.main(frame)
    local PAGENAME = mw.title.getCurrentTitle().text
    args = frame:getParent().args
    if args['lang'] then
        lang = args['lang']
    else
        lang = 'no'
    end
    if lang == 'nb' then
        specifier = '&bokmaal=+&ordbok=bokmaal'
        specifier2 = "''Bokmålsordboka''"
    elseif lang == 'nn'  then
        specifier = '&nynorsk=+&ordbok=nynorsk'
        specifier2 = "''Nynorskordboka''"
    elseif lang == 'no' then
        specifier = '&begge=&begge=+&ordbok=begge'
        specifier2 = "''Bokmålsordboka og Nynorskordboka''"
    end
    
    description = args[1] or PAGENAME
    target = description:gsub(' ', '+')
        
    template = "[http://ordbok.uib.no/perl/ordbok.cgi?OPP=" .. target .. specifier ..
    "&alfabet=o «" .. description .. "»] i " .. specifier2 .. '.'
    return template
end
 
return p