Tweak snippet_details.html to allow for text mode indentation preservation

If someone posts python code, but labels it as text- say something like thus:
```
if blah:
  print "me!"
```

dpaste was rendering that as
```
if blah
print "me!"
```

We may wish to make the snippet-rendered class have {whitespace: pre} styling;
regardless if dpaste chooses to do so, this change is necessary so any end
consumers can set the styling themselves; to support that, any extra indentation
the template adds must be suppressed.
This commit is contained in:
Brian Harring 2017-01-20 14:11:43 -08:00
parent cad8361d03
commit 14076c87e4

View file

@ -70,9 +70,11 @@
Snippet Snippet
======================================================================= --> ======================================================================= -->
{% if snippet.lexer == 'text' %} {% if snippet.lexer == 'text' %}
<div class="snippet-rendered"> {% comment %}
{{ snippet.content|linebreaksbr }} Note that the interpolation of snippet_content needs to be a single line- downstream may be
</div> using styling that converts snippet-rendered to an effective pre to preserve whitespace indentation.
{% endcomment %}
<div class="snippet-rendered">{{ snippet.content|linebreaksbr }}</div>
{% else %} {% else %}
{% include "dpaste/snippet_pre.html" %} {% include "dpaste/snippet_pre.html" %}
{% endif %} {% endif %}