Module:Template:R:The Bokmål and Nynorsk dictionaries

د ويکيسيند لخوا

Documentation for this module may be created at Module:Template:R:The Bokmål and Nynorsk dictionaries/لاسوند

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 = "''The Bokmål Dictionary''"
    elseif lang == 'nn'  then
        specifier = '&nynorsk=+&ordbok=nynorsk'
        specifier2 = "''The Nynorsk Dictionary''"
    elseif lang == 'no' then
        specifier = '&begge=&begge=+&ordbok=begge'
        specifier2 = "''The Bokmål Dictionary'' / ''The Nynorsk Dictionary''"
    end
    
    target = args[1] or PAGENAME
    target_ = target:gsub(' ', '+')
        
    template = "[http://www.nob-ordbok.uio.no/perl/ordbok.cgi?OPP=" .. target_ .. specifier ..
    " “" .. target .. "”] in " .. specifier2 .. "."
    return template
end
 
return p