pyjade icon indicating copy to clipboard operation
pyjade copied to clipboard

Mixins with blocks do not currently work with HTML parser; made what looks like a fix

Open vbuterin opened this issue 13 years ago • 2 comments

Here's my fix (only changes to pyjade/ext/html.py required)

http://pastebin.com/QZU7QcAV

The code also fixes a smaller problem - as things stand, if you have a mixin with one argument then that argument gets evaluated to an int or string, and not an iterable - what you actually want is a one-element array. I fixed this on line 75.

The basic test case:

mixin container(ide)
    .container(id=ide)
        .translucentFrame
        .contentFrame
        block

+container(123)
      h1 ololo

vbuterin avatar Mar 31 '13 22:03 vbuterin

Your fix modifies the html pyjade extension, but uses jinja2 template tags inside visitCodeBlock. Why are you trying to modify the html extension instead of jinja2?

syrusakbary avatar Apr 01 '13 09:04 syrusakbary

Ack, sorry about that. Removed the jinja2 tags, those weren't intentional. I'm trying to modify the html extension because I want to use pyjade to directly produce HTML code - is there some better already existing way to do this?

vbuterin avatar Apr 01 '13 10:04 vbuterin