Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: packager.py

Issue 11544056: Prepared buildtools for Safari (Closed)
Patch Set: Created Oct. 31, 2013, 3:40 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « manifest.json.tmpl ('k') | packagerChrome.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packager.py
===================================================================
--- a/packager.py
+++ b/packager.py
@@ -113,6 +113,15 @@
else:
print >>sys.stderr, 'Warning: Mapped file %s doesn\'t exist' % source
+ def preprocess(self, filenames, params={}):
+ import jinja2
+ env = jinja2.Environment()
+
+ for filename in filenames:
+ env.autoescape = os.path.splitext(filename)[1].lower() in ('.html', '.xml')
+ template = env.from_string(self[filename].decode('utf-8'))
+ self[filename] = template.render(params).encode('utf-8')
+
def zip(self, outFile, sortKey=None):
zip = zipfile.ZipFile(outFile, 'w', zipfile.ZIP_DEFLATED)
names = self.keys()
« no previous file with comments | « manifest.json.tmpl ('k') | packagerChrome.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld