Skip to content

Commit 180e541

Browse files
author
Anatol Broder
committedDec 18, 2015
Merge pull request #68 from jnvsor/hrpre
Fix inconsistancy with final blank line per pre
2 parents dab26c8 + dd5563b commit 180e541

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
 

‎src/compress.liquid

+8
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,17 @@
8585
{% if _pres.size != 0 %}
8686
{% if site.compress_html.blanklines %}
8787
{% assign _lines = _pres.last | split: _LINE_FEED %}
88+
{% assign _lastchar = _pres.last | split: "" | last %}
89+
{% assign _outerloop = forloop %}
8890
{% capture _pres_after %}
8991
{% for _line in _lines %}
9092
{% assign _trimmed = _line | split: " " | join: " " %}
93+
{% if forloop.last and _lastchar == _LINE_FEED %}
94+
{% unless _outerloop.last %}
95+
{{ _LINE_FEED }}
96+
{% endunless %}
97+
{% continue %}
98+
{% endif %}
9199
{% if _trimmed != empty or forloop.last %}
92100
{% unless forloop.first %}
93101
{{ _LINE_FEED }}

‎test/expected/blanklines/blanklines.html

+4
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,9 @@
2929
</pre><pre>
3030

3131
</pre>
32+
<pre>
33+
34+
35+
</pre>
3236
</body>
3337
</html>

‎test/source/blanklines/blanklines.html

+13
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@
3838

3939
</pre>
4040

41+
42+
43+
44+
<pre>
45+
46+
47+
</pre>
48+
4149
</body>
4250

4351
</html>
52+
53+
54+
55+
56+

0 commit comments

Comments
 (0)
Please sign in to comment.