diff --git a/README.md b/README.md
index 70dcda0..bdba1f1 100644
--- a/README.md
+++ b/README.md
@@ -85,6 +85,11 @@ The **if** tag has complimentary **elif** and **else** tags. There can be as man
The **eq** tag allows you to conditionally include a block of text, by comparing if two values are equal.
{{#eq Name UserName}}Hello {{Name}} !!!{{/eq}}
+
+You can also use specific values as the target value for comparison, rather than values from the model by prefixing the value with the "_" character:
+
+ Hello {{#eq User.Role _admin}}Maestro!{{#else}}{{Name}}{{/eq}}
+
The block will be printed if:
* Both values are null
@@ -97,6 +102,9 @@ The **lt** tag allows you to conditionally include a block of text, by comparing
{{Budget}}
+Again, you can use specific values as the target for the comparison parameter, by prefixing the value with the "_" character:
+
+ {{Budget}}
The block will be printed if:
* Both values are integers or doubles, and the first value is less than the second
diff --git a/mustache-sharp.test/FormatCompilerTester.cs b/mustache-sharp.test/FormatCompilerTester.cs
index 4a04ea0..f81edc7 100644
--- a/mustache-sharp.test/FormatCompilerTester.cs
+++ b/mustache-sharp.test/FormatCompilerTester.cs
@@ -1422,5 +1422,35 @@ Odd
}
#endregion
+
+
+ #region ValueIntemplateTests
+ [TestMethod]
+ public void TestCompile_CanUseStringValueInEquals()
+ {
+ FormatCompiler compiler = new FormatCompiler();
+ const string format = @"{{#eq Value _Yesterday}}Yes!{{/eq}}";
+ Generator generator = compiler.Compile(format);
+
+ string actual = generator.Render(new {ViewId = "Yesterday"});
+ string expected = "Yes!";
+ Assert.AreEqual(expected, actual, "The context variable was not toggled.");
+ }
+
+ [TestMethod]
+ public void TestCompile_CanUseNumericValueInEquals() {
+ FormatCompiler compiler = new FormatCompiler();
+ const string format = @"{{#eq Value _123.3231}}Yes!{{/eq}}";
+ Generator generator = compiler.Compile(format);
+
+
+ string actual = generator.Render(new { Value = "123.3231" });
+ string expected = "";
+ Assert.AreEqual(expected, actual, "The context variable was not toggled.");
+ }
+
+
+ #endregion
+
}
}
diff --git a/mustache-sharp/ArgumentCollection.cs b/mustache-sharp/ArgumentCollection.cs
index 97d41f8..95c7177 100644
--- a/mustache-sharp/ArgumentCollection.cs
+++ b/mustache-sharp/ArgumentCollection.cs
@@ -67,6 +67,9 @@ namespace Mustache
{
value = contextScope.Find(pair.Value.Substring(1));
}
+ else if (pair.Value.StartsWith("_")) {
+ value = pair.Value.Remove(0, 1);
+ }
else
{
value = keyScope.Find(pair.Value);