Browse Source

Fix case where configuration file contain no content keyword at all

pull/47/head
Louis 11 years ago
parent
commit
7b4a42ec1d
  1. 2
      songbook_core/build.py
  2. 2
      songbook_core/content/__init__.py

2
songbook_core/build.py

@ -99,7 +99,7 @@ class Songbook(object):
) )
context = self.build_config(renderer.get_variables()) context = self.build_config(renderer.get_variables())
self.contentlist = content.process_content(self.config['content'], context) self.contentlist = content.process_content(self.config.get('content', []), context)
context['render_content'] = content.render_content context['render_content'] = content.render_content
context['titleprefixkeys'] = ["after", "sep", "ignore"] context['titleprefixkeys'] = ["after", "sep", "ignore"]
context['content'] = self.contentlist context['content'] = self.contentlist

2
songbook_core/content/__init__.py

@ -101,6 +101,8 @@ def render_content(context, content):
def process_content(content, config = None): def process_content(content, config = None):
contentlist = [] contentlist = []
plugins = load_plugins() plugins = load_plugins()
if not content:
content = [["song"]]
for elem in content: for elem in content:
if isinstance(elem, basestring): if isinstance(elem, basestring):
elem = ["song", elem] elem = ["song", elem]

Loading…
Cancel
Save