Last change
on this file since 4542 was
2024,
checked in by Henrik Bettermann, 17 years ago
|
frontpage and srp_view now also render rest and text
|
File size:
903 bytes
|
Rev | Line | |
---|
[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 |
|
---|
| 12 | from Products.PythonScripts.standard import structured_text, newline_to_br, restructured_text
|
---|
| 13 | from cgi import escape
|
---|
| 14 |
|
---|
| 15 | rformat = context.content_format
|
---|
| 16 | rcontent = context.content
|
---|
| 17 |
|
---|
| 18 | if rformat == 'pre':
|
---|
| 19 | ret = '<pre>' + escape(rcontent) + '</pre>'
|
---|
| 20 | elif rformat == 'rst':
|
---|
| 21 | ret = restructured_text(rcontent)
|
---|
| 22 | elif rformat == 'stx':
|
---|
| 23 | ret = structured_text(value)
|
---|
| 24 | elif rformat == 'text':
|
---|
| 25 | ret = newline_to_br(escape(rcontent))
|
---|
| 26 | elif rformat == 'html':
|
---|
| 27 | ret = rcontent
|
---|
| 28 | else:
|
---|
| 29 | raise RuntimeError("unknown render_format '%s' for '%s'" %
|
---|
| 30 | (rformat, context.getId()))
|
---|
| 31 |
|
---|
| 32 | return ret |
---|
Note: See
TracBrowser for help on using the repository browser.