223 |
223 |
224 def isodate(date): |
224 def isodate(date): |
225 '''turn a (timestamp, tzoff) tuple into an iso 8631 date and time.''' |
225 '''turn a (timestamp, tzoff) tuple into an iso 8631 date and time.''' |
226 return util.datestr(date, format='%Y-%m-%d %H:%M') |
226 return util.datestr(date, format='%Y-%m-%d %H:%M') |
227 |
227 |
|
228 def hgdate(date): |
|
229 '''turn a (timestamp, tzoff) tuple into an hg cset timestamp.''' |
|
230 return "%d %d" % date |
|
231 |
228 def nl2br(text): |
232 def nl2br(text): |
229 '''replace raw newlines with xhtml line breaks.''' |
233 '''replace raw newlines with xhtml line breaks.''' |
230 return text.replace('\n', '<br/>\n') |
234 return text.replace('\n', '<br/>\n') |
231 |
235 |
232 def obfuscate(text): |
236 def obfuscate(text): |
280 "escape": lambda x: cgi.escape(x, True), |
284 "escape": lambda x: cgi.escape(x, True), |
281 "fill68": lambda x: fill(x, width=68), |
285 "fill68": lambda x: fill(x, width=68), |
282 "fill76": lambda x: fill(x, width=76), |
286 "fill76": lambda x: fill(x, width=76), |
283 "firstline": lambda x: x.splitlines(1)[0].rstrip('\r\n'), |
287 "firstline": lambda x: x.splitlines(1)[0].rstrip('\r\n'), |
284 "tabindent": lambda x: indent(x, '\t'), |
288 "tabindent": lambda x: indent(x, '\t'), |
|
289 "hgdate": hgdate, |
285 "isodate": isodate, |
290 "isodate": isodate, |
286 "obfuscate": obfuscate, |
291 "obfuscate": obfuscate, |
287 "permissions": lambda x: x and "-rwxr-xr-x" or "-rw-r--r--", |
292 "permissions": lambda x: x and "-rwxr-xr-x" or "-rw-r--r--", |
288 "person": person, |
293 "person": person, |
289 "rfc822date": lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S"), |
294 "rfc822date": lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S"), |