Comments (5)
I'm wondering if something like this would work:
def eval(tag, context, options) do
current_stack_level = context.stack_level
context = %{context | stack_level: current_stack_level + 1}
{result, new_context} = case do_eval(tag, context, options) do
{text, context} ->
{text, context}
text when is_binary(text) ->
{[text: text], context}
text ->
{text, context}
end
new_context = %{new_context | stack_level: current_stack_level}
{result, new_context}
end
And we just trust that tags are passing Context around?
If people add custom tags that don't pass the Context around then there is not much we can do to protect them?
And we change the render
tag to pass the stack_level
maybe through options
? Solid.render(..., stack_level: context.stack_level)
What do you think?
The process solution could work if we maybe used the Process dictionary or something else like an ets table? But it feels hacky as you said
from solid.
@edgurgel do you have any idea on this?
When using render tag, it's hard to track nested tag. And we cannot use Context to carry nested tag level because some tag render does not pass context to inner scope.
Another thought is put nested level value in current process, but I think it's kind of hack
from solid.
If people add custom tags that don't pass the Context around then there is not much we can do to protect them?
Can't the Solig.Tag
behaviour be used to at least clarify this expectation?
from solid.
@Jcambass yeah definitely worth documenting that!
from solid.
@edgurgel I think passing stack_level
along with context
is good idea.
Regarding custom tag, user should protect themselves
from solid.
Related Issues (20)
- Include tag? HOT 3
- Possible to tell if a tag doesn't get a value? HOT 2
- render with HOT 1
- Publish v0.13 HOT 2
- Add strict_filters option
- render for
- Add base64 filters
- Add replace_last and remove_last filters
- Custom tags in for loops not rendering HOT 2
- ArgumentError when using `contains` if `:contains` hasn't been used. HOT 2
- Iterator variables not available to custom tag HOT 1
- Pass options to custom tag HOT 2
- Error when define custom parser with only one tag HOT 1
- break and continue with whitespace control issue HOT 2
- increment bug HOT 1
- Use filter in boolean expression HOT 1
- Set up a benchmark suite
- Improve error message HOT 7
- basic Filesystem usage syntax HOT 15
- Passing render options to Custom Filters HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solid.