source: WAeUP_SRP/trunk/skins/waeup_default/wdrender.py @ 14086

Last change on this file since 14086 was 2024, checked in by Henrik Bettermann, 17 years ago

frontpage and srp_view now also render rest and text

File size: 903 bytes
RevLine 
[2024]1## Script (Python) "wdrender"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=value=None
8##title=
9##
10# $Id:wdrender.py 486 2006-09-06 10:09:39Z henrik $
11
12from Products.PythonScripts.standard import structured_text, newline_to_br, restructured_text
13from cgi import escape
14
15rformat = context.content_format
16rcontent = context.content
17
18if rformat == 'pre':
19    ret = '<pre>' + escape(rcontent) + '</pre>'
20elif rformat == 'rst':
21    ret = restructured_text(rcontent)
22elif rformat == 'stx':
23    ret = structured_text(value)   
24elif rformat == 'text':
25    ret = newline_to_br(escape(rcontent))
26elif rformat == 'html':
27    ret = rcontent
28else:
29    raise RuntimeError("unknown render_format '%s' for '%s'" %
30                       (rformat, context.getId()))
31
32return ret                       
Note: See TracBrowser for help on using the repository browser.