Pug模板-如何将带有类作为插值的span标记添加到mixins参数中以包围一个单词,以便我可以采用不同的样式?
这是_section-headline.pug中的混合:
mixin section-headline(tagline, title, description, idSection)
section.section(id=idSection)
.container
.row.row--tablet-center
.col-xs-12.col-sm-10.col-md-12.col-lg-10
.headline
div.headline__top-line
p.headline__tagline=tagline
h1.headline__title=title
p.headline__description=description
我将其称为team.pug:
doctype html
include ./includes/global/_landing.pug
include ./includes/global/_section-headline.pug *<-- including here*
html
head
<meta charset="UTF-8">
<title>Team - Cerv PC</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/png" href="/images/favicon.png">
body
- var greenText = "<span call="type--color-green">language</span>";
+section-headline('guided by diveristy', 'We speak your '+ greenText +', 'We offer personal injury legal services in Hindi, Punjabi, and Urdu. We are happy to accommodate clients speaking other languages through the use of interpreters.', 'contact-us')
因此,我试图将带有/不带文本的span标签放置到mixin参数中,所以我只使一个单词变成绿色,但不是全部。这该怎么做?尝试了几件事,但似乎无济于事。
我尝试过!{greenText},但是当呈现为html时却显示为假
答案 0 :(得分:0)
使用
h1.headline__title !{title}
代替
h1.headline__title=title OR h1.headline__title=!{title}