RazorEngine
RazorEngine copied to clipboard
HTML Encoding not working for @helper
Hi,
It appears that values are not being encoded when inside a helper. Here is a unit test which is failing for me.
[Test]
public void TemplateService_CanParseSimpleHelperTemplate_UsingHtmlEncoding()
{
using (var service = new TemplateService())
{
const string template = "<h1>Hello @NameHelper()</h1> @helper NameHelper() { <i>@Model.String</i> }";
const string expected = "<h1>Hello <i>Matt & World</i></h1>";
var model = new { String = "Matt & World" };
string result = service.Parse(template, model, null, null);
Assert.That(result == expected, "Result does not match expected: " + result);
}
}
I would like to fix this, but I'm having trouble drilling down exactly where this occurs. Can you provide any pointers?
Thanks, Lloyd