所以我在2个字段中有2个字符串列表, altText 和 imagecaption 。我把它们包裹在一个div中。我希望在循环的每次迭代中,如果在某个循环中没有内容,则使div不渲染。我该怎么办?
30 = COA
30{
wrap = <div class="case-info">|</div>
required = 1
30 = TEXT
30{
wrap = <div>|</div>
field = altText
listNum.splitChar = 10
listNum.stdWrap.data = register:SPLIT_COUNT
required = 1
}
40 < .30
40.field = imagecaption
}
html的输出是:
<div class="case-info">
<div></div>
<div></div>
</div>
答案 0 :(得分:2)
取下包裹并以这种方式试试:
30 = COA
30{
stdWrap.required = 1
stdWrap.wrap = <div class="case-info">|</div>
30 = TEXT
30{
field = altText
listNum.splitChar = 10
listNum.stdWrap.data = register:SPLIT_COUNT
trim = 1
required = 1
wrap = <div>|</div>
}
40 < .30
40.field = imagecaption
}
所以,如果有内容(required = 1)
,则仅执行换行