StubbleOrg / Stubble

Trimmed down {{mustache}} templates in .NET
Other
401 stars 58 forks source link

SetParserPipeline and ParserPipelineBuilder #56

Closed Tasteful closed 5 years ago

Tasteful commented 5 years ago

Hi,

BaseSettingsBuilder.SetParserPipeline exists today to be able to set a pipeline with own parsers, this is used in https://github.com/StubbleOrg/Stubble.Helpers project to be able to add template methods that is executed instead of inserting values for the tokens that is found. This SetParserPipeline method is little hard to work with when you have multiple extensions project that all need to modify the parser pipeline. I think this should be replaced with a builder instead, example

new RendererSettingsBuilder()
    .ConfigureParserPipeline(pipe => pipe
        .Replace(...)
        .AddAfter(...)
        .AddBefore(....)
    )
    .BuildSettings();

where the BuildSettings() is calling the ParserPipelineBuilder.Build() to build the parser pipeline.

What do you think of a change like this?

Romanx commented 5 years ago

I think this sounds like a great idea, it's a more advanced use case so I think people will understand that the order you apply these overrides will matter.

If you'd like to do the work then feel free to say and i'll assign you the issue. If not i'll mark it as help wanted and possibly get around to it myself soonish

Tasteful commented 5 years ago

I will look into this.

Romanx commented 5 years ago

That's great, please let me know if you need any help

Romanx commented 5 years ago

Thank you for your contribution @Tasteful. This has now been released on to nuget in v1.4.14.

Please let me know if you have any issues and thank you for using Stubble.