Added function to disable template rendering abort on error #109
Conversation
make Ranger return interface{}, not reflect.Value
fix isset call with chain node argument
support interface{} values in len()
isset: return false when value is nil
isset: only check for nil on values that can be nil
make notNil a top-level function
When recovering from a panic, the runtime (state) was put back into the state pool. The state was then re-used by the next template execution. This led to the pre-crash-context (e. g. variables set on the state via Runtime.Set) being leaked into the next template execution.
|
Hi, @kabukky thanks for the contribution, can you send multiple pull requests ? |
|
Hi @jhsx Sorry, my master has diverged quite a bit by now. The relevant changes are all in this commit: I'm still not sure if this is feasible, since it might have side effects. What is your take on it? |
Changed how the state is reset after previous usage
give better out-of-range error message in index expression evaluation
|
Can you pull out kabukky@b2a337d into a new PR? |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

We are currently evaluating Jet for our projects.
One thing that is different from a lot of other template languages (e. g. Handlebars) is how Jet handles expressions that cannot be evaluated.
E. g. accessing a non-valid field value will lead to the whole template rendering process being aborted and the error being returned. Handlebars would just insert an empty string into the place of the expression.
To enable this "Handlebars"-like behavior with Jet, I've added the
abortTemplateOnErrorglobal variable that can be set from the outside viaSetAbortTemplateOnError.It works well with this template (
document.yadais not set in this case, the if comparison is also not valid):Do you see any problems with this?
Node.errorfis used in a lot of other situations that I haven't checked yet