--- a/ztfy/utils/text.py Fri Mar 05 00:20:28 2010 +0100
+++ b/ztfy/utils/text.py Tue Mar 16 01:29:07 2010 +0100
@@ -22,8 +22,11 @@
# import local interfaces
# import Zope3 packages
+from zope.app import zapi
+from zope.component import createObject
# import local packages
+from request import getRequest
def textStart(text, length, max=0):
@@ -45,3 +48,11 @@
if (index > 0) and (text_length > index + max):
return result[:index] + '…'
return text
+
+
+def textToHTML(text, renderer='zope.source.plaintext', request=None):
+ if request is None:
+ request = getRequest()
+ formatter = createObject(renderer, text)
+ renderer = zapi.queryMultiAdapter((formatter, request), name=u'')
+ return renderer.render()