[Zope] Re: [Docutils-develop] ReStructuredText now in Zope

Peter Funk pf@artcom-gmbh.de
Fri, 16 Aug 2002 11:34:21 +0200 (CEST)


Hi,

Richard Jones:
> On Fri, 16 Aug 2002 2:34 am, Dethe Elza wrote:
> > This is great!  I've been half-heartedly working on an External Method
> > so I could use reST through Zope, but this is much better.
> 
> External Methods yecch :)
> 
> 
> > My only issue now is that I use Zope Local File System extensively, for
> > keeping my documentation under CVS.  I tried a naive mapping of ZReST to
> > *.rst files, but that didn't work.  Any ideas how these can be made to
> > work together?
> 
> Sorry, I know nothing about the Local File System stuff.

First of all let me thank you all for the great work.

I believe this is only one of the many places, where **StructuredText**
has been used in Zope.  Another important place is the DTML format
attribute of DTML variables.  For example (looked up from Zope 2.5.1)
there is the module ``lib/python/DocumentTemplate/DT_vars.py``, which 
implements the DTML language construct::

	<dtml-var foobar fmt="structured-text">

This is done using the format dispatcher dictionary ``special_formats``,
which contains a reference to the following small function::

   def structured_text(v, name='(Unknown name)', md={}):
       global StructuredText
       if StructuredText is None: 
	   from StructuredText.StructuredText import HTML

       if isinstance(v,StringType): txt = v

       elif aq_base(v).meta_type in ['DTML Document','DTML Method']:
	   txt = aq_base(v).read_raw()

       else: txt = str(v)
	   
       return HTML(txt,level=3,header=0)

My idea is to add a new entry called ``restructured-text`` or 
simply ``rest`` to this dispatcher dictionary.  Yesterday I played
around with **CMFWiki** and had a very similar situation.  There is
a simple wrapper function using the same class HTML.  So for further
integration of ReST as an alternative replacement for `StructuredText`
I believe it makes sense to come up with a wrapper class, which
implements the API of the class HTML of StructuredText.

Questions
=========

* What to do with the parameters ``level`` and ``header`` within **ReST**?

* Where should we put this class?  
  Would be an extended **ZReST** Zope product the right place?

Regards, Peter
-- 
Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany
office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen, Germany)