Module:R:NAOB

From Wiktionary, the free dictionary
Jump to navigation Jump to search

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

local process_params = require("Module:parameters").process
local uri_encode = mw.uri.encode

local export = {}
 
function export.main(frame)
	local args = process_params(frame:getParent().args, {
		[1] = true,
		["searchmode"] = true,
	})
	
	local target = args[1] or mw.loadData("Module:headword/data").pagename
	local searchmode = args.searchmode or "ordbok"
	
	return ("[https://www.naob.no/%s/%s “%s”] in ''Det Norske Akademis ordbok'' (''NAOB'')."):format(
		uri_encode(searchmode == "search" and "søk" or searchmode, "PATH"),
		uri_encode(target, "PATH"),
		target
	)
end
 
return export