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

Jinja2-2.9 and Python3 generate <generator> tag #645

Closed
tk0miya opened this issue Jan 8, 2017 · 7 comments
Closed

Jinja2-2.9 and Python3 generate <generator> tag #645

tk0miya opened this issue Jan 8, 2017 · 7 comments

Comments

@tk0miya
Copy link

@tk0miya tk0miya commented Jan 8, 2017

With 2.9, 2.9.1 and 2.9.2, Jinja2 generates <generator> tag for macro having blocks.

Example code:

import sys
import jinja2
from jinja2 import Template

template = """
{%- macro hello() %}
  Hello, {% block name %}jinja2{% endblock %}!
{%- endmacro %}
{{ hello() }}
"""

Result:

Python vesion: 3.5.2 (default, Oct 11 2016, 17:23:55)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
Jinja2 vesion: 2.9.2

<generator object macro at 0x10ffe2468>

But this works fine on python2.7.

Python vesion: 2.7.13 (default, Dec 20 2016, 13:27:09)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
Jinja2 vesion: 2.9.2


  Hello, jinja2!

Note: result of 2.8 and py27, py35.

Python vesion: 2.7.13 (default, Dec 20 2016, 13:27:09)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
Jinja2 vesion: 2.8.1


  Hello, jinja2!
Python vesion: 3.5.2 (default, Oct 11 2016, 17:23:55)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
Jinja2 vesion: 2.8.1


  Hello, jinja2!
@mitsuhiko
Copy link
Member

@mitsuhiko mitsuhiko commented Jan 8, 2017

What does it even mean to have a {% block %} inside a macro O_O.

Loading

@mitsuhiko mitsuhiko closed this in 6f7fa5c Jan 8, 2017
@mitsuhiko
Copy link
Member

@mitsuhiko mitsuhiko commented Jan 8, 2017

It does the same now it did in earlier versions however I'm surprised this does something useful.

Loading

@cdeil
Copy link

@cdeil cdeil commented Jan 8, 2017

@mitsuhiko - Thanks for fixing it. Could you please make a patch release soon?

This issue is affecting other Sphinx projects, e.g. the sidebar from the Astropy docs disappeared recently and it took me some time to find this issue:
astropy/astropy#5679 (comment)
It's particularly nasty since there's no warning or error from Sphinx, but the generated HTML is corrupted.

Loading

@mitsuhiko
Copy link
Member

@mitsuhiko mitsuhiko commented Jan 8, 2017

Yes, there will be another one tonight. I just want to see if there is not anything else creeping up.

Loading

@cdeil
Copy link

@cdeil cdeil commented Jan 8, 2017

Great, thank you!

Loading

@mitsuhiko
Copy link
Member

@mitsuhiko mitsuhiko commented Jan 8, 2017

Release is out now.

Loading

@tk0miya
Copy link
Author

@tk0miya tk0miya commented Jan 9, 2017

I confirmed it works fine :-)
Thank you for quick fix!

Loading

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants