sebastienros / fluid

Fluid is an open-source .NET template engine based on the Liquid template language.
MIT License
1.4k stars 177 forks source link

MemberNameStrategies. SnakeCase strategy use uppercase attribute has a bug #616

Open fan410577910 opened 8 months ago

fan410577910 commented 8 months ago
var options = new TemplateOptions();

options.MemberAccessStrategy.MemberNameStrategy = MemberNameStrategies.SnakeCase;
var model = new { ID = 12345 };
var context = new TemplateContext(model,options);

if (new FluidParser().TryParse("{{ id }}", out IFluidTemplate? template, out var error))
{
    Console.WriteLine(template.Render(context));
}

The console has no output

hishamco commented 8 months ago

The 'id' is not a snake case, but of course a bug. Could you try 'user_name` for instance