Jump to content

Module:Testcase table

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Frietjes (talk | contribs) at 21:27, 3 July 2013. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local p = {}

function p.testcase(frame)
    local args = frame.args
    local template1 = args['_template1'] or (frame:expandTemplate{ title = 'BASEPAGENAME'})
    local template2 = args['_template2'] or (frame:expandTemplate{ title = 'BASEPAGENAME'} .. '/sandbox')
    local heading1 = args['_heading1'] or '{{tld|' .. template1 .. '}}'
    local heading2 = args['_heading2'] or '{{tld|' .. template2 .. '}}'
    
    local res = ''
    for k, v in pairs(args) do
        res = res .. '|' .. k .. '=' .. v
    end
    res = '<table><tr><th>' .. heading1 .. '</th><th>' .. heading2 .. '</tr>\n' ..
          '<tr><td>\n{{' .. template1 .. res .. '}}</td><td>\n{{' .. template2 .. res ..'}}</td></tr></table>'
    return res
end

return p