Module:User:Jberkel/Wörterbuchnetz

-- Generates reference links for woerterbuchnetz.de, -- a collection of mostly German-language related dictionaries hosted by the -- Trier Center for Digital Humanities (https://tcdh.uni-trier.de/) -- Based on Module:R:Grimm by JohnC5 local export = {} local dictionaries = { Adelung = { title = "Grammatisch-Kritisches Wörterbuch der Hochdeutschen Mundart (Ausgabe letzter Hand, Leipzig 1793–1801)" }, 	BMZ = { title = "Mittelhochdeutsches Wörterbuch von Benecke, Müller, Zarncke" },	DWB = { title = "Deutsches Wörterbuch von Jacob und Wilhelm Grimm, 16 vols., Leipzig 1854–1961." },	DWB2 = { title = "Deutsches Wörterbuch von Jacob und Wilhelm Grimm, Neubearbeitung (A–F)." },	ElsWB = { title = "Wörterbuch der elsässischen Mundarten" },   FindeB = { title = "Findebuch zum mittelhochdeutschen Wortschatz" },   GWB = { title = "Goethe-Wörterbuch" },   Hederich = { title = "Gründliches mythologisches Lexikon von Benjamin Hederich (1770)" },   Herder = { title = "Herders Conversations-Lexikon (1. Auflage, 1854–1857)" },   Lexer = { title = "Mittelhochdeutsches Handwörterbuch von Matthias Lexer" },   LmL = { title = "Lexicon musicum Latinum medii aevi" },   LothWB = { title = "Wörterbuch der deutsch-lothringischen Mundarten" },   MLW = { title = "Mittellateinisches Wörterbuch" },   Meyers = { title = "Meyers Großes Konversationslexikon (6. Auflage, 1905–1909)" },	PfWB = { title = "Pfälzisches Wörterbuch" },   RhWB = { title = "Rheinisches Wörterbuch" },   RhWBN = { title = "Nachträge zum Rheinischen Wörterbuch" },   UWB = { title = "Uigurisches Wörterbuch" },   WWB = { title = "Westfälisches Wörterbuch" },   Wander = { title = "Deutsches Sprichwörter-Lexicon von Karl Friedrich Wilhelm Wander" } }

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

function export.show(frame) local module_parameters = require("Module:parameters") -- templates can specify a default dictionary to be used, but make it overridable local frame_args = module_parameters.process(frame.args, {		["dictionary"] = {}	})

local params = { [1] = { alias_of = "url_code" }, [2] = { alias_of = "headword" }, ["url_code"] = { }, ["headword"] = { default = mw.title.getCurrentTitle.text }, ["dictionary"] = {}, ["w"] = { alias_of = "headword" } }	local args = module_parameters.process(frame:getParent.args, params) local dictionary = args['dictionary'] or frame_args['dictionary'] if not dictionary then error('The parameter "dictionary" is required') end local dictionary_data = dictionaries[dictionary] if not dictionary_data then error("Unknown dictionary "..dictionary) end local headword = args.headword local url_code = args.url_code or mw.ustring.gsub(headword,'[äöüÄÖÜß-]', encoding_table) local dictionary_title = dictionary_data.title

local url = "https://woerterbuchnetz.de/?sigle="..dictionary.."&lemma="..url_code local linked_headword = "[" .. url .. " " ..headword.."]" return '“' .. linked_headword .. '”' .. ' in ' .. dictionary_title end return export