summaryrefslogtreecommitdiff
path: root/coverage/htmlfiles
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-02-15 15:27:36 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-02-15 15:27:36 -0500
commit339f3402f1e18c2175a90d168c707a7dcbd966e4 (patch)
tree91e0bbb49bb5a95a958bdc1314f1fdbe2cc5c2e4 /coverage/htmlfiles
parent7e10f782544e6f628c53f6ac64d510d0e2fef0af (diff)
downloadpython-coveragepy-git-339f3402f1e18c2175a90d168c707a7dcbd966e4.tar.gz
Use templite's whitespace slurping to avoid post-processing the HTML
Diffstat (limited to 'coverage/htmlfiles')
-rw-r--r--coverage/htmlfiles/pyfile.html14
1 files changed, 11 insertions, 3 deletions
diff --git a/coverage/htmlfiles/pyfile.html b/coverage/htmlfiles/pyfile.html
index fb8e131e..b8336760 100644
--- a/coverage/htmlfiles/pyfile.html
+++ b/coverage/htmlfiles/pyfile.html
@@ -71,13 +71,21 @@
<table>
<tr>
<td class="linenos">
- {% for line in lines %}
+ {% for line in lines -%}
<p id="n{{line.number}}" class="{{line.class}}"><a href="#n{{line.number}}">{{line.number}}</a></p>
{% endfor %}
</td>
<td class="text">
- {% for line in lines %}
- <p id="t{{line.number}}" class="{{line.class}}">{% if line.annotate %}<span class="annotate short">{{line.annotate}}</span><span class="annotate long">{{line.annotate_long}}</span>{% endif %}{{line.html}}<span class="strut">&nbsp;</span></p>
+ {# These are the source lines, which are very sensitive to whitespace. #}
+ {# The `{ # - # }` below are comments which slurp up the following space. #}
+ {% for line in lines -%}
+ <p id="t{{line.number}}" class="{{line.class}}">{#-#}
+ {% if line.annotate -%}
+ <span class="annotate short">{{line.annotate}}</span>{#-#}
+ <span class="annotate long">{{line.annotate_long}}</span>{#-#}
+ {% endif -%}
+ {{line.html}}<span class="strut">&nbsp;</span>{#-#}
+ </p>
{% endfor %}
</td>
</tr>