Added ability to customize the resolution of context contained variables.#287
Open
blaubaer wants to merge 5 commits intoflosch:masterfrom
Open
Added ability to customize the resolution of context contained variables.#287blaubaer wants to merge 5 commits intoflosch:masterfrom
blaubaer wants to merge 5 commits intoflosch:masterfrom
Conversation
1. `NamedFieldResolver.GetNamedField(name)` and `IndexedFieldResolver.GetIndexedField(index)` interfaces 2. Struct field `pongo2:"..."` 3. Added security enforcement to never use NOT exported fields.
|
Kudos, SonarCloud Quality Gate passed!
|
Contributor
Author
|
@flosch any updates on this? 🙂 |
Owner
|
Thank you for your contribution. Please allow some more time for me to go through your PR. |
# Conflicts: # context.go # variable.go
|
Contributor
Author
|
Hi @flosch: I've updated the PR with all changes from your upstream. I would be happy if you can have a look at these changes. Keeping these PR in sync with your upstream is quite work intensive. 🙂 Cheers, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added ability to customize the resolution of context contained variables, by:
NamedFieldResolver.GetNamedField(name)andIndexedFieldResolver.GetIndexedField(index)interfacespongo2:"..."Plus: Added security enforcement to never use not exported fields.
Excerpt from the documentation
By the default sub variables are resolved by
This behavior can be customized using either struct tag "pongo2" like:
my.tmpl:
{{ myStruct.uh }} {{ myStruct.yeah }}...or by implementing
NamedFieldResolverorIndexedFieldResolver.my.tmpl:
{{ myStruct.uh }} {{ myStruct.yeah }} {{ myStruct.0 }} {{ myStruct.1 }}