mirror of
https://github.com/golang/go.git
synced 2024-09-22 10:58:58 +00:00
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
This commit is contained in:
parent
bc15b94181
commit
792eba220e
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user