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

Unified Diff: packager.py

Issue 11544056: Prepared buildtools for Safari (Closed)
Patch Set: Made first run page always generated, fix absolute URLs for Safari during build, introduced browser… Created Oct. 31, 2013, 10:48 a.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') | packagerSafari.py » ('J')
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') | packagerSafari.py » ('J')

Powered by Google App Engine
This is Rietveld