Skip to content

refactor: Don't require explicitly pushing JinjavaInterpreter when using it directly#1285

Open
jasmith-hs wants to merge 1 commit intomasterfrom
dont-require-pushing-interpreter
Open

refactor: Don't require explicitly pushing JinjavaInterpreter when using it directly#1285
jasmith-hs wants to merge 1 commit intomasterfrom
dont-require-pushing-interpreter

Conversation

@jasmith-hs
Copy link
Contributor

Previously, anytime that you wanted to use JinjavaInterpreter#render or JinjavaInterpreter#parse directly, you'd need to push the interpreter onto the ThreadLocal stack.

This PR moves the logic that pushes the current interpreter to instead be done inside of JinjavaInterpreter#render rather than within Jinjava#renderForResult to simplify the usage pattern.

As part of doing this, I'm removing the direct dependency on JinjavaInterpreter.getCurrent() from parsing by moving the WhitespaceControlParser to be injected in the constructor, similar to TokenScannerSymbols.

Part of the reason why I'm doing this is because I'm going to make JinjavaBeanELResolver require a current JinjavaInterpreter in a 3.0 release of Jinjava and by pushing automatically, I can help make that more seamless for anyone that may be using a JinjavaInterpreter directly as opposed to using a Jinjava

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant