Modul:TestTabs: Unterschied zwischen den Versionen

Aus FürthWiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
(5 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 6: Zeile 6:


p.helloWorld = function()
p.helloWorld = function()
local div = mw.html.create( 'div' )
local div = mw.html.create( 'details' )
div
div
     :attr( 'id', 'testdiv' )
     :attr( 'id', 'testdiv' )
Zeile 12: Zeile 12:
     :wikitext( 'Some text' )
     :wikitext( 'Some text' )
     :tag( 'hr' )
     :tag( 'hr' )
return tostring( div )
return {expand=true, text=div}
-- Output: <div id="testdiv" style="width:100%;">Some text<hr /></div>
-- Output: <div id="testdiv" style="width:100%;">Some text<hr /></div>
end
end

Aktuelle Version vom 3. Januar 2024, 14:45 Uhr

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

local p = {}

function p.unstrip(frame)
	return mw.text.unstrip(frame.args[1] or '')
end

p.helloWorld = function()
	local div = mw.html.create( 'details' )
div
     :attr( 'id', 'testdiv' )
     :css( 'width', '100%' )
     :wikitext( 'Some text' )
     :tag( 'hr' )
return {expand=true, text=div}
-- Output: <div id="testdiv" style="width:100%;">Some text<hr /></div>
end

p.justFun = function(a)
	args = a.args
	return 'The name was ' .. tostring(args)
end

p.checkMac = function(a)
	args = a.args
	return 'Your check is Mc' .. args.name
end

p.preprocess = function(a)
	args = a.args
	f = mw.getCurrentFrame()
	--return mw.text.unstrip(a.text)
	return f:preprocess( args.text ) 
end
return p