I have my array as below in java string template:
$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 ?
I think this is more an HTML issue.
<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.
You can use built-in attribute $i$
to start enumeration from one, or $i0$
- from zero.
$colors:{ color |
<p>$i$. $color.name$
}$
Please, also see another example usage in ST3 GIT repo.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.