## Script (Python) "wdrender" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=value=None ##title= ## # $Id:wdrender.py 486 2006-09-06 10:09:39Z henrik $ from Products.PythonScripts.standard import structured_text, newline_to_br, restructured_text from cgi import escape rformat = context.content_format rcontent = context.content if rformat == 'pre': ret = '
' + escape(rcontent) + '
' elif rformat == 'rst': ret = restructured_text(rcontent) elif rformat == 'stx': ret = structured_text(value) elif rformat == 'text': ret = newline_to_br(escape(rcontent)) elif rformat == 'html': ret = rcontent else: raise RuntimeError("unknown render_format '%s' for '%s'" % (rformat, context.getId())) return ret