"మాడ్యూల్:Navbox" కూర్పుల మధ్య తేడాలు

minor whitespace: trim trailing spaces; tabs --> spaces
imported>Edokter
(Revert border-spacing; collapses cells in hand-build navboxes.)
(minor whitespace: trim trailing spaces; tabs --> spaces)
-- This module implements {{Navbox}}
--
 
local p = {}
 
:css('height', '2px')
:tag('td')
:attr('colspan',2)
end
 
tableRowAdded = true
 
return tbl:tag('tr')
end
-- Depending on the presence of the navbar and/or show/hide link, we may need to add a spacer div on the left
-- or right to keep the title centered.
local spacerSide = nil
 
if args.navbar == 'off' then
-- No navbar, and client wants no spacer, i.e. wants the title to be shifted to the left. If there's
-- also no show/hide link, then we need a spacer on the right to achieve the left shift.
if args.state == 'plain' then spacerSide = 'right' end
 
titleCell:wikitext(navbar{
args.name,
mini = 1,
fontstyle = (args.basestyle or '') .. ';' .. (args.titlestyle or '') .. ';background:none transparent;border:none;'
})
end
 
-- Render the spacer div.
if spacerSide then
local function renderTitleRow(tbl)
if not args.title then return end
 
local titleRow = addTableRow(tbl)
 
:wikitext(args.titlegroup)
end
 
local titleCell = titleRow:tag('th'):attr('scope', 'col')
 
if args.titlegroup then
titleCell
:css('width', '100%')
end
 
local titleColspan = 2
if args.imageleft then titleColspan = titleColspan + 1 end
if args.image then titleColspan = titleColspan + 1 end
if args.titlegroup then titleColspan = titleColspan - 1 end
 
titleCell
:cssText(args.basestyle)
:addClass('navbox-title')
:attr('colspan', titleColspan)
 
renderNavBar(titleCell)
 
:wikitext(addNewline(args.below))
end
 
--
-- List rows
local function renderListRow(tbl, listnum)
local row = addTableRow(tbl)
 
if listnum == 1 and args.imageleft then
row
:wikitext(addNewline(args.imageleft))
end
 
if args['group' .. listnum] 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['group' .. listnum .. 'style'])
:wikitext(args['group' .. listnum])
end
 
local listCell = row:tag('td')
 
if args['group' .. listnum] then
listCell
:css('text-align', 'left')
listCell:attr('colspan', 2)
end
 
if not args.groupwidth then
listCell:css('width', '100%')
end
 
local isOdd = (listnum % 2) == 1
local rowstyle = args.evenstyle
if isOdd then rowstyle = args.oddstyle end
 
local evenOdd
if args.evenodd == 'swap' then
 
local function needsHorizontalLists()
if border == 'child' or border == 'subgroup' or args.tracking == 'no' then return false end
 
local listClasses = {'plainlist', 'hlist', 'hlist hnum', 'hlist hwrap', 'hlist vcard', 'vcard hlist', 'hlist vevent'}
for i, cls in ipairs(listClasses) do
local subpage = title.subpageText
if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end
 
for i, cat in ipairs(getTrackingCategories()) do
builder:wikitext('[[Category:' .. cat .. ']]')
end
end
:addClass(args.state or 'autocollapse')
end
 
tbl:css('border-spacing', 0)
if border == 'subgroup' or border == 'child' or border == 'none' then
end
tbl:cssText(args.innerstyle)
 
renderTitleRow(tbl)
renderAboveRow(tbl)
for i, listnum in ipairs(listnums) do
renderListRow(tbl, listnum)
end
renderBelowRow(tbl)
 
return tbl
end
function p._navbox(navboxArgs)
args = navboxArgs
 
for k, v in pairs(args) do
local listnum = ('' .. k):match('^list(%d+)$')
end
table.sort(listnums)
 
border = trim(args.border or args[1] or '')
 
:node(tbl)
end
 
renderTrackingCategories(res)
 
return tostring(res)
end
 
function p.navbox(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
args = getArgs(frame, {wrappers = 'Template:Navbox'})
_ = args["group" .. tostring(i)]
_ = args["list" .. tostring(i)]
end
_ = args.below
 
return p._navbox(args)
end
 
return p
"https://te.wikipedia.org/wiki/ప్రత్యేక:MobileDiff/1387481" నుండి వెలికితీశారు