sebastienros / fluid

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

Parsing error when encountering numeric property used for indexer #700

Closed dustinburson closed 2 months ago

dustinburson commented 2 months ago

Hello!

I am one of the maintainers of the repository https://github.com/microsoft/FHIR-Converter which uses Liquid templates to convert data from one healthcare standard (Hl7v2, CCDA) to another (FHIR). The engine is currently based on DotLiquid and I am doing an investigation on potential performance improvements of switching the engine over to Fluid.

One issue I have hit is the data model the Hl7 message is loaded into uses string and numeric indexers. One example is below where MSH is the string indexer and 10 is the numeric indexer.

{{ firstSegments.MSH.10.Value }}

For the string indexers I have been able to build an adapter using the IFluidIndexable interface but since the numeric indexer is failing at the template parser, I haven't been able to find a solution.

I have a few work arounds, but they all require modifying the template content in some way which I am trying to avoid.

My questions are:

Thank you!

sebastienros commented 2 months ago

Quick thought before I look deeper, have you tried the indexer syntax like MSH[10] or MSH["10"] ?