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

Multiple include pug files #58

Open
bdikici opened this issue Mar 29, 2020 · 1 comment
Open

Multiple include pug files #58

bdikici opened this issue Mar 29, 2020 · 1 comment

Comments

@bdikici
Copy link

bdikici commented Mar 29, 2020

  • pypugjs version: 5.9.1
  • Django version: 3.0.4
  • Python version: 3.6.0
  • Operating System: Ubuntu Linux

Description

Hey everyone,

I have this following setup:

-- templates
--external
--a.pug
--b.pug
index.pug
layout.pug

layout.pug:

doctype html
head
  block title
  block externalLinks
html
    body
        h1 test

index.pug:

extends layout

include ./external/a.pug
include ./external/b.pug

block title
    meta(charset='UTF-8')
    title Django test website

block externalLinks
    +a()
    +b()

a.pug:

mixin a()
      link(href='http://cdn.pydata.org/bokeh/release/bokeh-2.0.0.min.css' rel='stylesheet')

b.pug:

mixin b()
      link(href='http://cdn.pydata.org/bokeh/release/bokeh-tables-2.0.0.min.css' rel='stylesheet' type='text/css')

The issue i am facing is that i cannot include more than one pug file. Without including b.pug everything works fine. However once b.pug is included I get a TemplateSyntactError

What I Did


Request Method: | GET
-- | --
http://127.0.0.1:8000/
3.0.4
TemplateSyntaxError
Macro 'b' is not defined
/home/bd/anaconda2/lib/python3.6/site-packages/pypugjs/ext/django/templatetags.py in do_usemacro, line 198
/home/bd/anaconda2/bin/python
3.6.0
['/home/bd/Documents/test/mydjango',  '/home/bd/anaconda2/lib/python36.zip',  '/home/bd/anaconda2/lib/python3.6',  '/home/bd/anaconda2/lib/python3.6/lib-dynload',  '/home/bd/.local/lib/python3.6/site-packages',  '/home/bd/anaconda2/lib/python3.6/site-packages']
Sun, 29 Mar 2020 02:37:41 +0000

Error during template rendering

In template /home/bd/Documents/test/mydjango/templates/index.pug, error at line 15
@andrewminer
Copy link

I just ran into the issue that the extends keyword isn't supported. Without seeing what's referred to by "Error during template rendering", one can't be entirely sure, but I'd guess you're running into the same problem I did. If you want to double-check, you can "flatten" out your index.pug to move the layout inline, and try again.

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

No branches or pull requests

2 participants