Commit a283c9ed authored by Julien Muchembled's avatar Julien Muchembled

Better fix of ReST transform"

This reverts commit 1b1859b9
and monkey-patch docutils instead.
parent b9ceb45e
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# #
############################################################################## ##############################################################################
import sys, types import os, sys, types
if sys.version_info < (2, 5): if sys.version_info < (2, 5):
import __builtin__, imp import __builtin__, imp
...@@ -108,3 +108,9 @@ if sys.version_info < (2, 7): ...@@ -108,3 +108,9 @@ if sys.version_info < (2, 7):
raise missing_ordereddict raise missing_ordereddict
import collections import collections
collections.OrderedDict = OrderedDict collections.OrderedDict = OrderedDict
# Workaround bad use of getcwd() in docutils.
# Required by PortalTransforms.transforms.rest
from docutils import utils
utils.relative_path = lambda source, target: os.path.abspath(target)
...@@ -2,7 +2,6 @@ from Products.PortalTransforms.interfaces import ITransform ...@@ -2,7 +2,6 @@ from Products.PortalTransforms.interfaces import ITransform
from zope.interface import implements from zope.interface import implements
from reStructuredText import HTML from reStructuredText import HTML
import sys import sys
import os
class rest: class rest:
r"""Converts from reST to HTML. r"""Converts from reST to HTML.
...@@ -58,10 +57,8 @@ class rest: ...@@ -58,10 +57,8 @@ class rest:
output_encoding = kwargs.get('output_encoding', encoding) output_encoding = kwargs.get('output_encoding', encoding)
language = kwargs.get('language', 'en') language = kwargs.get('language', 'en')
warnings = kwargs.get('warnings', None) warnings = kwargs.get('warnings', None)
rest_template = os.path.join(os.path.dirname(__file__), 'rest.template')
settings = {'documentclass': '', settings = {'documentclass': '',
'traceback': 1, 'traceback': 1,
'template' : rest_template
} }
html = HTML(orig, html = HTML(orig,
report_level=2, report_level=2,
......
%(head_prefix)s
%(head)s
%(stylesheet)s
%(body_prefix)s
%(body_pre_docinfo)s
%(docinfo)s
%(body)s
%(body_suffix)s
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