[Zope3-Users] Variables in reStructuredText

Klaus Bremer klaus.bremer at bmcct.de
Wed Mar 7 02:39:14 EST 2007


Just as an idea: use the python string modul for substitution.
Write in ReST:

.. figure:: path/to/image

   $title

   or

   ${caption}

and in your python code:

    theTitle = myPhoto.getTitle()
    theCaption = myPhoto.getCaption()
    theText = GetTheRestructuredTextFromMyData(...)
    theText = string.Template(theText).safe_substitute(theTitle, theCaption)

Regards
Klaus 


----Ursprüngliche Nachricht----
am: Wed, 7 Mar 2007 09:00:04 +0400
von: Yann VOTE : yannvote at yahoo.fr

>Hello,
>
>Is there a way to access attributes from a reStructuredText-rendered
>widget ?
>
>More precisely:
>
>I have a IPhoto schema which extend IImage. The fields are 'contentType'
>and 'data' from IImage, and 'title' and 'caption' which are specific to
>IPhoto. These last two fields are effectively used elsewhere in the
>application, in some page template.
>
>But now I want to show an image wraped into some reStructuredText,
>together with its title and caption. Something like the following in a
>text widget:
>
>.. figure:: path/to/image
>
>   title
>
>   caption
>
>But I can't find out how to access the title and caption attributes. Is
>this possible ? Is there another way to achieve this ?
>
>Thanks,
>
>Yann
>
>	
>
>	
>		
>___________________________________________________________________________ 
>Yahoo! Mail r?invente le mail ! D?couvrez le nouveau Yahoo! Mail et son
>interface r?volutionnaire.
>http://fr.mail.yahoo.com
>_______________________________________________
>Zope3-users mailing list
>Zope3-users at zope.org
>http://mail.zope.org/mailman/listinfo/zope3-users
>




More information about the Zope3-users mailing list