[Zope] verbatim code in ZWikiPage

John Hunter jdhunter@ace.bsd.uchicago.edu
20 May 2001 12:12:26 -0500


>>>>> "John" == John Hunter <jdhunter@ace.bsd.uchicago.edu> writes:

    John> I would like to include some verbatim code in my zwiki.  I
    John> have used the :: syntax to indicate verbatim example code,
    John> as in

Still haven't solved the problem, but perhaps I've narrowed it a bit.
It appears that the WikiNames are still recognized and converted to
links in code.  I suspect this is a feature, and not a bug.  But if
your code has '[' or ']' in certain contexts (like the code in the
OP), all hell will break loose.

I am using ZWiki 0.8.1.  In ZWikiPage.py, the function
ZWikiPage._wikilink_replace does, among many other things,         

        # strip any enclosing []'s that were used
        if re.match(bracketedexpr,m):
            m = re.sub(bracketedexpr, r'\1', m)

I suspect this is related to my problem.

I have tried to find the part of ZWikiPage that recognizes the 'code'
environment, but cannot.  For example, if I search for '::' or
'example' in ZWikiPage.py, I find nothing.  Can someone point me to
the part of the source that recognizes code environments in ZWiki?  It
seems you could fix this problem with a 'replace wiki link unless in
code' construct.

Ideally, one should be able at the least to disable the WikiLink
conversions in code mode.  The wiki poster should be able to input
code verbatim, and the reader should be able to highlight it in the
rendered html and paste it into their source document.  Since almost
all programming languages use square brackets in them, it would be
nice to preserve them in code environments.

Thanks,
John Hunter