Add a new text format with the id structured_text to the ZMS configuration. Next create the following Python script within the root folder of your ZMS instance named renderCustomText. This script needs three parameters: key, text, REQUEST.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ## Script (Python) "renderCustomText"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=key, text, REQUEST
##title=
##
from Products.PythonScripts.standard import special_formats
try:
if key == 'text':
format = context.getObjProperty('format', REQUEST)
if format == 'structured_text':
tag = [None, None]
if text.startswith('<') and text.endswith('>'):
tag[0], text = text.split('>', 1)
text, tag[1] = text.rsplit('<', 1)
text = special_formats['restructured-text'](text)
if tag[0]:
text = '%s>%s<%s' % (tag[0], text, tag[1])
return text
except Exception, err:
return 'Error: ' + str(err)
|