node.js 在 Jade 中创建内联元素的简洁方法是什么
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10953326/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is a concise way to create inline elements in Jade
提问by jwerre
I like to put all my inline elements in a single line.
我喜欢将所有内联元素放在一行中。
<ul>
<li><a>click<span>here</span><strong>!</strong></a></li>
Wondering if there's a better way to create inline elements in Jade than this:
想知道是否有比这更好的方法在 Jade 中创建内联元素:
ul
li
a(href="#") click
span here
strong !
This get's a little closer but I'm not sure how to add the span and strong tags without breaking the lines.
这有点接近,但我不确定如何在不破坏线条的情况下添加跨度和强标签。
ul
li: a(href='#') click
span ...
This obviously isn't a super big problem but it's a little annoying that I can't put inline elements inline. Thanks for the help
这显然不是一个大问题,但我不能将内联元素内联,这有点烦人。谢谢您的帮助
回答by pfirpfel
Since version 1.0, jade supports inline tags:
从 1.0 版本开始, jade 支持内联标签:
#[tag(attribute='value') inner stuff]
In your case that would be:
在你的情况下,这将是:
ul
li #[a(href="#") click #[span here #[strong !]]]
回答by marcus hall
Ran into this today myself. Found a way to do this in jade using the pipe. Here is my example wrapping a strong tag inside a p element.
今天我自己遇到了这个。找到了一种使用管道在玉中做到这一点的方法。这是我在 ap 元素中包装一个强标签的示例。
p.some-class
strong This Renders Strong
|This renders normal
回答by Michelle Tilley
I also struggled with this a while back; the only answer I found is to just use HTML.
不久前我也为此苦苦挣扎;我找到的唯一答案是只使用 HTML。
ul
li: a(href='#') click<span>here</span><strong>!</strong>

