[Zope] Re: [Docutils-develop] ReStructuredText now in Zope
Andreas Jung
Andreas Jung" <andreas@andreas-jung.com
Fri, 16 Aug 2002 15:31:09 +0200
----- Original Message -----
From: "Peter Funk" <pf@artcom-gmbh.de>
To: "Richard Jones" <rjones@ekit-inc.com>
Cc: "Dethe Elza" <delza@mac.com>; "Zope List" <zope@zope.org>;
<docutils-develop@lists.sourceforge.net>
Sent: Friday, August 16, 2002 11:34
Subject: [Zope] Re: [Docutils-develop] ReStructuredText now in Zope
>
> 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**?
level is the default level where the <Hx> tags start (the default value
is 3 - don't ask why).
header is a flag to either produce a valid HTML document header or not
(<HTML>....<HEAD>...<BODY>).
>
> * Where should we put this class?
> Would be an extended **ZReST** Zope product the right place?
If it is a product then the Products folder would be the right place.
This would allow you to do some moneky patching if necessary.
-aj