Module:R:Lexer

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

This module implements {{R:Lexer}}.


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

function export.create(frame)
	local args = frame:getParent().args
	local term = args[1] or mw.title.getCurrentTitle().text
	local termEncoded = mw.ustring.gsub(term, '[äöüÄÖÜß-]', chart)
	local dictionary = args['dictionary'] or "Lexer"
	local link = ""
	
	if term == '' then
		link = "Matthias von Lexer, ''Mittelhochdeutsches Handwörterbuch'', 3 vols., Leipzig 1872–1878."
	else
		link = "“[https://woerterbuchnetz.de/?sigle="..dictionary.."&lemma="..termEncoded..' '..term.."]” in ''Mittelhochdeutsches Handwörterbuch'', [[w:Matthias Lexer|Matthias von Lexer]], 3 vols., Leipzig 1872–1878."
	end
	return link
end
 
return export