Modul:R:The Bokmål and Nynorsk dictionaries

A modult a Modul:R:The Bokmål and Nynorsk dictionaries/doc lapon tudod dokumentálni

local p = {}
 
function p.main(frame)
    local PAGENAME = mw.title.getCurrentTitle().text
    
    local templateLang = frame.args[1]
    local args = frame:getParent().args
    
    local lang
    
    if templateLang and templateLang ~= '' then
    	lang = templateLang
    else
	    if args['lang'] then
	        lang = args['lang']
	    else
	        lang = 'no'
	    end
    end
    
    if lang == 'nb' then
        specifier = 'bm'
        specifier2 = "''The Bokmål Dictionary''"
    elseif lang == 'nn'  then
        specifier = 'nn'
        specifier2 = "''The Nynorsk Dictionary''"
    elseif lang == 'no' then
        specifier = 'bm,nn'
        specifier2 = "''The Bokmål Dictionary'' / ''The Nynorsk Dictionary''"
    end
    
    target = args[1] or PAGENAME
        
    template = "[https://ordbokene.no/" .. specifier .. "/search?q=" .. target  ..
    " " .. target .. "] - " .. specifier2 .. "."
    return template
end
 
return p