Skip to content

Commit

Permalink
Fix issue #12
Browse files Browse the repository at this point in the history
  • Loading branch information
christopher-ramirez committed Feb 3, 2015
1 parent 24e4cb0 commit 088b93e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions secretary.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ def _render_xml(self, xml_document, **kwargs):
self.replace_images(final_xml)

return final_xml

except:
self.log.error('Error rendering template:\n%s',
xml_document.toprettyxml(), exc_info=True)
Expand Down Expand Up @@ -483,8 +482,12 @@ def render(self, template, **kwargs):
self.styles = parseString(self.files['styles.xml'])
self.manifest = parseString(self.files['META-INF/manifest.xml'])

# Render content.xml
self.content = self._render_xml(self.content, **kwargs)
# Render content.xml keeping just 'office:body' node.
rendered_content = self._render_xml(self.content, **kwargs)
self.content.getElementsByTagName('office:document-content')[0].replaceChild(
rendered_content.getElementsByTagName('office:body')[0],
self.content.getElementsByTagName('office:body')[0]
)

# Render styles.xml
self.styles = self._render_xml(self.styles, **kwargs)
Expand Down

0 comments on commit 088b93e

Please sign in to comment.