Browse files

Merge pull request #92 from hpvb/master

Fix a problem with HeadingAnchors to not write out html as xml
  • Loading branch information...
2 parents e4daeee + af332e6 commit 50c9405f430c28f04deaa9d1c15e494f3289d1a4 @mythmon committed Nov 8, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 wok/contrib/hooks.py
View
9 wok/contrib/hooks.py
@@ -57,7 +57,14 @@ def __call__(self, page):
heading.set('id', name)
sio_destination = StringIO()
- tree.write(sio_destination)
+
+ # Use the extension of the template to determine the type of document
+ if page.template.filename.endswith(".html") or page.filename.endswith(".htm"):
+ logging.debug('[HeadingAnchors] outputting {0} as HTML'.format(page))
+ tree.write(sio_destination, method='html')
+ else:
+ logging.debug('[HeadingAnchors] outputting {0} as XML'.format(page))
+ tree.write(sio_destination)
page.rendered = sio_destination.getvalue()

0 comments on commit 50c9405

Please sign in to comment.