Browse Source

Allow to render only selected elements of a song

pull/103/head
Oliverpool 9 years ago
parent
commit
51d6ecd8a7
  1. 6
      patacrep/songs/chordpro/__init__.py

6
patacrep/songs/chordpro/__init__.py

@ -27,7 +27,9 @@ class ChordproSong(Song):
'song': song, 'song': song,
} }
def render(self, output, output_format, template="song"): # pylint: disable=arguments-differ def render(self, output, output_format, content=None, template="song"): # pylint: disable=arguments-differ
if content is None:
content = self.cached['song'].content
context = { context = {
'language': self.languages[0], 'language': self.languages[0],
"path": files.relpath(self.fullpath, os.path.dirname(output)), "path": files.relpath(self.fullpath, os.path.dirname(output)),
@ -36,7 +38,7 @@ class ChordproSong(Song):
"metadata": self.data, "metadata": self.data,
"render": self._render_ast, "render": self._render_ast,
"config": self.config, "config": self.config,
"content": self.cached['song'].content, "content": content,
} }
jinjaenv = Environment(loader=FileSystemLoader(os.path.join( jinjaenv = Environment(loader=FileSystemLoader(os.path.join(
os.path.abspath(pkg_resources.resource_filename(__name__, 'data')), os.path.abspath(pkg_resources.resource_filename(__name__, 'data')),

Loading…
Cancel
Save