From 14076c87e499753c2cb6115ca58f940735776b93 Mon Sep 17 00:00:00 2001 From: Brian Harring Date: Fri, 20 Jan 2017 14:11:43 -0800 Subject: [PATCH] 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. --- dpaste/templates/dpaste/snippet_details.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dpaste/templates/dpaste/snippet_details.html b/dpaste/templates/dpaste/snippet_details.html index 83f71a2..b808041 100644 --- a/dpaste/templates/dpaste/snippet_details.html +++ b/dpaste/templates/dpaste/snippet_details.html @@ -70,9 +70,11 @@ Snippet ======================================================================= --> {% if snippet.lexer == 'text' %} -
- {{ snippet.content|linebreaksbr }} -
+ {% comment %} + Note that the interpolation of snippet_content needs to be a single line- downstream may be + using styling that converts snippet-rendered to an effective pre to preserve whitespace indentation. + {% endcomment %} +
{{ snippet.content|linebreaksbr }}
{% else %} {% include "dpaste/snippet_pre.html" %} {% endif %}