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

Unified Diff: packager.py

Issue 11544056: Prepared buildtools for Safari (Closed)
Patch Set: Addressed comments Created Oct. 30, 2013, 5:22 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 | « imageConversion.py ('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,25 @@
else:
print >>sys.stderr, 'Warning: Mapped file %s doesn\'t exist' % source
+ def preprocess(self, filenames, params={}):
+ import jinja2
+
+ env = jinja2.Environment(
+ # TODO: Make the first run page generated on all platforms and get
+ # rid of the HTML comment syntax, wrapped around the jinja syntax.
+ block_start_string='<!-- {%',
+ block_end_string='%} -->',
+ variable_start_string='<!-- {{',
+ variable_end_string='}} -->',
+ comment_start_string='<-- {#',
+ comment_end_string='#} -->'
+ )
+
+ for filename in filenames:
+ env.autoescape = os.path.splitext(filename) 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 | « imageConversion.py ('k') | packagerChrome.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld