Browse Source
Fix: switch from jinja2.contextfunction to jinja2.pass_context (#278)
pull/279/head
sgelis
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
3 additions and
3 deletions
-
patacrep/content/__init__.py
-
patacrep/songs/chordpro/__init__.py
|
@ -202,7 +202,7 @@ class EmptyContentList(ContentList): |
|
|
for error in errors: |
|
|
for error in errors: |
|
|
self.append_error(error) |
|
|
self.append_error(error) |
|
|
|
|
|
|
|
|
@jinja2.contextfunction |
|
|
@jinja2.pass_context |
|
|
def render(context, content): |
|
|
def render(context, content): |
|
|
"""Render the content of the songbook as a LaTeX code. |
|
|
"""Render the content of the songbook as a LaTeX code. |
|
|
|
|
|
|
|
|
|
@ -6,7 +6,7 @@ import os |
|
|
import urllib |
|
|
import urllib |
|
|
|
|
|
|
|
|
from jinja2 import Environment, FileSystemLoader, ChoiceLoader |
|
|
from jinja2 import Environment, FileSystemLoader, ChoiceLoader |
|
|
from jinja2 import contextfunction |
|
|
from jinja2 import pass_context |
|
|
import jinja2 |
|
|
import jinja2 |
|
|
|
|
|
|
|
|
from patacrep import encoding, files, pkg_datapath |
|
|
from patacrep import encoding, files, pkg_datapath |
|
@ -88,7 +88,7 @@ class ChordproSong(Song): |
|
|
raise NotImplementedError("Cannot convert to format '{}'.".format(self.output_language)) |
|
|
raise NotImplementedError("Cannot convert to format '{}'.".format(self.output_language)) |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
@contextfunction |
|
|
@pass_context |
|
|
def _render_ast(context, content): |
|
|
def _render_ast(context, content): |
|
|
"""Render ``content``.""" |
|
|
"""Render ``content``.""" |
|
|
# context is readonly: create a copy before overriding the 'content' key |
|
|
# context is readonly: create a copy before overriding the 'content' key |
|
|