Die Dokumentation für dieses Modul kann unter Modul:ungültige Seitennamen/Doku erstellt werden

local export = {}

-- This function returns a link to an unsupported title.
-- text -> The 1st argument given to [[Template:unsupported]], consisting of the unsupported title to format as a link. If the wanted page is "Unsupported titles/Low line", you can use "_", "low line", "underline", etc., provided the page is listed in [[Modul:ungültige Seitennamen/data]].
-- altText -> The 2nd argument given to [[Template:unsupported]], consisting of the alternative text to be displayed, if applicable.
-- noError -> If true, it returns nil if the entry does not exist, instead of an error. This may be used to test if an entry exists as an unsupported title, because an error would need to be fixed, but a simple test may not need fixing.
-- onlyActualPageTitle -> If true, the module only accepts the actual page title, and not any of the aliases. For example, the module would only accept "_", and not "low line", "underscore" or "underline". This may be used to test if an entry exists as an unsupported title, so for example "underscore" would not be recognized as an unsupported title.
function export.parse(text, altText, noError, onlyActualPageTitle)
	-- allTitles -> a list of all unsupported titles, located at "Modul:ungültige Seitennamen/data".
	local allTitles = mw.loadData("Modul:ungültige Seitennamen/data")

	-- englishObject -> the English language object, to be used later for the "ucfirst" function.
	local germanObject = mw.language.new("de")

	-- The code below parses a text like this, in the "allTitles" argument from "Modul:ungültige Seitennamen/data":
	-- m["full stop"] = {display=".", "period",}
	-- The "display" value is optional, but if it exists, this is the displayed text.
	for k, v in pairs(allTitles) do
		local pagename = text
		--if v["pagename"] then pagename = germanObject:ucfirst(v["pagename"]) end
		if v["pagename"] then pagename = v["pagename"] end

		-- First, check the table keys for page names.
		if text == k then
			return "[[ungültige Seitennamen/" .. pagename .. "|" .. (altText or v["display"] or k) .. "]]"
		end

		-- Second, check the table values for page names. This is ignored if onlyActualPageTitle is true.
		if onlyActualPageTitle ~= true then
			for l, m in pairs(v) do
				if text == m then
					return "[[ungültige Seitennamen/" .. pagename .. "|" .. (altText or v["display"] or k) .. "]]"
				end
			end
		end
	end

	if noError == true then
		return null
	else
		error ("Das erste Argument der Vorlage konnte nicht als ungültiger Seitentitel erkannt werden.")
	end
end

function export.link(frame)
	local text = frame:getParent().args[1]
	local altText = frame:getParent().args[2]
	local noError = frame:getParent().args["noerror"]

	return export.parse(text, altText, noError)
end
	
return export