Module:R:Duden

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

This module implements {{R:Duden}}.


local export = {}
 
local chart = { ['ä']='ae', ['ö']='oe', ['ü']='ue',
                ['Ä']='Ae', ['Ö']='Oe', ['Ü']='Ue',
                ['ß']='sz', ['-']='_',  [' ']='_', 
                ["'"]='_' }

function export.create(frame)

   local params = {
		[1] = {},
		[2] = {},
		["w"] = {alias_of = 2},
	}
	local args = require("Module:parameters").process(frame:getParent().args, params)

	local title = args[2] or mw.title.getCurrentTitle().text
	local termURLCode = args[1] or mw.ustring.gsub(title,'.',chart)
	local link = ""
	if termURLCode == '' then
		link = "''Duden'' online"
	else
		link = "“[https://www.duden.de/rechtschreibung/"..termURLCode..' '..mw.text.nowiki(title) .."]” in ''Duden'' online"
	end
	return link
end
 
return export