Changeset 1415
- Timestamp:
- 03/15/08 17:22:02
- Files:
-
- HTTP/WikiRevisionService.lua (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
HTTP/WikiRevisionService.lua
r1414 r1415 26 26 local FormatDateTime = WikiService.FormatDateTime 27 27 local Path = WikiService.Path 28 local Today = WikiService.Today 29 local Yesterday = WikiService.Yesterday 30 local ThisWeek = WikiService.ThisWeek 28 31 29 32 local math = require( 'math' ) … … 104 107 end 105 108 109 local function TimeTitle( aTime ) 110 local aTitle = FormatDate( aTime ) 111 112 if Today( aTime ) then 113 aTitle = ( 'Today — %s' ):format( aTitle ) 114 elseif Yesterday( aTime ) then 115 aTitle = ( 'Yesterday — %s' ):format( aTitle ) 116 elseif ThisWeek( aTime ) then 117 aTitle = ( 'Last few days — %s' ):format( aTitle ) 118 end 119 120 return aTitle 121 end 122 106 123 local function Variation( aContent ) 107 124 local aPreviousVersion = aContent.previousVersion … … 115 132 local aDescription = ( '%d%%' ):format( aVariation, aPreviousSize, aSize, aDifference ) 116 133 117 if math.abs( aVariation ) == 0 then 134 if aVariation > 0 then 135 aDescription = ( '+%s' ):format( aDescription ) 136 elseif aVariation == 0 then 118 137 aDescription = ( '±%s' ):format( aDescription ) 119 138 end … … 148 167 for _, anEntry in ipairs( someEntries ) do 149 168 local anEntryTemplate = aTemplate[ 'entries' ] 150 local aTime = anEntry.time151 local aDate = os.date( '!*t', aTime )152 local aTitle = FormatDate( aTime )153 169 154 170 anEntryTemplate[ 'description' ] = Encode( Description( #anEntry.items ) ) 155 anEntryTemplate[ 'title' ] = Encode( aTitle)171 anEntryTemplate[ 'title' ] = Encode( TimeTitle( anEntry.time ) ) 156 172 157 173 for _, aContent in ipairs( anEntry.items ) do