Dokumentation für das Modul MarkerTypesList[Ansicht] [Bearbeiten] [Versionsgeschichte] [Aktualisieren]

Anwendung

Das Modul stellt eine Funktion für die Auflistung der Markertypen bereit.

Versionsbezeichnung auf Wikidata: 2024-08-26 Ok!

Benötigte weitere Module

Dieses Modul benötigt folgende weitere Module: Marker utilities/Types

Funktionsaufruf

Aufruf in Modulen

function ml.generateTableTypeList( frame ) 

liefert eine sortierbare Tabelle aller für die Vorlagen {{Marker}} und {{vCard}} einsetzbaren Typen. Die Tabelle zeigt die deutsche Übersetzung, die zugehörige Gruppe und die englische Typbezeichnung an.

Aufruf in Artikeln

{{#invoke:MarkerTypesList|generateTableTypeList}}
Hinweise
--[[ 	Generates a list of marker types ]]--  -- Module variable and administration local ml = { 	moduleInterface = { 		suite  = 'MarkerTypesList', 		serial = '2024-08-26', 		item   = 118040967 	} }  -- Language-dependent sorting substitutes local substitutes = { 	{ l = 'ä', as = 'a' }, 	{ l = 'ö', as = 'o' }, 	{ l = 'ü', as = 'u' }, 	{ l = 'ß', as = 'ss' } }  local function convertForSort( s ) 	s = mw.ustring.lower( s ) 	for i, obj in ipairs( substitutes ) do 		s = mw.ustring.gsub( s, obj.l, obj.as ) 	end 	return s end  -- generates a table with type documentation function ml.generateTableTypeList( frame )  	-- Module import 	local mt = require( 'Module:Marker utilities/Types' )  	local label 	local rows = {} 	for key, value in pairs( mt.types ) do 		label = value.label or value.alias or key 		if type( label ) == 'table' then 			label = label[ 1 ] or '' 		end 		table.insert( rows, ( '<tr><td>%s</td><td>%s</td><td>%s</td></tr>' ):format ( 			label:gsub( '_', ' ' ), value.group, key:gsub( '_', ' ' ) ) ) 	end 	table.sort( rows, 		function( a, b ) 			return convertForSort( a ) < convertForSort( b ) 		end 	) 	table.insert( rows, 1, '<table class="wikitable sortable multiline" cellspacing="0">\n' 		.. ( '<tr><th>%s</th><th>%s</th><th>%s</th></tr>' ):format ( 			'Beschriftung', 'Gruppe', 'Typ' ) 		) 	table.insert( rows, '</table>' ) 	return table.concat( rows, '\n' ) end  -- generates a table with group documentation function ml.generateTableGroupList( frame )  	-- Module import 	local mg = require( 'Module:Marker utilities/Groups' )  	local label  	local rows = {} 	for key, value in pairs( mg.groups ) do 		label = value.label or value.alias or key 		if type( label ) == 'table' then 			label = label[ 1 ] or '' 		end 		table.insert( rows, ( '<tr><td>%s</td><td>%s</td><td>%s</td><td style="background-color: %s; color: #fff;">&nbsp;&nbsp;</td><td>%s</td></tr>' ):format ( 			label:gsub( '_', ' ' ), value.default or '', key:gsub( '_', ' ' ), value.color or '', value.color or '' ) ) 	end 	table.sort( rows, 		function( a, b ) 			return convertForSort( a ) < convertForSort( b ) 		end 	) 	table.insert( rows, 1, '<table class="wikitable sortable multiline" cellspacing="0">\n' 		.. ( '<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>' ):format ( 			'Gruppenbezeichnung', 'Standardtyp im VCard-Editor', 'interne Gruppenbezeichnung', 'Farbe', 'RGB-Farbcode' ) 		) 	table.insert( rows, '</table>' ) 	return table.concat( rows, '\n' ) end  return ml