Module:Testcase table
Appearance
--
-- This module will implement {{Testcase table}}
--
local p = {}
function p.testcase(frame)
local args = frame:getParent().args
local title = mw.ustring.gsub(mw.title.getCurrentTitle().text, '/testcases$', '');
local template1 = args['_template1'] or (title)
local template2 = args['_template2'] or (title .. '/sandbox')
local heading1 = args['_heading1'] or '{{' .. template1 .. '}}'
local heading2 = args['_heading2'] or '{{' .. template2 .. '}}'
local t = {}
for k, v in pairs(args) do
t[k] = v
end
local res1 = frame:expandTemplate{ title = template1, args = t }
local res2 = frame:expandTemplate{ title = template2, args = t }
return '<table><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
return p