-
Notifications
You must be signed in to change notification settings - Fork 10
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
Nested blocks don't render properly #3
Comments
Hmm I think this may be unrelated to nested blocks. I think it's caused by the Block::Liquid::Block using a regex that only extracts a single character when naming the block, so there are naming collisions. I think Syntax should be /(\w+)/ instead of /(\w)+/ that seems to fix the problem for me! :) |
I've tried checking out and manually rake installing some of the forks of this repo but even those that fix this regex don't seem to solve the problems of nested tags. I'm trying to use this gem with Jekyll and some help from http://www.sameratiani.com/2011/10/22/get-jekyll-working-with-liquid-inheritance.html to make the file system work. I've got parent.html <html>
{% block content %}{% endblock %}
</html> child.html {% extends parent %}
{% block content %}
here comes foo:
{% block foo %} {% endblock %}
{% endblock %} mypage.html {% extends child %}
{% block foo %} bar {% endblock %} What i'd expect: <html>
here comes foo:
bar
</html> What I get: <html>
here comes foo:
</html>
bar For example the borntyping fork appears to fix the regex: https://github.com/borntyping/liquid-inheritance/commit/3de7f29690dc6e8af74a45efeea819d438c12a70 but it's still not working. Am I fundamentally misunderstanding django blocks here or jekyll perhaps, or is that template_load code at fault? |
FWIW I've posted a stackoverflow question on this too, on the off-chance that i've got completely the wrong end of the stick and this regex isn't actually the issue: http://stackoverflow.com/questions/13086569/jekyll-templates-using-django-like-liquid-blocks-inheritance |
I have a fix for this as soon as I get chance I will submit - is a minor change. |
Any updates on this issue @neilkinnish @davecranwell ? |
If you have a block inside of another block, it will not render properly if you then redefine it in another file.
Example!
_base.liquid:
{% block test_a %}
Top of A
{% block test_b %}
This should be replaced
{% endblock %}
Bottom of A
{% endblock %}
foo.liquid:
{% extends "base" %}
{% block test_b %}
REPLACED TEST_B
{% endblock %}
The text output should be:
Top of A
REPLACED TEST_B
Bottom of A
But instead it is:
Top of A
This should be replaced
Bottom of A
I think that the expected behavior is what the Django template system does...
The text was updated successfully, but these errors were encountered: