[英]increment a value in iteration in java stringtemplate
I have my array as below in java string template: 我在java字符串模板中有如下数组:
$colors:{ color |
<p>$color.name$
}$
Output is : 输出为:
Green
Black
The output is want is: 想要的输出是:
1. Green
2. Black
How do I achieve this? 我该如何实现? How to get the incremented counter in antlr.stringtemplate ?
如何在antlr.stringtemplate中获得递增计数器?
I think this is more an HTML issue. 我认为这更多是HTML问题。
<ol>$colors:{ color |
<li>$color.name$</li>
}$
</ol>
The output: 输出:
<ol>
<li>Green</li>
<li>Black</li>
</ol>
As viewed: 如查看:
In general numbering (i. ii. iii. iv. ea) and such can be done with CSS styles, or even JavaScript in HTML. 在一般编号(i。ii。iii。iv。ea)中,可以使用CSS样式甚至HTML中的JavaScript进行编号。
You can use built-in attribute $i$
to start enumeration from one, or $i0$
- from zero. 您可以使用内置属性
$i$
从1开始枚举,或者使用$i0$
-从零开始枚举。
$colors:{ color |
<p>$i$. $color.name$
}$
Please, also see another example usage in ST3 GIT repo. 请也请参阅ST3 GIT存储库中的另一个示例用法 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.