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
pelican is not compatible with jinja2 #2442
Comments
My ad hoc change:
|
Oh, dang, this slipped through during the release 🙈 I think replacing Or maybe "just" |
Either way, we need to make changes to the template (Users using official themes have to wait until the upstream is changed ...). |
Yeah, should be |
I think #2432 should be reverted, or at least be changed to have compatibility with "%s". Personally, I do not think that there is a big difference between "%s" and "{slug}" in function of simple string substitution. It is stupid that we lose compatibility due to a trivial improvement. |
Honestly, I don't like templates doing these kind of stuff. It opens the possibility of breaking things for changes like this (which are supposedly internal). Instead, these should all be things like:
|
Can we assume that a lot of templates are doing this anyway? I was testing yesterday and got the same error, using a slightly modified version of the bootstrap3 theme. I managed to debug all the way to the template but my jinja2 skills are nil. |
I encountered something that looks similar on my own site, apologies if it's actually unrelated:
My fix was to update these lines in one of my template files:
To these (note the
Am I right in understanding that some templates will need to be updated from positional to keyword arguments for Thanks a lot to all involved in the Pelican 4.0 release, by the way. It's a great static site generator! |
Out of 124 themes in getpelican/pelican-themes , 36 refers I would consider this major breakage of backwards-compatibility. At the very least, we should add some note into current documentation / changelog, telling what is broken and how to recover from it. |
In the spirit of backwards compatibility, we can ship a monkey-patched jinja filter |
@Mirzal said:
@Mirzal: Would you like to propose some verbiage to that effect? I'd be happy to add your contributed text to the release post. |
@justinmayer sure! I would add this paragraph to release post. Personally I would put it right below "Upgrading from previous releases" header.
On changelog (if we are OK with changing changelog without releasing new version), I would change point about
|
Hmm, if |
@Mirzal: Many thanks! That's super helpful. The change log and release post are in reST format, so I converted your docs appropriately. I updated the change log via 49c77d7 and also appended the relevant notes to the release post. Once again, thank you. Much appreciated! 😄 I'll leave this issue open for now in case someone wants to implement the backwards-compatibility @avaris mentioned above. |
…ican/pelican#2442 for more information
I noticed that while using the scheme |
Status: ✔️ Fixed for me by @muellermartin comment.
1. Non-expected behaviorIf pipe: <link href="{{ FEED_DOMAIN }}/{{ CATEGORY_FEED_ATOM|format(slug=category.slug) }}" rel="alternate" type="application/atom+xml"> I get, for example: <link href="./feeds/{slug}.atom.xml" rel="alternate" type="application/atom+xml"> 2. Expected behaviorElse dot: <link href="{{ FEED_DOMAIN }}/{{ CATEGORY_FEED_ATOM.format(slug=category.slug) }}" rel="alternate" type="application/atom+xml"> I get, for example: <link href="./feeds/kira-goddess.atom.xml" rel="alternate" type="application/atom+xml"> Thanks. |
Guys, this line of my publishconf.py is causing me the error
I tried with:
but it doesn't worked. How can i solved this? here's my full publishconf.py:
|
This is due to compatibility issue with Jinja2. See here for details getpelican/pelican#2442 (comment)
Could anyone explain why format works with a dot and not with a pipe, please? I am very interested to understand why. |
@ardeidae because Jinja's By doing, |
@avaris Thanks for the explanation. So, I suppose the dot notation is accepted by jinja as python code? |
I get the impression that this issue can be closed since the relevant change has been documented in the release post and change-log. If that's not the case, please post a comment here and we can re-open this issue. |
Pelican 4.0.0 replaces
%s
in feed settings to{slug}
(on #2432), butformat
filter in Jinja2 2.10 cannot process the formatted representation ({slug}
). How can I fix it?show versions
make project
make site
The text was updated successfully, but these errors were encountered: