[FIX] compile of rst module descriptions to HTML

lxml (used by the html sanitizer) really does not like documents as unicode
strings with an encoding declaration (which doesn't make sense indeed), yet
docutils with output_encoding=unicode generates one (a stupid one too, says
"encoding=unicode").

Disable the xml declaration altogether when compiling rST module declarations
to HTML.
This commit is contained in:
Xavier Morel 2014-07-08 14:39:24 +02:00
parent 2859d24c5e
commit 2f3aa63617
1 changed files with 6 additions and 1 deletions

View File

@ -177,7 +177,12 @@ class module(osv.osv):
element.set('src', "/%s/static/description/%s" % (module.name, element.get('src')))
res[module.id] = lxml.html.tostring(html)
else:
overrides = dict(embed_stylesheet=False, doctitle_xform=False, output_encoding='unicode')
overrides = {
'embed_stylesheet': False,
'doctitle_xform': False,
'output_encoding': 'unicode',
'xml_declaration': False,
}
output = publish_string(source=module.description, settings_overrides=overrides, writer=MyWriter())
res[module.id] = output
return res