Commit 7bd7e01f authored by Arnaud Fontaine's avatar Arnaud Fontaine Committed by Jérome Perrin

WIP: Why?

parent 7f3aba37
Pipeline #38341 failed with stage
in 0 seconds
import six
from Products.PortalTransforms.interfaces import ITransform
from zope.interface import implementer
from DocumentTemplate.html_quote import html_quote
......@@ -30,6 +31,7 @@ class TextPreToHTML:
raise AttributeError(attr)
def convert(self, orig, data, **kwargs):
orig = six.ensure_text(orig, errors='replace')
data.setData('<pre class="data">%s</pre>' % html_quote(orig))
return data
......
import six
from Products.PortalTransforms.interfaces import ITransform
from zope.interface import implementer
from DocumentTemplate.html_quote import html_quote
......@@ -30,6 +31,7 @@ class TextToHTML:
raise AttributeError(attr)
def convert(self, orig, data, **kwargs):
orig = six.ensure_text(orig, errors='replace')
# Replaces all line breaks with a br tag, and wraps it in a p tag.
data.setData('<p>%s</p>' % html_quote(orig.strip()).replace('\n', '<br />'))
return data
......
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