Module:Archive list: Difference between revisions

m
1 revision imported: Templates and CSS files
m (1 revision imported)
m (1 revision imported: Templates and CSS files)
 
(One intermediate revision by one other user not shown)
Line 160: Line 160:
         return 1
         return 1
     end
     end
end
-- Get whether to leave a blank cell in the first row and column
-- If links start at 1, and lineNum is a round number, this aligns the first
-- column to start on a multiple of lineNum, which may be a nice round number
local function getLeaveFirstCellBlank( leaveFirstCellBlank )
    return leaveFirstCellBlank == 'yes'
      or leaveFirstCellBlank == 'y'
      or leaveFirstCellBlank == 1
end
end


Line 222: Line 231:
     table.insert(ret, "<table style=\"width: 100%; padding: 0px; text-align: center; background-color: transparent;\"><tr><td>")
     table.insert(ret, "<table style=\"width: 100%; padding: 0px; text-align: center; background-color: transparent;\"><tr><td>")
     end
     end
    if glargs.leaveFirstCellBlank then
      -- An empty first cell aligns the first column on multiples of lineNum
      table.insert(ret, sep)
      lineCounter = lineCounter + 1
    end
     for archiveNum = start, glargs.max do
     for archiveNum = start, glargs.max do
         local link = mw.ustring.format(
         local link = mw.ustring.format(
Line 267: Line 281:
     local sep = getSeparator( args.sep )
     local sep = getSeparator( args.sep )
     local lineSep = getSeparator( args.linesep )
     local lineSep = getSeparator( args.linesep )
    local leaveFirstCellBlank = getLeaveFirstCellBlank( args.leavefirstcellblank )
     local glargs = {
     local glargs = {
         start = start,
         start = start,
Line 275: Line 290:
         sep = sep,
         sep = sep,
         lineNum = lineNum,
         lineNum = lineNum,
         lineSep = lineSep
         lineSep = lineSep,
        leaveFirstCellBlank = leaveFirstCellBlank
     }
     }
     return generateLinks( glargs )
     return generateLinks( glargs )