如何在swig模板中创build多行stringvariables?
我试图在swig中创build一个多行stringvariables:
{% set myVariable = " multi line string " %}
然后我login它:
{% logMyVariable(myVariable) %}
但我不明白为什么我的variables不显示在几行:
multi line string
而我期待:
multi line string
你知道我该怎么做吗?
在HTML中,当文本显示时,文本中的新行不会被渲染。 例如,这个HTML:
<p>Let's split this sentence up onto multiple lines.</p>
将会像这样渲染:
Let's split this sentence up onto multiple lines.
您可能希望将您的log
包装在<pre>
标记中 ,因为这将保留新的行(以及单词之间的多个空格,在呈现的HTML中也会被忽略):
<pre>{% logMyVariable(myVariable) %}</pre>
- AWS – nodejs SDK – CognitoIdentityServiceProvider.initiateAuth – CredentialsError:在configuration中缺less凭据
- 如何优化循环插入数据库?
- 什么authentication策略使用?
- 等待Node.js中的事件
- 是否有可能通过使用Promise.resolve返回结果在promise中使用map / filter / reduce?
- Nodejs,mongodb – 使用$ nin或$ in作为对象id或_id
- NodeJstesting用例的代码,用于每个数组的方法
- Express.js / Node.js:重要的路由顺序,并把下一个()?
- Node.JS不查询本地DNS