Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: Source/build/scripts/template_expander.py

Issue 236673002: Simplify whitespace handling in build/ Jinja templates (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: One more FIXME Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/build/scripts/templates/ElementFactory.cpp.tmpl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/build/scripts/template_expander.py
diff --git a/Source/build/scripts/template_expander.py b/Source/build/scripts/template_expander.py
index d06db60690aa54eb758aed2036c56b78e3fd1fef..2edb5abc9b17765dc218170a46f7ece746a5cfc4 100644
--- a/Source/build/scripts/template_expander.py
+++ b/Source/build/scripts/template_expander.py
@@ -39,7 +39,11 @@ import jinja2
def apply_template(path_to_template, params, filters=None):
dirname, basename = os.path.split(path_to_template)
path_to_templates = os.path.join(_current_dir, 'templates')
- jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader([dirname, path_to_templates]), keep_trailing_newline=True)
+ jinja_env = jinja2.Environment(
+ loader=jinja2.FileSystemLoader([dirname, path_to_templates]),
+ keep_trailing_newline=True, # newline-terminate generated files
+ lstrip_blocks=True, # so can indent control flow tags
+ trim_blocks=True) # so don't need {%- -%} everywhere
if filters:
jinja_env.filters.update(filters)
template = jinja_env.get_template(basename)
« no previous file with comments | « no previous file | Source/build/scripts/templates/ElementFactory.cpp.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698