wbond / pybars3

Handlebars.js template support for Python 3 and 2
GNU Lesser General Public License v3.0
179 stars 46 forks source link

Add whitespace control #64

Closed JGoutin closed 4 years ago

JGoutin commented 5 years ago

Add a basic whitespace control support that process it on source template before compilation.

codecov[bot] commented 5 years ago

Codecov Report

Merging #64 into master will decrease coverage by 0.25%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #64      +/-   ##
==========================================
- Coverage   92.96%   92.71%   -0.26%     
==========================================
  Files           2        2              
  Lines         455      398      -57     
  Branches       85       68      -17     
==========================================
- Hits          423      369      -54     
+ Misses         19       17       -2     
+ Partials       13       12       -1
Impacted Files Coverage Δ
pybars/_compiler.py 92.6% <100%> (-0.28%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2935a00...58f4855. Read the comment docs.

JGoutin commented 5 years ago

Also fixed the whitespace clean up around blocks that are alone on lines.

The new method use regex instead of "for" loops and also improve the performance as side effect.

danielloader commented 4 years ago

This would be great to see merged - would make my templates far cleaner.

isaacdd commented 4 years ago

Thanks! I am reviewing this today.