Latest revision |
Your text |
Line 183: |
Line 183: |
| tablerows = 'renderRows', | | tablerows = 'renderRows', |
| inline = 'renderInline', | | inline = 'renderInline', |
| cells = 'renderCells',
| |
| default = 'renderDefault' | | default = 'renderDefault' |
| } | | } |
Line 575: |
Line 574: |
| end | | end |
| return table.concat(ret, '\n') | | return table.concat(ret, '\n') |
| end
| |
|
| |
| function TestCase:renderCells()
| |
| local root = mw.html.create()
| |
| local dataRow = root:tag('tr')
| |
| dataRow
| |
| :css('vertical-align', 'top')
| |
| :addClass(self.options.class)
| |
| :cssText(self.options.style)
| |
|
| |
| -- Row header
| |
| if self.options.rowheader then
| |
| dataRow:tag('th')
| |
| :attr('scope', 'row')
| |
| :newline()
| |
| :wikitext(self.options.rowheader or self:message('row-header'))
| |
| end
| |
| -- Caption
| |
| if self.options.showcaption then
| |
| dataRow:tag('th')
| |
| :attr('scope', 'row')
| |
| :newline()
| |
| :wikitext(self.options.caption or self:message('columns-header'))
| |
| end
| |
|
| |
| -- Show code
| |
| if self.options.showcode then
| |
| dataRow:tag('td')
| |
| :newline()
| |
| :wikitext(self:getInvocation('code'))
| |
| end
| |
|
| |
| -- Template output
| |
| for i, obj in ipairs(self.templates) do
| |
| if self.options.output == 'nowiki+' then
| |
| dataRow:tag('td')
| |
| :newline()
| |
| :wikitext(self.options.before)
| |
| :wikitext(self:getTemplateOutput(obj))
| |
| :wikitext(self.options.after)
| |
| :wikitext('<pre style="white-space: pre-wrap;">')
| |
| :wikitext(mw.text.nowiki(self.options.before or ""))
| |
| :wikitext(mw.text.nowiki(self:getTemplateOutput(obj)))
| |
| :wikitext(mw.text.nowiki(self.options.after or ""))
| |
| :wikitext('</pre>')
| |
| elseif self.options.output == 'nowiki' then
| |
| dataRow:tag('td')
| |
| :newline()
| |
| :wikitext(mw.text.nowiki(self.options.before or ""))
| |
| :wikitext(mw.text.nowiki(self:getTemplateOutput(obj)))
| |
| :wikitext(mw.text.nowiki(self.options.after or ""))
| |
| else
| |
| dataRow:tag('td')
| |
| :newline()
| |
| :wikitext(self.options.before)
| |
| :wikitext(self:getTemplateOutput(obj))
| |
| :wikitext(self.options.after)
| |
| end
| |
| end
| |
|
| |
|
| |
| return tostring(root)
| |
| end | | end |
|
| |
|