----- Original Message ----- From: "Florian Lindner" <[EMAIL PROTECTED]>
To: <zope3-users@zope.org>
Sent: Thursday, March 15, 2007 3:46 PM
Subject: [Zope3-Users] Disable raw directive in restructured text

I'm using this code to render a rest snippet to HTML:

   def convertToHTML(self, comment):
       """ Converts a comment from restructured text to HTML. """
       text = unicode(comment.content)
       renderer = ReStructuredTextToHTMLRenderer(text, self.request)
       return renderer.render().strip()

Since the text in entered by users I want to disable the raw directive [1].
How can I do this? (only while rendering this text, not globally)

How about passing the original (ie. user-entered) ReST data to your display widget which then strips the 'raw::' string from the rest data before calling convertToHTML?

Alternatively, pass an additional arguement to convToHTML which is a flag that tells the routine whether or not to strip the raw command from the passed text string before processing it.

Seems simple, but i don't use ReST so maybe i am missing something...


Zope3-users mailing list

Reply via email to