[Zope3-Users] Disable raw directive in restructured text

Jonathan dev101 at magma.ca
Thu Mar 15 16:14:41 EDT 2007


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


> Hello,
> 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...


Jonathan




More information about the Zope3-users mailing list