Skip to content
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

block.super doesn't work with invoking template-tags #199

Open
pkozak opened this issue Apr 25, 2019 · 3 comments
Open

block.super doesn't work with invoking template-tags #199

pkozak opened this issue Apr 25, 2019 · 3 comments

Comments

@pkozak
Copy link

pkozak commented Apr 25, 2019

I have a base template like this:

    {% block css %}
      <!-- styles -->
      {% style "/assets/bulma/css/bulma.min.css" %}
      {% style "/assets/material-icons/css/material-icons.min.css" %}
      {% style "/css/screen.css" %}
    {% endblock %}

And the child template which extends block css from base.html:

{% extends 'base.html' %}

{% block css %}
    {{ block.super }}
    {% style "/css/sample.css" %}
    <!--end style-->
{% endblock %}

The result of rendering was unexpected for me :

<!-- styles -->
      
      
      
    
<link href="/css/sample.css" rel="stylesheet" type="text/css" />
<!--end style-->

As you see, block.super was replaced with content from base block css (you can see line with comment <!-- styles --> from base.html), but styles was replaced with empty lines and that's incorrect for me.

@yogthos
Copy link
Owner

yogthos commented Apr 25, 2019

The block.super tag only works for static content at the moment. I probably won't have a chance to look at adding support for this in the near future, but I am open to a PR.

@pkozak
Copy link
Author

pkozak commented Apr 26, 2019

Thank you for your proposition. It would be a great entertainment for upcoming holidays, but now I've critical project and I'm avoid wasting my time. Could you recommend me any solid alternative template-library?

@yogthos
Copy link
Owner

yogthos commented Apr 26, 2019

Hiccup is the most popular alternative, but you can also take a look at the libraries here under the "Template Lanugages" section.

If you do end up using Selmer the way to do this would be to either create a separate block, or to use an include tag with the common css in it.

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

No branches or pull requests

2 participants