Module:Navbox: Difference between revisions

1,517 bytes removed ,  11 years ago
don't need a special function for the list1 row, and fix for border=none
(fix title centering)
(don't need a special function for the list1 row, and fix for border=none)
Line 168:
-- List rows
--
function renderFirstListRowrenderListRow(tbl, listnum)
if not args.list1 then return end
local row = addTableRow(tbl)
if listnum == 1 and args.imageleft then
row
.tag('td')
Line 187 ⟶ 185:
end
if args.group1 then
local groupCell = row.tag('th')
groupCell
.attr('scope', 'row')
.addClass('navbox-group')
.addClass(args.groupclass)
.cssText(args.basestyle)
if args.groupwidth then
groupCell.css('width', args.groupwidth)
end
 
groupCell
.cssText(args.groupstyle)
.cssText(args.group1style)
.wikitext(args.group1)
end
local listCell = row.tag('td')
if args.group1 then
listCell
.css('text-align', 'left')
.css('border-left-width', '2px')
.css('border-left-style', 'solid')
else
listCell.attr('colspan', 2)
end
if not args.groupwidth then
listCell.css('width', '100%')
end
 
local evenOdd = args.evenodd or 'odd'
if args.evenodd == 'swap' then evenOdd = 'even' end
listCell
.css('padding', '0px')
.cssText(args.liststyle)
.cssText(args.oddstyle)
.cssText(args.list1style)
.addClass('navbox-list')
.addClass('navbox-' .. evenOdd)
.addClass(args.listclass)
.tag('div')
.css('padding', args.list1padding or args.listpadding or '0em 0.25em')
.newline()
.wikitext(args.list1)
 
if args.image then
row
.tag('td')
.addClass('navbox-image')
.addClass(args.imageclass)
.css('width', '0%')
.css('padding', '0px 0px 0px 2px')
.cssText(args.imagestyle)
.attr('rowspan', 2 * #listnums - 1)
.tag('div')
.newline()
.wikitext(args.image)
end
end
function renderNthListRow(tbl, listnum)
local row = addTableRow(tbl)
if args['group' .. listnum] then
local groupCell = row.tag('th')
Line 312 ⟶ 242:
.newline()
.wikitext(args['list' .. listnum])
 
if listnum == 1 and args.group1image then
row
local groupCell = row .tag('thtd')
.addClass('navbox-groupimage')
.addClass(args.groupclassimageclass)
.attrcss('scopewidth', 'row0%')
.css('text-alignpadding', 'left0px 0px 0px 2px')
.cssText(args.basestyleimagestyle)
.cssattr('widthrowspan', '0%'2 * #listnums - 1)
.tag('div')
.newline()
.cssTextwikitext(args.groupstyleimage)
end
end
 
Line 346 ⟶ 290:
renderTitleRow(tbl)
renderAboveRow(tbl)
renderFirstListRow(tbl)
-- render lists 2 through N
for i, listnum in ipairs(listnums) do
ifrenderListRow(tbl, listnum) > 1 then
renderNthListRow(tbl, listnum)
end
end
renderBelowRow(tbl)
Line 394 ⟶ 332:
.css('padding', '2px')
.node(tbl)
else -- border == 'none'
res.tagnode('div'tbl)
end
Anonymous user