Module:Template test case: Difference between revisions

add TestCase:renderInline and add newlines between the render output when making collapsible test cases
(fix function name)
(add TestCase:renderInline and add newlines between the render output when making collapsible test cases)
Line 148:
columns = 'renderColumns',
rows = 'renderRows',
inline = 'renderInline',
default = 'renderDefault'
}
Line 276 ⟶ 277:
:tag('tr')
:tag('td')
:newline()
:wikitext(s)
:newline()
return tostring(root)
end
Line 370 ⟶ 373:
 
return tostring(root)
end
 
function TestCase:renderInline()
local arrow = mw.language.getContentLanguage():getArrow('forwards')
local ret = {}
for i, obj in ipairs(self.templates) do
local line = {}
line[#line + 1] = ': '
if self.options.showcode then
line[#line + 1] = obj:getInvocation('code')
line[#line + 1] = ' '
line[#line + 1] = arrow
line[#line + 1] = ' '
end
line[#line + 1] = self:getTemplateOutput(obj)
ret[#ret + 1] = table.concat(line)
end
return table.concat(ret, '\n')
end