Changes
Jump to navigation
Jump to search
local orphancat = 'Category:Orphan infoboxes'
local function notempty( s ) return s and s:match( '%S' ) end
local s = {}
local ttype = 'td'
if rowArgs.header then
rowArgs.data = nil
s = mw.text.split(rowArgs.header, '%[%[' .. orphancat .. '%]%]')
if notempty(s[1]) then
rowArgs.header = s[1]
else
rowArgs.header = nil
end
ttype = 'th'
elseif rowArgs.data then
s = mw.text.split(rowArgs.data, '%[%[' .. orphancat .. '%]%]')
if notempty(s[1]) then
rowArgs.data = s[1]
else
rowArgs.data = nil
end
ttype = 'td'
end
root
local s = mw.text.split(rowArgs.data, '%[%[' .. orphancat .. '%]%]') rowArgs.data = s[1]
for i = 2, #s do
if notempty(s[i]) then
if (i % 2) == 0 then
root
:wikitext(s[i])
else
local dataCell = root:tag('tr'):tag(ttype)
dataCell
:attr('colspan', 2)
:wikitext(s[i])
end
end
end
local marker = ''
marker = '[[' .. orphancat .. ']]'
Undid revision 782833995 by Jc86035 (talk) looks like this caused some serious problems, will require more testing (see, e.g, my talk page)
local origArgs
local root
local function union(t1, t2)
-- Adds a row to the infobox, with either a header cell
-- or a label/data cell combination.
if rowArgs.header then
:tag('tr')
:addClass(rowArgs.rowclass)
:done()
end
local dataCell = row:tag('td')
if not rowArgs.label then
:wikitext(rowArgs.data)
end
end
local function renderAboveRow()
if not args.above then return end
root
:tag('tr')
-- Specify the overall layout of the infobox, with special settings
-- if the infobox is used as a 'child' inside another infobox.
if args.child ~= 'yes' then
root = mw.html.create('table')
else
root = mw.html.create()
root
:wikitext(args.title)
renderTrackingCategories()
return marker .. tostring(root) .. marker
end