Skip to content

Jinja2's import directive isn't supported #63

@kkinder

Description

@kkinder
  • pypugjs version: 5.9.4
  • Django version: N/A
  • Python version: 3.8.1
  • Operating System: Ubuntu Linux 20.04

Description

pypugjs doesn't seem to support Jinja2's import directive.

What I Did

Consider this example:

extends "base.html"
import "forms.html" as forms
block content
  | forms.render_form(form)

That should result in this:

{% extends "base.html" %}
{% import "forms.html" as forms %}
{% block content %}forms.render_form(form){% endblock %}⏎    

However, it results in this:

{% extends "base.html" %}
<import>"forms.html" as forms</import>{% block content %}forms.render_form(form){% endblock %}

You can get around it by using {% import ... %} in the pug template, but that's not really as elegant and JetBrains will complain about it too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions