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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added filter to apply dynamic filters #203
Added filter to apply dynamic filters #203
Changes from 4 commits
564ccb7
f3d5843
2c411ca
e795f05
0269052
dbb5e14
da6a0cc
019d0cc
08fc21d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do these methods (
compileFilter
,compileExpression
andcompileResolvable
) have to be public?Note: if they can be internal, don't forget to reset the
Expression
protocol back to internal.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that they can be used by 3rd party extensions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ehm, do they need to be used by 3rd party extensions? Do you have a scenario where that'd be necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cant think of any now but if I needed it in
filter
then it might be needed in something else complex too. Anyway, I don't see any harm in making these methods public.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, a library should only expose the minimal surface necessary for a developer to use it. If at any point, something is missing, it can be added later on.
Maybe someone else has some thoughts on this point? @AliSoftware?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd normally agree with limiting the surface of the public API, but given all other stuff like
parse(until:)
,nextToken()
andprependToken
are alreadypublic
too, I say it's fine by me.TBH I haven't used Stencil as a library to be extended for a while now (only use case for us is StencilSwiftKit to extend Stencil), not sure there are many people using those features — main uses of this lib is probably just using it as-is to render templates, adding maybe some custom filters and that's all), that shouldn't really bother them.
BUT, if we're gonna have so much public API, then we should then definitely add doc-comments to them to explain to end users what they're supposed to be used for (especially to those not completely familiar with the concepts of a parser vs lexer etc, and proper definition of token etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea on the docs then. It took me quite a while to understand the codebase a bit, and the documentation in the code is quite sparse.