Module:Testcase table: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 6:
function p.testcase(frame)
local args = frame:getParent().args
local titlebasepagename = mw.ustring.gsub(mw.title.getCurrentTitle().text, '/testcases.*$', '');
local template1 = args['_template1'] or (titlebasepagename)
local template2 = args['_template2'] or (titlebasepagename .. '/sandbox')
local heading1 = args['_heading1'] or '{{[[Template:' .. template1 .. '|' .. template1 ..']]}}'
local heading2 = args['_heading2'] or '{{[[Template:' .. template2 .. '|' .. template2 ..']]}}'
local caption = args['_caption'] or 'Side by side comparison'
local t = {}
Line 20 ⟶ 21:
local res2 = frame:expandTemplate{ title = template2, args = t }
return '<table><caption>' .. caption .. '</caption>\n' ..
'<tr><th style="width:50%">' .. heading1 .. '</th><th style="width:50%">' .. heading2 .. '</tr>\n' ..
'<tr style="vertical-align:top"><td>\n' .. res1 .. '</td><td>\n' .. res2 .. '</td></tr></table>'
end