summaryrefslogtreecommitdiff
path: root/xhtml2odt/xhtml2odt.py
diff options
context:
space:
mode:
Diffstat (limited to 'xhtml2odt/xhtml2odt.py')
-rwxr-xr-xxhtml2odt/xhtml2odt.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/xhtml2odt/xhtml2odt.py b/xhtml2odt/xhtml2odt.py
index aa387d54e..340a980cb 100755
--- a/xhtml2odt/xhtml2odt.py
+++ b/xhtml2odt/xhtml2odt.py
@@ -1,10 +1,12 @@
#!/usr/bin/env python
+# -*- coding: utf-8 -*-
-"""
+u"""
xhtml2odt - XHTML to ODT XML transformation
===========================================
Copyright (C) 2009-2010 Aurelien Bompard
+Copyright (C) 2015 Étienne Loks
This script can convert a wiki page to the OpenDocument Text (ODT) format,
standardized as ISO/IEC 26300:2006, and the native format of office suites such
@@ -257,7 +259,10 @@ class ODTFile(object):
:rtype: str
"""
xsl_dir = os.path.join(INSTALL_PATH, 'xsl')
- xslt_doc = etree.parse(os.path.join(xsl_dir, "xhtml2odt.xsl"))
+ tmpdirxsl = os.path.join(tempfile.mkdtemp(prefix="xhtml2odt-"), 'xsl')
+ shutil.copytree(xsl_dir, tmpdirxsl)
+
+ xslt_doc = etree.parse(os.path.join(tmpdirxsl, "xhtml2odt.xsl"))
transform = etree.XSLT(xslt_doc)
xhtml = self.handle_images(xhtml)
xhtml = self.handle_links(xhtml)