StubbleOrg / Stubble

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

A way to globally disable HTML escaping #23

Closed elringus closed 6 years ago

elringus commented 6 years ago

Hi, Thank you for this system, it works great so far!

I have a couple questions:

  1. Is there a way to globally disable HTML escaping, so I won't have to use triple mustaches everywhere in my non-html templates? Something like overriding 'escape' function in the javascript SDK would be nice.
  2. Currently, when a tag or section is not found or is null/false an empty line is rendered. Is there a way to just not render anything instead, so that the line(s) occupied by the tag/section will be trimmed in the rendered document?
Romanx commented 6 years ago

Hi there,

It should be easy enough to add a skip html escaping flag to the render settings. I'll add it as a feature in the next release. As for the second would you mind opening a separate issue with a small reproduction case as that doesn't sound like it should be doing that? Making a separate issue will allow me to track them independently a little easier.

Thanks!

Romanx commented 6 years ago

@Elringus Hi there, i've implemented this today and should be cutting an Alpha 19 release tomorrow.

Thanks,

elringus commented 6 years ago

I've just tested it in my project and can confirm it's working. Thanks for implementing the feature so fast!

Romanx commented 6 years ago

Hey thank you for testing it @Elringus I've released this to NuGet as Alpha 19. Please let me know if you have any issues.

Thanks!

RouR commented 6 years ago

I guess It should be configurable by StubbleBuilder().Configure

Romanx commented 6 years ago

Hi @RouR, it's currently configured in a per render capacity since it doesn't affect anything to do with the representation of the template just how we output the results. Another reason for our thinking was that the option only affects this specific template and may not affect all templates so wasn't a candidate for the actual builder itself.

Would you find it more intuitive if it was on a builder level as opposed to render?

RouR commented 6 years ago

It`s good way to have ability to override default settings for special template, but I expect what all default values can be configured in one place - in method Configure