Mercurial > piecrust2
comparison piecrust/templating/jinjaengine.py @ 28:19f3ac27c3d5
The `date` filter now supports passing `"now"` as in Twig.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 19 Aug 2014 11:50:51 -0700 |
parents | dc72a288921f |
children | 1a30e3d7ee47 |
comparison
equal
deleted
inserted
replaced
27:105f24f490cb | 28:19f3ac27c3d5 |
---|---|
164 def get_atom_date(value): | 164 def get_atom_date(value): |
165 return strict_rfc3339.timestamp_to_rfc3339_localoffset(int(value)) | 165 return strict_rfc3339.timestamp_to_rfc3339_localoffset(int(value)) |
166 | 166 |
167 | 167 |
168 def get_date(value, fmt): | 168 def get_date(value, fmt): |
169 if value == 'now': | |
170 value = time.time() | |
169 return time.strftime(fmt, time.localtime(value)) | 171 return time.strftime(fmt, time.localtime(value)) |
170 | 172 |
171 | 173 |
172 class PieCrustHighlightExtension(Extension): | 174 class PieCrustHighlightExtension(Extension): |
173 tags = set(['highlight', 'geshi']) | 175 tags = set(['highlight', 'geshi']) |