toddams / RazorLight

Template engine based on Microsoft's Razor parsing engine for .NET Core
Apache License 2.0
1.52k stars 259 forks source link

@if statements not rendering/Are they supported? #434

Closed daharmon closed 3 years ago

daharmon commented 3 years ago

Describe the bug if I have a valid c# razor string - @if (true == true) { <div> test </div> } it will display the if statement text instead of just "test".

To Reproduce Insert the above text into this statement var engine = new RazorLightEngineBuilder().UseEmbeddedResourcesProject(typeof(Program)).UseMemoryCachingProvider().Build(); string renderedTemplate = await engine.CompileRenderStringAsync(cacheName, rzString, new {test = "test"});

Expected behavior I would expect <div>test</div> to be returned from the renderstring function

Information (please complete the following information):

daharmon commented 3 years ago

Sorry, our code was to blame. We were erroneously encoding @ signs to keep email addresses from have issues with an older razor templating product.