Commit 3cfdbb16 authored by Nicolas Delaby's avatar Nicolas Delaby

workaround a Bug in LibreOffice HTML import filter.

https://bugs.freedesktop.org/show_bug.cgi?id=36080



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45265 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2c6f2883
...@@ -44,6 +44,10 @@ class HTMLToOdt: ...@@ -44,6 +44,10 @@ class HTMLToOdt:
'content': 'text/html; charset=utf-8'}) 'content': 'text/html; charset=utf-8'})
orig = html.tostring(html_node, encoding='utf-8', method='xml') orig = html.tostring(html_node, encoding='utf-8', method='xml')
# workaround a Bug in LibreOffice HTML import filter.
# https://bugs.freedesktop.org/show_bug.cgi?id=36080
orig = orig.replace('<title/>', '<title></title>')
import pdb;pdb.set_trace()
doc = OOOdCommandTransform(context, filename, orig, self.inputs[0]) doc = OOOdCommandTransform(context, filename, orig, self.inputs[0])
odt = doc.convertTo('odt') odt = doc.convertTo('odt')
if cache is not None: if cache is not None:
......
...@@ -12,6 +12,7 @@ from zLOG import LOG ...@@ -12,6 +12,7 @@ from zLOG import LOG
from Products.ERP5OOo.OOoUtils import OOoBuilder from Products.ERP5OOo.OOoUtils import OOoBuilder
import re import re
from lxml import etree from lxml import etree
from lxml import html
from lxml.etree import ParseError, Element from lxml.etree import ParseError, Element
from urllib import unquote from urllib import unquote
...@@ -193,8 +194,9 @@ class OOOdCommandTransform(commandtransform): ...@@ -193,8 +194,9 @@ class OOOdCommandTransform(commandtransform):
parent_node.append(style_node) parent_node.append(style_node)
style_node.attrib.update({'type': 'text/css'}) style_node.attrib.update({'type': 'text/css'})
parent_node.remove(css_link_tag) parent_node.remove(css_link_tag)
return etree.tostring(xml_doc, encoding='utf-8', xml_output = html.tostring(xml_doc, encoding='utf-8', method='xml')
xml_declaration=False, pretty_print=False, ) xml_output = xml_output.replace('<title/>', '<title></title>')
return xml_output
def convertTo(self, format): def convertTo(self, format):
server_proxy = OOoServerProxy(self.context) server_proxy = OOoServerProxy(self.context)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment