</script> <!-- End of javascript -->
<head>
<body>
<div id="container">
<h2> GREEn Quiz
Survey Question {{q.snum}} </h2>
<!-- It appears that {{q.snum}} isn't being used-->
<div class="question">
<span id = qspan>
{{surv.text}}
</span>
<br>
<br>
<span id = m_info>
{{'Hello \n World'|linebreaks}}
</span>
</div>
<div id="ready_set_go" class "gq">
</div>
<div id="Back_Button" class "Back">
</div>
<div id="debug" data-gameid="{{g.id}}"></div>
</div>
</body>
</html>
这是输出
<p>Hello \n World</p>
答案 0 :(得分:0)
@SustainRayne在这种情况下,您可以创建一个自定义标签,例如:
@register.filter(name="multiline_break")
@stringfilter
def multiline_break(value):
return mark_safe(value.replace("\\n", "<br>"))