Modul:Navigationsleiste

Die Dokumentation für dieses Modul kann unter Modul:Navigationsleiste/Doku erstellt werden

-- Bitte weitere Funktionalität bei Bedarf hinzufügen.
-- Dieses Modul kann auch die Konvertierungen bestehender
-- Vorlagen vom Typ Navigationsleiste aufnehmen.

p = {}

-- Zweizeilige Navigationsleiste, die annotierbare Gruppen bildet
--   1. Zeile: Annotierbare Gruppen von Wikilinks, 2. Zeile: Annotationen
function p.Gemeindeteile( frame )
	local align, align2, samebox = 'center', nil, 'no'
	local border, color = '1px solid dimgray', 'dimgray'
	local lnks = mw.html.create( 'div' )
		:cssText( 'text-align:#ALIGN' )
		:tag( 'p' )
	local refs = mw.html.create( 'div' )
		:cssText( 'text-align:#ALGN2;color:#TCOLOR;font-size:small' )
		:tag( 'p' )
	local ref, ret = 0, {}
	
	for k, v in pairs( frame.args )
	do  local br, sup = nil, { '' }
		v = mw.text.trim( v )
		v = v:gsub( '^sup:[,%s%d]+', function( s )
			s:gsub( '%d+', function( _s ) sup[ #sup + 1 ] = _s end )
			return '' end )
		v, br = v:gsub( '^<br.->', '' )
		if type( k ) == 'number'
		then if not v:find( '^%[.*%]$' )
		then ref = ref + 1
			if ref > 1 and br < 1 then refs:wikitext( ' &nbsp; ' ) end
			if br > 0 then refs = refs:done():tag( 'p' ) end
			refs:wikitext( '<sup>' .. tostring( ref ) .. '</sup>&#8239;' .. v )
		else if #sup < 2 then sup[ #sup + 1 ] = tostring( ref + 1 ) end
			if ref > 0 and br < 1 then lnks:wikitext( ' •&nbsp;' ) end
			if br > 0 then lnks = lnks:done():tag( 'p' ) end
			lnks:tag( 'span' )
				:cssText( 'color:#TCOLOR;padding:1px 2px' )
				:cssText( 'border-bottom:#BORDER;border-right:#BORDER' )
				:wikitext( v:gsub( '%s*,%s*', '&nbsp;• ' ):sub( 1 ) )
			lnks:tag( 'sup' )
				:cssText( 'color:#TCOLOR' )
				:wikitext( table.concat( sup, '&#8239;' ) )
		end
		else if k:lower() == 'bild'   then ret.BILD = v
		else if k:lower() == 'titel'  then ret.TITEL = v
		else if k:lower() == 'rahmen' then border = v
		else if k:lower() == 'farbe'  then color = v
		else if k:lower() == 'zeilen' then align = v
		else if k:lower() == 'zeile2' then align2 = v
		else if k:lower() == 'einzug' then samebox = v
		end end end end end end end end
	end

	ret.INHALT = ( tostring( lnks:done() ) .. tostring( refs:done() ) )
		:gsub( '#BORDER', border )
		:gsub( '#TCOLOR', color )
		:gsub( '#ALIGN', align )
		:gsub( '#ALGN2', align2 or align )
	
	if samebox == 'fit' or samebox == 'yes'
	then local margin = '0px'
		if ret.BILD then margin = ret.BILD:gsub( '^.-([%d]+)px.*$', '%1' ) end
		ret.INHALT = '<div style="margin-left:' ..
			tostring( tonumber( margin ) + 8 ) ..
			'px">' .. ret.INHALT .. '</div>'
	end
	
	-- noch nicht als Modul verfügbar, expandTemplate nutzen
	return frame:expandTemplate{ title = 'Navigationsleiste', args = ret }
end

return p

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.