[Zope-dev] the right way to do wiki in zope ?
Simon Michael
simon@joyful.com
20 Aug 1999 12:45:13 -0700
In another thread, Anthony wrote:
> Question: Can we make ZClasses directly on ZPT?
Ditto. If not, I wondered if one could actually hack wiki
functionality on there using nothing but DTML. I'm not yet convinced
you couldn't.
Zclasses - mindbending stuff. I did some experimenting on my local
server, and here's where I'm at. I made a Zclass called WikiDTMLPage,
based on DTML Document.
I gave it an index_html method which translates words which match the
wiki link pattern to relative hyperlinks, this way:
<dtml-var "_.ts_regex.gsub(
'\([A-Z]+[a-z]+[A-Z][A-Za-z]*\|[A-Z][A-Z]+[a-z][A-Za-z]*\|_[\\\w.:_]+_\)',
'<A HREF=\\1>\\1</a>', data)
">
data is a zclass property I added; I'd rather use the DTML document's
existing data attribute but couldn't find the right syntax.
I added ts_regex to the DTML namespace - DC, is there any reason not
to provide ts_regex or re to DTML users ? Regexps are darn useful.
This allows you to create & edit wiki pages, displays the links, but
doesn't help you create new pages of course. A helper external method
for this class seems like a good way to go.
> Once I fix up the namespace mangling that Zope is doing (and which
> prevents freezing it - python is already frozen) I'll whip up a ZikiSpace.
Excellent.
-Simon