Commit 792eba22 authored by David Symonds's avatar David Symonds

Fix .alternates execution: it was skipping every second token.

R=r
APPROVED=r
DELTA=13  (11 added, 0 deleted, 2 changed)
OCL=34081
CL=34081
parent bc15b941
......@@ -738,7 +738,7 @@ func (t *Template) executeRepeated(r *repeatedElement, st *state) {
// .alternates between elements
if !first && r.altstart >= 0 {
for i := r.altstart; i < r.altend; i++ {
for i := r.altstart; i < r.altend; {
i = t.executeElement(i, newst)
}
}
......@@ -758,7 +758,7 @@ func (t *Template) executeRepeated(r *repeatedElement, st *state) {
// .alternates between elements
if !first && r.altstart >= 0 {
for i := r.altstart; i < r.altend; i++ {
for i := r.altstart; i < r.altend; {
i = t.executeElement(i, newst)
}
}
......
......@@ -187,6 +187,17 @@ var tests = []*Test {
out: "this should appear: empty field\n"
},
&Test{
in: "{.repeated section pdata }\n"
"{item}\n"
"{.alternates with}\n"
"is\nover\nmultiple\nlines\n"
"{.end}\n",
out: "ItemNumber1\n"
"is\nover\nmultiple\nlines\n"
"ItemNumber2\n"
},
&Test{
in: "{.section pdata }\n"
"{.repeated section @ }\n"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment