[Zope] Re: [Docutils-develop] ReStructuredText now in Zope
Peter Funk
pf@artcom-gmbh.de
Thu, 15 Aug 2002 11:06:53 +0200 (CEST)
Hi,
Richard Jones wrote:
> I've thrown together a Zope interface to the docutils project's
> ReStructuredText format.
[...]
Exciting! I couldn't refuse the temptation to try this out at once.
And it works: The add menu of the ZMI displays the new object type
'ReStructuredText Document' and the HTML rendering happens as
expected.
> You'll need to install docutils too :)
Obviously. I've downloaded a docutils-snapshot.tgz on August 13th.
On my RPM-based Linux system the default Python is 2.2, but Zope 2.5.1
still recommends Python 2.1. So I did
python2.1 setup.py install
in the directory, where I untarred docutils-snapshot.tgz, which created and
populated the directory /usr/lib/python2.1/site-packages/docutils.
Works like a charme.
What I would like to do next is integrating ReST with CMFWiki.
This is a wiki clone product for Zope used within the context of
the Zope CMF, the Zope content management framework. This Product
contains a module called 'CMFWikiPage.py', which currently calls the
html_with_references() function exported by the Zope StructuredText module
to render classic structured text.
The string returned from this function is than further processed to
setup the interwiki links and such.
I will try to come up with a patch to CMFWikiPage which will than use ReST
as an alternative format (and as the default for new Wiki pages).
To aid this I would find it very useful, if either the ZReST package or
docutils could export a wrapper function implementing a very simple API
similar to this found in Zope/StructuredText/StructuredText:
def html_with_references(text, level=1, header=1)
"""
Given a string 'text' containing structured text markup
returns this 'text' rendered as HTML
"""
If such a simple API or something similar is already present either in
ZReST or in the docutils package itself, please apologize my ignorance
and give me a hint where to look for this.
Regards and many thanks, Peter
--
Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260
office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen, Germany)