You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a use-case where it's necessary for us to reduce the rendering strictness, specifically for variables. We allow users to define their own templates and store them. Those templates are then used later to render values with global variables provided by the customers' data which may or may not have all of the variables present. Our current implementation just renders those missing variables as an empty string.
I've tried multiple work arounds to get around this, some of which were fairly hacked together, but they all had edge cases that weren't handled properly.
I'm curious if you're open to the idea of adding a "lax" rendering mode?
The text was updated successfully, but these errors were encountered:
RyanAmos
changed the title
Open to the idea of changing supporting less strict rendering as an option?
Open to the idea of supporting less strict parsing/rendering as an option?
Jan 9, 2023
I'd be open to an outside contributor adding this if
It isn't too invasive
It doesn't dramatically affect performance
It is off by default
The first issue I see with implementing this is "where". The Runtime trait is a natural place but we build up runtimes throughout the execution of the template, stacking them on top of each other, so there is no top-level runtime to provide this behavior.
We might be able to handle a templated type that wraps the Runtime and all calls actually take this, rather than a runtime directly to ensure it gets used. It'll get a bit messy but likely would work.
I have a local branch that I believe follows all of your requirements. I could be missing something within the implementation, but I'll push up a PR to start getting feedback today.
Following up from my comment left on this issue.
I have a use-case where it's necessary for us to reduce the rendering strictness, specifically for variables. We allow users to define their own templates and store them. Those templates are then used later to render values with global variables provided by the customers' data which may or may not have all of the variables present. Our current implementation just renders those missing variables as an empty string.
I've tried multiple work arounds to get around this, some of which were fairly hacked together, but they all had edge cases that weren't handled properly.
I'm curious if you're open to the idea of adding a "lax" rendering mode?
The text was updated successfully, but these errors were encountered: