Permalink
Browse files

Make previews get rendered.

  • Loading branch information...
1 parent 569c3c7 commit 8aa2f662f9a7a2ba61d2749740337de4982e5d7c @mythmon committed Mar 26, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 wok/page.py
View
@@ -91,24 +91,27 @@ def from_file(cls, path, options, engine, renderer=renderers.Plain):
if len(splits) == 1:
page.original = splits[0]
page.meta = {}
+ page.original_preview = ''
elif len(splits) == 2:
header = splits[0]
page.meta = yaml.load(header)
page.original = splits[1]
+ page.original_preview = page.meta.get('preview', '')
elif len(splits) >= 3:
header = splits[0]
page.meta = {}
page.original = '\n'.join(splits[1:])
- page.meta['preview'] = splits[1]
+ page.original_preview = splits[1]
page.meta.update(yaml.load(header))
logging.debug('Got preview')
page.build_meta()
page.engine.run_hook('page.render.pre', page)
page.meta['content'] = page.renderer.render(page.original)
+ page.meta['preview'] = page.renderer.render(page.original_preview)
page.engine.run_hook('page.render.post', page)
return page

0 comments on commit 8aa2f66

Please sign in to comment.