If a property (object/variable) is not provided in the model, then its value is null / blank. Is there some option that would instead keep the 'placeholder' (variable name enclosed in double curly braces)?
E.g., for below example, rather than returning
Temperature Humidity
it would return
Temperature {{intSelected}} Humidity {{intSelected}}
using Fluid;
string feature = "{% for str in stringsSelected %} {{str}} {{intSelected}} {% endfor %}";
List<string> stringsSelected = new() { "Temperature", "Humidity" };
int intSelected = 74;
string FeatureResult;
var parser = new FluidParser();
if (parser.TryParse(feature, out var template, out var error))
{
//var model = new { stringsSelected, intSelected };
var model = new { stringsSelected }; //if a property is not provided, then its value is null / blank. Can we instead keep the 'placeholder'?
var context = new TemplateContext(model);
var result = template.Render(context);
Console.WriteLine(result);
}
else
{
Console.WriteLine($"Error: {error}");
}