Module:Navbox/sandbox: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 17:
return (mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1"))
end
function requiresNewlineaddNewlines(s)
returnif (s:match('^%s*[\*:;]') or s:match('^%s*\{\|')) then
return '\n' .. s .. '\n'
else
return s
end
end
 
Line 78 ⟶ 82:
renderNavBar(titleCell)
if(requiresNewline(args.title)) then
titleCell
.tag('div')
.addClass(args.titleclass)
.css('font-size', '110%')
.newlinewikitext(addNewlines(args.title))
.wikitext(args.title)
.newline()
else
titleCell
.tag('div')
.addClass(args.titleclass)
.css('font-size', '110%')
.wikitext(args.title)
end
end
 
Line 136 ⟶ 129:
function renderAboveRow(tbl)
if not args.above then return end
 
if(requiresNewline(args.above)) then
addTableRow(tbl)
.tag('td')
.addClass('navbox-abovebelow')
.addClass(args.aboveclass)
.cssText(args.basestyle)
.cssText(args.abovestyle)
.attr('colspan', getAboveBelowColspan())
.tag('div')
.newline()
.wikitext(args.above)
.newline()
else
addTableRow(tbl)
.tag('td')
Line 157 ⟶ 138:
.attr('colspan', getAboveBelowColspan())
.tag('div')
.wikitext(addNewlines(args.above))
end
end
 
Line 164 ⟶ 144:
if not args.below then return end
 
if(requiresNewline(args.below)) then
addTableRow(tbl)
.tag('td')
.addClass('navbox-abovebelow')
.addClass(args.belowclass)
.cssText(args.basestyle)
.cssText(args.belowstyle)
.attr('colspan', getAboveBelowColspan())
.tag('div')
.newline()
.wikitext(args.below)
.newline()
else
addTableRow(tbl)
.tag('td')
Line 185 ⟶ 152:
.attr('colspan', getAboveBelowColspan())
.tag('div')
.wikitext(addNewlines(args.below))
end
end
 
Line 204 ⟶ 170:
if listnum == 1 and args.imageleft then
if(requiresNewline(args.imageleft)) then
row
.tag('td')
Line 214 ⟶ 179:
.attr('rowspan', 2 * #listnums - 1)
.tag('div')
.newlinewikitext(addNewlines(args.imageleft))
.wikitext(args.imageleft)
.newline()
else
row
.tag('td')
.addClass('navbox-image')
.addClass(args.imageclass)
.css('width', '0%')
.css('padding', '0px 2px 0px 0px')
.cssText(args.imageleftstyle)
.attr('rowspan', 2 * #listnums - 1)
.tag('div')
.wikitext(args.imageleft)
end
end
Line 275 ⟶ 226:
if isOdd then evenOdd = args.evenodd or 'odd' else evenOdd = args.evenodd or 'even' end
end
 
if(requiresNewline(args['list' .. listnum])) then
listCell
.css('padding', '0px')
Line 286 ⟶ 237:
.tag('div')
.css('padding', (listnum == 1 and args.list1padding) or args.listpadding or '0em 0.25em')
.newlinewikitext(addNewlines(args['list' .. listnum]))
.wikitext(args['list' .. listnum])
.newline()
else
listCell
.css('padding', '0px')
.cssText(args.liststyle)
.cssText(rowstyle)
.cssText(args['list' .. listnum .. 'style'])
.addClass('navbox-list')
.addClass('navbox-' .. evenOdd)
.addClass(args.listclass)
.tag('div')
.css('padding', (listnum == 1 and args.list1padding) or args.listpadding or '0em 0.25em')
.wikitext(args['list' .. listnum])
end
 
if listnum == 1 and args.image then
if(requiresNewline(args.image)) then
row
.tag('td')
Line 314 ⟶ 249:
.attr('rowspan', 2 * #listnums - 1)
.tag('div')
.newlinewikitext(addNewlines(args.image))
.wikitext(args.image)
.newline()
else
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')
.wikitext(args.image)
end
end
end