【发布时间】:2016-06-23 04:08:12
【问题描述】:
我正在尝试打印从控制器传递的几个变量以在一行中查看。
变量的内容类似于“xyz”,其中 tag 是有效的 html 标记。
我现在做的是——
div
!= (notification.content + notification._.publishedDate.format('MMMM Do, YYYY'))
但是,这会将 div 打印在两行上。
生成的html内容是-
<div>
<p>School is closed tomorrow <a href="http://www.booking.com">link</a></p>
March 7th, 2016
</div>
另外我做不到-
p= (notification.content + notification._.publishedDate.format('MMMM Do, YYYY'))
因为输出是 HTML 格式的 -
<p><p>School is closed tomorrow&nbsp;<a href="http://www.booking.com">link</a></p>March 7th, 2016</p>
【问题讨论】:
-
我不确定您要做什么...您想将所有变量连接在 1 行上,并使用转换后的 html 标签,但内容中也有
<p>标签?因此,如果您想让它上线,您需要确保 notification.content 中没有“阻止”标签... -
是的就是这样
-
就像我说的,确保内容中没有
标记,或者在连接变量的地方设置 div 的样式并设置
p{ display: inline-block; }
标签: node.js express pug keystonejs