Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-01-29 13:17:21 -0500
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-09-11 09:30:53 -0400
commit34f7c6bef177c494cac6cad788b0ead326ee90fa (patch)
tree914177485c5d9eeb41e1bb2d28075bfc13cd1cf5
parent6f891b7b152969447e4e7193cbfd0358dc200e79 (diff)
downloadtame-34f7c6bef177c494cac6cad788b0ead326ee90fa.tar.gz
tame-34f7c6bef177c494cac6cad788b0ead326ee90fa.tar.bz2
tame-34f7c6bef177c494cac6cad788b0ead326ee90fa.zip
_for-each-n_: Add current_n_dec
This would be better handled by better template arithmetic features, but that's for another time. * tplgen.xml (_for-each-n_): Add `current_n_dec' for caller body, which decrements `current_n` by 1 (for 0-indexed values).
-rw-r--r--core/tplgen.xml6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/tplgen.xml b/core/tplgen.xml
index d921404..ce0d699 100644
--- a/core/tplgen.xml
+++ b/core/tplgen.xml
@@ -51,11 +51,15 @@
<param-add name="@start@" value="@step@" />
</param>
+ <param name="@n_dec@" desc="Current n - 1">
+ <param-add name="@start@" value="-1" />
+ </param>
+
<!-- inefficient trick to expose @current_n@ to the body -->
<inline-template>
<for-each>
- <set current_n="@start@" />
+ <set current_n="@start@" current_n_dec="@n_dec@" />
</for-each>
<param-copy name="@values@" />