diff --git a/mustache-sharp.test/FormatCompilerTester.cs b/mustache-sharp.test/FormatCompilerTester.cs
index e035525..f11dd1f 100644
--- a/mustache-sharp.test/FormatCompilerTester.cs
+++ b/mustache-sharp.test/FormatCompilerTester.cs
@@ -1004,6 +1004,47 @@ Last";
Assert.AreEqual(expected, result, "The wrong text was generated.");
}
+ ///
+ ///
+ ///
+ [TestMethod]
+ public void TestCompile_Each_LoopOverCollectionTwice()
+ {
+ List objects = new List();
+ objects.Add(new TestObject { Name = "name1", Val = "val1" });
+ objects.Add(new TestObject { Name = "name2", Val = "val2" });
+ objects.Add(new TestObject { Name = "name3", Val = "val3" });
+
+ const string template = @"{{#each this}}
+Item Number: {{#index}}
+{{/each}}
+{{#each this}}
+Item Number: foo
+
+{{/each}}";
+
+ FormatCompiler compiler = new FormatCompiler();
+ Generator generator = compiler.Compile(template);
+ string actual = generator.Render(objects);
+
+ const string expected = @"Item Number: 0
+Item Number: 1
+Item Number: 2
+Item Number: foo
+Item Number: foo
+Item Number: foo
+";
+
+ Assert.AreEqual(expected, actual, "The wrong text was found.");
+ }
+
+ public class TestObject
+ {
+ public String Name { get; set; }
+
+ public String Val { get; set; }
+ }
+
#endregion
#region With
diff --git a/mustache-sharp.test/Properties/AssemblyInfo.cs b/mustache-sharp.test/Properties/AssemblyInfo.cs
index 7ccaa92..f03d8b1 100644
--- a/mustache-sharp.test/Properties/AssemblyInfo.cs
+++ b/mustache-sharp.test/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("0.1.2.0")]
-[assembly: AssemblyFileVersion("0.1.2.0")]
+[assembly: AssemblyVersion("0.1.3.0")]
+[assembly: AssemblyFileVersion("0.1.3.0")]
diff --git a/mustache-sharp/FormatCompiler.cs b/mustache-sharp/FormatCompiler.cs
index 27a6738..856e8cf 100644
--- a/mustache-sharp/FormatCompiler.cs
+++ b/mustache-sharp/FormatCompiler.cs
@@ -237,8 +237,7 @@ namespace Mustache
else
{
generator.AddStaticGenerators(trimmer.RecordText(leading, true, true));
- Match nextMatch = findNextTag(nextDefinition, format, formatIndex);
- ArgumentCollection arguments = getArguments(nextDefinition, nextMatch);
+ ArgumentCollection arguments = getArguments(nextDefinition, match);
InlineGenerator inlineGenerator = new InlineGenerator(nextDefinition, arguments);
generator.AddGenerator(inlineGenerator);
}
diff --git a/mustache-sharp/Properties/AssemblyInfo.cs b/mustache-sharp/Properties/AssemblyInfo.cs
index f08da59..07e6b38 100644
--- a/mustache-sharp/Properties/AssemblyInfo.cs
+++ b/mustache-sharp/Properties/AssemblyInfo.cs
@@ -34,6 +34,6 @@ using System.Runtime.CompilerServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.1.2.0")]
-[assembly: AssemblyFileVersion("0.1.2.0")]
+[assembly: AssemblyVersion("0.1.3.0")]
+[assembly: AssemblyFileVersion("0.1.3.0")]
[assembly: InternalsVisibleTo("mustache-sharp.test")]
\ No newline at end of file