RazorEngine icon indicating copy to clipboard operation
RazorEngine copied to clipboard

Less than not supported in templates

Open jasonsultana opened this issue 5 years ago • 1 comments

I have a template with the following snippet:

if (A < B)

RazorEngine compiles this to:

if (A WriteLiteral("< B)\n            {");

This is inside a @{} Razor code block, so the less than in this case should not be treated as the start of a HTML tag.

jasonsultana avatar Feb 15 '21 19:02 jasonsultana

A messy workaround in the interim is to:

A) Move the condition into your model, by exposing a LessThan(A, B) method; or B) Inverse the condition ie if (!(A >= B))

jasonsultana avatar Feb 15 '21 19:02 jasonsultana