Module:Testcase table
Appearance
--
-- This module will implement {{Testcase table}}
--
local p = {}
function p.testcase(frame)
local args = frame:getParent().args
local basepagename = mw.title.getCurrentTitle().rootText
args['_template1'] = args['_template1'] or (basepagename)
args['_template2'] = args['_template2'] or (basepagename .. '/sandbox')
args['_heading1'] = args['_heading1'] or '{{[[Template:' .. args['_template1'] .. '|' .. args['_template1'] ..']]}}'
args['_heading2'] = args['_heading2'] or '{{[[Template:' .. args['_template2'] .. '|' .. args['_template2'] ..']]}}'
args['_caption'] = args['_caption'] or 'Side by side comparison'
local res1 = frame:expandTemplate{ title = args['_template1'], args = args }
local res2 = frame:expandTemplate{ title = args['_template2'], args = args }
return mw.ustring.format( [==[
<table><caption>%s</caption>
<tr><th style="width:50%%">%s</th><th style="width:50%%">%s</tr>
<tr style="vertical-align:top"><td>
%s</td><td>
%s</td></tr></table>]==],
args['_caption'],
args['_heading1'], args['_heading2'],
res1,
res2
)
end
return p