From f7071bc5449d3bfda1f9af48a223be3be86e2b9b Mon Sep 17 00:00:00 2001 From: Joseph Woodward Date: Fri, 30 Oct 2015 17:11:32 +0000 Subject: [PATCH 01/11] Fix minor error --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fb8e813..0228ae0 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ project moving again. With that in mind feel free to open issues and contribute ### NOTICE (JDiamond): I haven't used Nustache in a while and don't have enough bandwidth to responsibly maintain it. -If you depend on Nustache and want committ access, please contat me! +If you depend on Nustache and want committ access, please contact me! For a list of implementations (other than .NET) and editor plugins, see http://mustache.github.com/. From 1fd3f4e814908180add1e5e982b9db4fc67e31c5 Mon Sep 17 00:00:00 2001 From: Eli Arbel Date: Mon, 1 Feb 2016 11:25:56 +0200 Subject: [PATCH 02/11] Allow using a different encoder each render --- Nustache.Core.Tests/RenderContext_Behaviour_Support.cs | 8 +++++++- Nustache.Core/RenderContext.cs | 5 +++++ Nustache.Core/RenderContextBehaviour.cs | 2 ++ Nustache.Core/VariableReference.cs | 4 ++-- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Nustache.Core.Tests/RenderContext_Behaviour_Support.cs b/Nustache.Core.Tests/RenderContext_Behaviour_Support.cs index 5cdc2c9..49f0c99 100644 --- a/Nustache.Core.Tests/RenderContext_Behaviour_Support.cs +++ b/Nustache.Core.Tests/RenderContext_Behaviour_Support.cs @@ -54,6 +54,12 @@ public void It_does_not_throw_an_exception_when_there_is_no_data_and_the_render_ Assert.AreEqual("beforeafter", result); } - + [Test] + public void Use_custom_encoder() + { + var result = Render.StringToString("before{{foo}}after", new {foo = string.Empty}, + new RenderContextBehaviour {HtmlEncoder = text => "middle"}); + Assert.AreEqual("beforemiddleafter", result); + } } } \ No newline at end of file diff --git a/Nustache.Core/RenderContext.cs b/Nustache.Core/RenderContext.cs index ad9c508..0b314a7 100644 --- a/Nustache.Core/RenderContext.cs +++ b/Nustache.Core/RenderContext.cs @@ -30,6 +30,11 @@ public class RenderContext public string ActiveStartDelimiter { get; set; } public string ActiveEndDelimiter { get; set; } + public Encoders.HtmlEncoder HtmlEncoder + { + get { return _renderContextBehaviour.HtmlEncoder ?? Encoders.HtmlEncode; } + } + public RenderContext(Section section, object data, TextWriter writer, TemplateLocator templateLocator, RenderContextBehaviour renderContextBehaviour = null) { _sectionStack.Push(section); diff --git a/Nustache.Core/RenderContextBehaviour.cs b/Nustache.Core/RenderContextBehaviour.cs index 8c0985c..3d64f77 100644 --- a/Nustache.Core/RenderContextBehaviour.cs +++ b/Nustache.Core/RenderContextBehaviour.cs @@ -6,6 +6,8 @@ public class RenderContextBehaviour public bool RaiseExceptionOnDataContextMiss { get; set; } public bool RaiseExceptionOnEmptyStringValue { get; set; } + public Encoders.HtmlEncoder HtmlEncoder { get; set; } + public static RenderContextBehaviour GetDefaultRenderContextBehaviour() { return new RenderContextBehaviour diff --git a/Nustache.Core/VariableReference.cs b/Nustache.Core/VariableReference.cs index d205721..c9ae271 100644 --- a/Nustache.Core/VariableReference.cs +++ b/Nustache.Core/VariableReference.cs @@ -46,7 +46,7 @@ public override void Render(RenderContext context) var lambdaResult = lambda().ToString(); lambdaResult = _escaped - ? Encoders.HtmlEncode(lambdaResult.ToString()) + ? context.HtmlEncoder(lambdaResult.ToString()) : lambdaResult.ToString(); using (System.IO.TextReader sr = new System.IO.StringReader(lambdaResult)) @@ -73,7 +73,7 @@ public override void Render(RenderContext context) else if (value != null) { context.Write(_escaped - ? Encoders.HtmlEncode(value.ToString()) + ? context.HtmlEncoder(value.ToString()) : value.ToString()); } } From 31fab6382a8c04b2454d4ba1235cb70ca0bcd51d Mon Sep 17 00:00:00 2001 From: Martin Zarate Date: Thu, 31 Mar 2016 15:03:15 -0400 Subject: [PATCH 03/11] Getter for XmlNodeList objects - XmlNodeListGetter to pull from lists by index, similar to IList getter - XmlNodeListGetterFactory to create above - Tests for above. --- Nustache.Core.Tests/Describe_ValueGetter.cs | 39 +++++++++++++++++++++ Nustache.Core/ValueGetter.cs | 32 +++++++++++++++++ Nustache.Core/ValueGetterFactory.cs | 27 ++++++++++++++ 3 files changed, 98 insertions(+) diff --git a/Nustache.Core.Tests/Describe_ValueGetter.cs b/Nustache.Core.Tests/Describe_ValueGetter.cs index e3cde06..f0d7b96 100644 --- a/Nustache.Core.Tests/Describe_ValueGetter.cs +++ b/Nustache.Core.Tests/Describe_ValueGetter.cs @@ -153,6 +153,45 @@ public void It_gets_XmlNode_multiple_child_element_values_as_a_list() Assert.AreEqual("text2", elements[1].InnerText); } + [Test] + public void It_gets_single_string_values_as_string_by_Index_from_XmlNodeList() + { + XmlDocument target = new XmlDocument(); + target.LoadXml(@" + text1 + text2 + text3 +"); + var value = (string)ValueGetter.GetValue(target.DocumentElement.ChildNodes, "1"); + Assert.AreEqual("text2", value); + } + + [Test] + public void It_gets_single_node_values_as_node_by_Index_from_XmlNodeList() + { + XmlDocument target = new XmlDocument(); + target.LoadXml(@" + text1 + text2 + text3 +"); + var value = (XmlNode)ValueGetter.GetValue(target.DocumentElement.ChildNodes, "1"); + Assert.AreEqual("text2", value.InnerXml); + } + + [Test] + public void It_gets_single_CDATA_values_as_string_by_Index_from_XmlNodeList() + { + XmlDocument target = new XmlDocument(); + target.LoadXml(@" + + + +"); + var value = (string)ValueGetter.GetValue(target.DocumentElement.ChildNodes, "1"); + Assert.AreEqual("text2", value); + } + [Test] public void It_gets_ListValueByIndex_values_from_array() { diff --git a/Nustache.Core/ValueGetter.cs b/Nustache.Core/ValueGetter.cs index edbc1fd..42aca65 100644 --- a/Nustache.Core/ValueGetter.cs +++ b/Nustache.Core/ValueGetter.cs @@ -122,6 +122,38 @@ private bool TryGetStringByAttributeName(string attributeName) } } + internal class XmlNodeListIndexGetter : ValueGetter + { + private readonly XmlNodeList _target; + private readonly int _index; + private object _foundSingleValue; + + public XmlNodeListIndexGetter(XmlNodeList target, int index) + { + _target = target; + _index = index; + } + + private object GetNodeValue(XmlNode node) + { + if (node.ChildNodes.Count == 1 + && (node.ChildNodes[0].NodeType == XmlNodeType.Text || node.ChildNodes[0].NodeType == XmlNodeType.CDATA) + ) + { + return node.ChildNodes[0].Value; + } + else + { + return node; + } + } + + public override object GetValue() + { + return GetNodeValue(_target[_index]); + } + } + internal class PropertyDescriptorValueGetter : ValueGetter { private readonly object _target; diff --git a/Nustache.Core/ValueGetterFactory.cs b/Nustache.Core/ValueGetterFactory.cs index 0ce4690..a8e614a 100644 --- a/Nustache.Core/ValueGetterFactory.cs +++ b/Nustache.Core/ValueGetterFactory.cs @@ -82,6 +82,7 @@ public static class ValueGetterFactories private static readonly ValueGetterFactoryCollection _factories = new ValueGetterFactoryCollection { new XmlNodeValueGetterFactory(), + new XmlNodeListIndexGetterFactory(), new PropertyDescriptorValueGetterFactory(), new GenericDictionaryValueGetterFactory(), new DataRowGetterFactory(), @@ -112,6 +113,32 @@ public override ValueGetter GetValueGetter(object target, Type targetType, strin } } + internal class XmlNodeListIndexGetterFactory : ValueGetterFactory + { + public override ValueGetter GetValueGetter(object target, Type targetType, string name) + { + if (target is XmlNodeList) + { + var listTarget = target as XmlNodeList; + int arrayIndex; + bool parseSuccess = Int32.TryParse(name, out arrayIndex); + + /* + * There is an index as per the success of the parse, it is not greater than the count + * (minus one since index is zero referenced) or less than zero. + */ + if (parseSuccess && + !(arrayIndex > (listTarget.Count - 1)) && + !(arrayIndex < 0)) + { + return new XmlNodeListIndexGetter(listTarget, arrayIndex); + } + } + + return null; + } + } + internal class PropertyDescriptorValueGetterFactory : ValueGetterFactory { public override ValueGetter GetValueGetter(object target, Type targetType, string name) From d54281cd88e4b092af626ec2bce576fd9500a160 Mon Sep 17 00:00:00 2001 From: unarist Date: Tue, 5 Apr 2016 23:39:21 +0900 Subject: [PATCH 04/11] Fixed ArgumentException on compiling variable access to reference types --- .../Compiled_Templates_Support.cs | 14 ++++++++++++++ Nustache.Compilation/CompilePartVisitor.cs | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs index 066d965..b1cde83 100644 --- a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs +++ b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs @@ -25,6 +25,11 @@ public class SubObject public bool TestBool { get; set; } public SubObject Sub { get; set; } + + public override string ToString() + { + return "SubObject"; + } } [TestFixture] @@ -273,6 +278,15 @@ public void Missing_Properties() compiled(new TestObject { TestString = "Hello", TestBool = true }); } + [Test] + public void Member_ToString() + { + var template = Template("A template with {{Sub}}"); + var compiled = template.Compile(null); + var result = compiled(new TestObject { Sub = new SubObject() }); + Assert.AreEqual("A template with SubObject", result); + } + private Func Compiled(string text) where T : class { return Template(text).Compile(null); diff --git a/Nustache.Compilation/CompilePartVisitor.cs b/Nustache.Compilation/CompilePartVisitor.cs index 1844940..61ea25c 100644 --- a/Nustache.Compilation/CompilePartVisitor.cs +++ b/Nustache.Compilation/CompilePartVisitor.cs @@ -114,8 +114,8 @@ public void Visit(TemplateInclude include) public void Visit(VariableReference variable) { var getter = context.CompiledGetter(variable.Path); - getter = CompoundExpression.NullCheck(getter, ""); - getter = Expression.Call(getter, context.TargetType.GetMethod("ToString")); + var returnIfNotNull = Expression.Call(getter, context.TargetType.GetMethod("ToString")); + getter = CompoundExpression.NullCheck(getter, "", returnIfNotNull); if (variable.Escaped) { From 3ee84a7cf1583b6bd680904e2f17f2b20cc4c227 Mon Sep 17 00:00:00 2001 From: unarist Date: Wed, 6 Apr 2016 00:22:49 +0900 Subject: [PATCH 05/11] Fixed ArgumentException on compiling when the model has ToString() method --- .../Compiled_Templates_Support.cs | 18 ++++++++++++++++++ Nustache.Compilation/CompilePartVisitor.cs | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs index b1cde83..5059121 100644 --- a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs +++ b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs @@ -32,6 +32,15 @@ public override string ToString() } } + public class TestObjectWithToString + { + public string TestString { get; set; } + public override string ToString() + { + return ""; + } + } + [TestFixture] public class Compiled_Templates_Support { @@ -287,6 +296,15 @@ public void Member_ToString() Assert.AreEqual("A template with SubObject", result); } + [Test] + public void Model_With_ToString() + { + var template = Template("A template with {{TestString}}"); + var compiled = template.Compile(null); + var result = compiled(new TestObjectWithToString { TestString = "Hello"}); + Assert.AreEqual("A template with Hello", result); + } + private Func Compiled(string text) where T : class { return Template(text).Compile(null); diff --git a/Nustache.Compilation/CompilePartVisitor.cs b/Nustache.Compilation/CompilePartVisitor.cs index 61ea25c..f6e59e0 100644 --- a/Nustache.Compilation/CompilePartVisitor.cs +++ b/Nustache.Compilation/CompilePartVisitor.cs @@ -114,7 +114,7 @@ public void Visit(TemplateInclude include) public void Visit(VariableReference variable) { var getter = context.CompiledGetter(variable.Path); - var returnIfNotNull = Expression.Call(getter, context.TargetType.GetMethod("ToString")); + var returnIfNotNull = Expression.Call(getter, getter.Type.GetMethod("ToString", new Type[0])); getter = CompoundExpression.NullCheck(getter, "", returnIfNotNull); if (variable.Escaped) From c7e60538f706009e0aa50a1b097c28b99165090c Mon Sep 17 00:00:00 2001 From: unarist Date: Tue, 5 Apr 2016 23:39:21 +0900 Subject: [PATCH 06/11] Fixed ArgumentException on compiling variable access to reference types --- Nustache.Compilation.Tests/Compiled_Templates_Support.cs | 4 ++-- Nustache.Compilation/CompilePartVisitor.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs index 5059121..6594341 100644 --- a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs +++ b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs @@ -29,7 +29,7 @@ public class SubObject public override string ToString() { return "SubObject"; - } + } } public class TestObjectWithToString @@ -304,7 +304,7 @@ public void Model_With_ToString() var result = compiled(new TestObjectWithToString { TestString = "Hello"}); Assert.AreEqual("A template with Hello", result); } - + private Func Compiled(string text) where T : class { return Template(text).Compile(null); diff --git a/Nustache.Compilation/CompilePartVisitor.cs b/Nustache.Compilation/CompilePartVisitor.cs index f6e59e0..88ce161 100644 --- a/Nustache.Compilation/CompilePartVisitor.cs +++ b/Nustache.Compilation/CompilePartVisitor.cs @@ -115,7 +115,7 @@ public void Visit(VariableReference variable) { var getter = context.CompiledGetter(variable.Path); var returnIfNotNull = Expression.Call(getter, getter.Type.GetMethod("ToString", new Type[0])); - getter = CompoundExpression.NullCheck(getter, "", returnIfNotNull); + getter = CompoundExpression.NullCheck(getter, "", returnIfNotNull); if (variable.Escaped) { From ae40f2452666a0ec13a3ad0daabe095e96604423 Mon Sep 17 00:00:00 2001 From: unarist Date: Wed, 6 Apr 2016 00:22:49 +0900 Subject: [PATCH 07/11] Fixed ArgumentException on compiling when the model has ToString() method --- Nustache.Compilation.Tests/Compiled_Templates_Support.cs | 4 ++-- Nustache.Compilation/CompilePartVisitor.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs index 6594341..5059121 100644 --- a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs +++ b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs @@ -29,7 +29,7 @@ public class SubObject public override string ToString() { return "SubObject"; - } + } } public class TestObjectWithToString @@ -304,7 +304,7 @@ public void Model_With_ToString() var result = compiled(new TestObjectWithToString { TestString = "Hello"}); Assert.AreEqual("A template with Hello", result); } - + private Func Compiled(string text) where T : class { return Template(text).Compile(null); diff --git a/Nustache.Compilation/CompilePartVisitor.cs b/Nustache.Compilation/CompilePartVisitor.cs index 88ce161..f6e59e0 100644 --- a/Nustache.Compilation/CompilePartVisitor.cs +++ b/Nustache.Compilation/CompilePartVisitor.cs @@ -115,7 +115,7 @@ public void Visit(VariableReference variable) { var getter = context.CompiledGetter(variable.Path); var returnIfNotNull = Expression.Call(getter, getter.Type.GetMethod("ToString", new Type[0])); - getter = CompoundExpression.NullCheck(getter, "", returnIfNotNull); + getter = CompoundExpression.NullCheck(getter, "", returnIfNotNull); if (variable.Escaped) { From 366c9332c56c2073f9d045a4f3326064f6f956d6 Mon Sep 17 00:00:00 2001 From: unarist Date: Tue, 5 Apr 2016 23:39:21 +0900 Subject: [PATCH 08/11] Fixed ArgumentException on compiling variable access to reference types --- Nustache.Compilation.Tests/Compiled_Templates_Support.cs | 4 ++-- Nustache.Compilation/CompilePartVisitor.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs index 5059121..6594341 100644 --- a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs +++ b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs @@ -29,7 +29,7 @@ public class SubObject public override string ToString() { return "SubObject"; - } + } } public class TestObjectWithToString @@ -304,7 +304,7 @@ public void Model_With_ToString() var result = compiled(new TestObjectWithToString { TestString = "Hello"}); Assert.AreEqual("A template with Hello", result); } - + private Func Compiled(string text) where T : class { return Template(text).Compile(null); diff --git a/Nustache.Compilation/CompilePartVisitor.cs b/Nustache.Compilation/CompilePartVisitor.cs index f6e59e0..88ce161 100644 --- a/Nustache.Compilation/CompilePartVisitor.cs +++ b/Nustache.Compilation/CompilePartVisitor.cs @@ -115,7 +115,7 @@ public void Visit(VariableReference variable) { var getter = context.CompiledGetter(variable.Path); var returnIfNotNull = Expression.Call(getter, getter.Type.GetMethod("ToString", new Type[0])); - getter = CompoundExpression.NullCheck(getter, "", returnIfNotNull); + getter = CompoundExpression.NullCheck(getter, "", returnIfNotNull); if (variable.Escaped) { From fee70d3cedff0fc9e1cf746c8542b06f62033764 Mon Sep 17 00:00:00 2001 From: unarist Date: Wed, 6 Apr 2016 00:22:49 +0900 Subject: [PATCH 09/11] Fixed ArgumentException on compiling when the model has ToString() method --- Nustache.Compilation.Tests/Compiled_Templates_Support.cs | 4 ++-- Nustache.Compilation/CompilePartVisitor.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs index 6594341..5059121 100644 --- a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs +++ b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs @@ -29,7 +29,7 @@ public class SubObject public override string ToString() { return "SubObject"; - } + } } public class TestObjectWithToString @@ -304,7 +304,7 @@ public void Model_With_ToString() var result = compiled(new TestObjectWithToString { TestString = "Hello"}); Assert.AreEqual("A template with Hello", result); } - + private Func Compiled(string text) where T : class { return Template(text).Compile(null); diff --git a/Nustache.Compilation/CompilePartVisitor.cs b/Nustache.Compilation/CompilePartVisitor.cs index 88ce161..f6e59e0 100644 --- a/Nustache.Compilation/CompilePartVisitor.cs +++ b/Nustache.Compilation/CompilePartVisitor.cs @@ -115,7 +115,7 @@ public void Visit(VariableReference variable) { var getter = context.CompiledGetter(variable.Path); var returnIfNotNull = Expression.Call(getter, getter.Type.GetMethod("ToString", new Type[0])); - getter = CompoundExpression.NullCheck(getter, "", returnIfNotNull); + getter = CompoundExpression.NullCheck(getter, "", returnIfNotNull); if (variable.Escaped) { From 00761ae7d5f86596d213ff43ae95084c8e07f977 Mon Sep 17 00:00:00 2001 From: unarist Date: Tue, 5 Apr 2016 23:39:21 +0900 Subject: [PATCH 10/11] Fixed ArgumentException on compiling variable access to reference types --- Nustache.Compilation.Tests/Compiled_Templates_Support.cs | 4 ++-- Nustache.Compilation/CompilePartVisitor.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs index 5059121..6594341 100644 --- a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs +++ b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs @@ -29,7 +29,7 @@ public class SubObject public override string ToString() { return "SubObject"; - } + } } public class TestObjectWithToString @@ -304,7 +304,7 @@ public void Model_With_ToString() var result = compiled(new TestObjectWithToString { TestString = "Hello"}); Assert.AreEqual("A template with Hello", result); } - + private Func Compiled(string text) where T : class { return Template(text).Compile(null); diff --git a/Nustache.Compilation/CompilePartVisitor.cs b/Nustache.Compilation/CompilePartVisitor.cs index f6e59e0..88ce161 100644 --- a/Nustache.Compilation/CompilePartVisitor.cs +++ b/Nustache.Compilation/CompilePartVisitor.cs @@ -115,7 +115,7 @@ public void Visit(VariableReference variable) { var getter = context.CompiledGetter(variable.Path); var returnIfNotNull = Expression.Call(getter, getter.Type.GetMethod("ToString", new Type[0])); - getter = CompoundExpression.NullCheck(getter, "", returnIfNotNull); + getter = CompoundExpression.NullCheck(getter, "", returnIfNotNull); if (variable.Escaped) { From 5b9281fc2f0829527db15492d86192fe5f360e31 Mon Sep 17 00:00:00 2001 From: unarist Date: Wed, 6 Apr 2016 00:22:49 +0900 Subject: [PATCH 11/11] Fixed ArgumentException on compiling when the model has ToString() method --- Nustache.Compilation.Tests/Compiled_Templates_Support.cs | 4 ++-- Nustache.Compilation/CompilePartVisitor.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs index 6594341..5059121 100644 --- a/Nustache.Compilation.Tests/Compiled_Templates_Support.cs +++ b/Nustache.Compilation.Tests/Compiled_Templates_Support.cs @@ -29,7 +29,7 @@ public class SubObject public override string ToString() { return "SubObject"; - } + } } public class TestObjectWithToString @@ -304,7 +304,7 @@ public void Model_With_ToString() var result = compiled(new TestObjectWithToString { TestString = "Hello"}); Assert.AreEqual("A template with Hello", result); } - + private Func Compiled(string text) where T : class { return Template(text).Compile(null); diff --git a/Nustache.Compilation/CompilePartVisitor.cs b/Nustache.Compilation/CompilePartVisitor.cs index 88ce161..f6e59e0 100644 --- a/Nustache.Compilation/CompilePartVisitor.cs +++ b/Nustache.Compilation/CompilePartVisitor.cs @@ -115,7 +115,7 @@ public void Visit(VariableReference variable) { var getter = context.CompiledGetter(variable.Path); var returnIfNotNull = Expression.Call(getter, getter.Type.GetMethod("ToString", new Type[0])); - getter = CompoundExpression.NullCheck(getter, "", returnIfNotNull); + getter = CompoundExpression.NullCheck(getter, "", returnIfNotNull); if (variable.Escaped) {