Module:Navbox: Difference between revisions
From Test Wiki
Content deleted Content added
fix title centering |
don't need a special function for the list1 row, and fix for border=none |
||
| Line 168: | Line 168: | ||
-- List rows |
-- List rows |
||
-- |
-- |
||
function |
function renderListRow(tbl, listnum) |
||
if not args.list1 then return end |
|||
local row = addTableRow(tbl) |
local row = addTableRow(tbl) |
||
if args.imageleft then |
if listnum == 1 and args.imageleft then |
||
row |
row |
||
.tag('td') |
.tag('td') |
||
| Line 187: | Line 185: | ||
end |
end |
||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
groupCell |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
if args.groupwidth then |
|||
groupCell.css('width', args.groupwidth) |
|||
| ⚫ | |||
groupCell |
|||
| ⚫ | |||
.cssText(args.group1style) |
|||
.wikitext(args.group1) |
|||
end |
|||
local listCell = row.tag('td') |
|||
if args.group1 then |
|||
listCell |
|||
| ⚫ | |||
.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) |
|||
| ⚫ | |||
.css('padding', args.list1padding or args.listpadding or '0em 0.25em') |
|||
| ⚫ | |||
.wikitext(args.list1) |
|||
if args.image then |
|||
row |
|||
.tag('td') |
|||
.addClass('navbox-image') |
|||
.addClass(args.imageclass) |
|||
| ⚫ | |||
.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 |
if args['group' .. listnum] then |
||
local groupCell = row.tag('th') |
local groupCell = row.tag('th') |
||
| Line 312: | Line 242: | ||
.newline() |
.newline() |
||
.wikitext(args['list' .. listnum]) |
.wikitext(args['list' .. listnum]) |
||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
end |
end |
||
| Line 346: | Line 290: | ||
renderTitleRow(tbl) |
renderTitleRow(tbl) |
||
renderAboveRow(tbl) |
renderAboveRow(tbl) |
||
renderFirstListRow(tbl) |
|||
-- render lists 2 through N |
|||
for i, listnum in ipairs(listnums) do |
for i, listnum in ipairs(listnums) do |
||
renderListRow(tbl, listnum) |
|||
renderNthListRow(tbl, listnum) |
|||
end |
|||
end |
end |
||
renderBelowRow(tbl) |
renderBelowRow(tbl) |
||
| Line 394: | Line 332: | ||
.css('padding', '2px') |
.css('padding', '2px') |
||
.node(tbl) |
.node(tbl) |
||
else -- border == 'none' |
|||
| ⚫ | |||
end |
end |
||