I'm trying to print out generate shipping labels, and I know how many I want. So given that I know n
, how do I print "x
of n
" for x=1 to n?
What I'm wanting to do is have an expansion template that will take n
and provide the x
and n
variables to the template I shall pass (StringTemplate is a functional-type templating language, so this sort of thing is it's strength).
Sorry about not having a structure yet, but I'm just having thinking inside the framework...
Basically, given :
$xOfn(n=3)$
I should get
1 of 3
2 of 3
3 of 3
The real template that I'd like to use is something like
<div class="label">
<div class="labelInfo">$info$</div>
<div class="item">$x$ of $n$</div>
</div>
Where I would use something like $xOfn(n=someInt,template="myTemplate")$
(the above template is called myTemplate)