Module:Navbox: Difference between revisions

From Podpedia
489 bytes removed ,  5 years ago
Testing different version of module; will immediately revert if this does not produce the intended result
(The revision 38374 by Imdill3(talk) has been undone.)
(Testing different version of module; will immediately revert if this does not produce the intended result)
Line 9:
 
local args
local tableRowAdded = false
local border
local listnums = {}
Line 56 ⟶ 57:
end
 
local function processItemaddNewline(item, nowrapitemss)
if items:submatch(1, 2'^[*:;#]') ==or s:match('^{|') then
return '\n' .. items ..'\n'
-- Applying nowrap to lines in a table does not make sense.
else
-- Add newlines to compensate for trim of x in |parm=x in a template.
return '\n' .. item ..'\n's
end
end
if nowrapitems == 'yes' then
 
local lines = {}
local function addTableRow(tbl)
for line in (item .. '\n'):gmatch('([^\n]*)\n') do
-- If any other rows have already been added, then we add a 2px gutter row.
local prefix, content = line:match('^([*:;#]+)%s*(.*)')
if tableRowAdded then
if prefix and not content:match('^<span class="nowrap">') then
tbl
line = prefix .. '<span class="nowrap">' .. content .. '</span>'
end:tag('tr')
table.insert :css(lines'height', line'2px')
tbl :tag('trtd')
end
:attr('colspan',2)
item = table.concat(lines, '\n')
end
 
if item:match('^[*:;#]') then
tableRowAdded = true
return '\n' .. item ..'\n'
 
end
return itemtbl:tag('tr')
end
 
Line 85 ⟶ 86:
args.name,
mini = 1,
fontstyle = (args.basestyle or '') .. ';' .. (args.titlestyle or '') .. ';background:none transparent;border:none;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;'
})
end
Line 97 ⟶ 98:
if not args.title then return end
 
local titleRow = tbl:tagaddTableRow('tr'tbl)
 
if args.titlegroup then
Line 138 ⟶ 139:
:css('font-size', '114%')
:css('margin', '0 4em')
:wikitext(processItemaddNewline(args.title))
end
 
Line 155 ⟶ 156:
if not args.above then return end
 
addTableRow(tbl)
tbl:tag('tr')
:tag('td')
:addClass('navbox-abovebelow')
Line 163 ⟶ 164:
:attr('colspan', getAboveBelowColspan())
:tag('div')
:wikitext(processItemaddNewline(args.above, args.nowrapitems))
end
 
Line 169 ⟶ 170:
if not args.below then return end
 
addTableRow(tbl)
tbl:tag('tr')
:tag('td')
:addClass('navbox-abovebelow')
Line 177 ⟶ 178:
:attr('colspan', getAboveBelowColspan())
:tag('div')
:wikitext(processItemaddNewline(args.below, args.nowrapitems))
end
 
Line 184 ⟶ 185:
--
local function renderListRow(tbl, index, listnum)
local row = tbl:tagaddTableRow('tr'tbl)
 
if index == 1 and args.imageleft then
Line 191 ⟶ 192:
:addClass('navbox-image')
:addClass(args.imageclass)
:css('width', '1px0%') -- Minimize width
:css('padding', '0px 2px 0px 0px')
:cssText(args.imageleftstyle)
:attr('rowspan', 2 * #listnums - 1)
:tag('div')
:wikitext(processItemaddNewline(args.imageleft))
end
 
Line 207 ⟶ 208:
:addClass(args.groupclass)
:cssText(args.basestyle)
 
:css('width', args.groupwidth or '1%') -- If groupwidth not specified, minimize width
if args.groupwidth then
groupCell:css('width', args.groupwidth)
end
 
groupCell
Line 253 ⟶ 257:
:tag('div')
:css('padding', (index == 1 and args.list1padding) or args.listpadding or '0em 0.25em')
:wikitext(processItemaddNewline(listText, args.nowrapitems))
 
if index == 1 and args.image then
Line 260 ⟶ 264:
:addClass('navbox-image')
:addClass(args.imageclass)
:css('width', '1px0%') -- Minimize width
:css('padding', '0px 0px 0px 2px')
:cssText(args.imagestyle)
:attr('rowspan', 2 * #listnums - 1)
:tag('div')
:wikitext(processItemaddNewline(args.image))
end
end
Line 321 ⟶ 325:
if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end
 
for _i, cat in ipairs(getTrackingCategories()) do
builder:wikitext('[[Category:' .. cat .. ']]')
end
Line 367 ⟶ 371:
args = navboxArgs
 
for k, _v in pairs(args) do
local listnum = ('' .. k):match('^list(%d+)$')
if type(k) == 'string' then
localif listnum =then k:matchtable.insert('^listlistnums, tonumber(%d+listnum)$') end
if listnum then table.insert(listnums, tonumber(listnum)) end
end
end
table.sort(listnums)
Cookies help us deliver our services. By using our services, you agree to our use of cookies.