My favorites
▼
|
Sign in
json-template
Minimal but powerful templating language implemented in multiple languages
Project Home
Downloads
Wiki
Issues
Source
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
63
attachment: _jsontemplate.py.patch
(641 bytes)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--- a/python/jsontemplate/_jsontemplate.py
+++ b/python/jsontemplate/_jsontemplate.py
@@ -670,6 +670,9 @@
strings too.
"""
return list(reversed(x))
+
+def _Items(data):
+ return [{'@key': k, '@value': v} for k,v in data.iteritems()]
# See http://google-ctemplate.googlecode.com/svn/trunk/doc/howto.html for more
@@ -729,6 +732,13 @@
'js-string': None,
'reverse': _Reverse,
+
+ #dict items formatter -> Used for iterating through a dictionary
+ #Usage: {.repeated section foo | items}
+ # {@key} {@value}
+ # {.end}
+ 'items': _Items,
+
}
Powered by
Google Project Hosting