Modul:TestTabs: Unterschied zwischen den Versionen

Aus FürthWiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 6: Zeile 6:


p.helloWorld = function()
p.helloWorld = function()
-- create the table's header row
local div = mw.html.create( 'div' )
local tbl = mw.html.create('table')
div
:tag('tr')
    :attr( 'id', 'testdiv' )
:tag('th')
    :css( 'width', '100%' )
:wikitext("things that aren't as cute as kittens")
    :wikitext( 'Some text' )
:done()
    :tag( 'hr' )
:done()
return tostring( div )
-- now the current location in tbl is directly within the <table> tag
-- Output: <div id="testdiv" style="width:100%;">Some text<hr /></div>
 
-- add further rows to the table
for _, v in ipairs({ 'bunnies', 'puppies' }) do
tbl:tag('tr')
:tag('td')
:wikitext(v)
end
return 'Knox off'
end
end



Version vom 3. Januar 2024, 13:32 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( 'div' )
div
     :attr( 'id', 'testdiv' )
     :css( 'width', '100%' )
     :wikitext( 'Some text' )
     :tag( 'hr' )
return tostring( 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