[Zope] ZWiki/Structured Text formatting surprise

Jim Fulton jim@digicool.com
Tue, 11 Jul 2000 09:43:35 -0400


Stephen Harrison wrote:
> 
> Jim Fulton wrote:
> >
> > Chris Withers wrote:
> > >
> > > Jim Fulton wrote:
> > > > I suggest that, since this appeared in a code snippit to begin
> > > > with, it should have been written as:
> > > >
> > > >   blah blah '(_.None,_,foo)' blah blah
> > >
> > > I don't format my code like that ;-)
> >
> > I'm not sure what the ';)' refers to, but single quotes are
> > the correct way to indicate literal code in structured text.
> 
> That seems to be a rather inappropriate character to quote code with.
> 
> You can't quote any of the vast reams of code which uses quotes, such
> as:
> 
> REQUEST.set('id', 'value')
> 
> or any other similar code.

I'm open to a different quoting convention.

Note that for basic Python code, you can simply 
switch the quotes, as in:

 'REQUEST.set("id", "value")'

but, of course, this doesn't work for DTML.

> As an aside, I just tried, in
> http://www.zope.org/Wikis/zope-edu/SandBox, quoting the code:
> 
> <dtml-call "REQUEST.set('id', 'value')">
> 
> It didn't work, so I then tried
> 
> <dtml-call "REQUEST.set(id, value)">
> 
> which also didn't work,

This is due to the fact that StructuredText has a 
bug in the handling of inline code. It failes to 
HTML-quote the contents.  This can be fixed, 
but you still can't quote:

  <dtml-var "REQUEST.set('id', 'value')">

> but it did work if I quoted it by escaping the
> following paragraph using the :: syntax.

This doesn't "escape" the following paragraph, it makes it
a literal example. StructuredText *does* properly quote
non-inline examples.
 
> This indicated that the 'some code' functionality is in some way broken,
> since it doesn't happen before executing any dtml which might be on the
> page.

Yup. This is not a fatal flaw in itself, as it can be fixed. 
Still, the DTML bit above is problemantic.  

A number of people have complained about the use os single quotes
for in-line code. One possibel alternative is to use ``code''.
See http://www.zope.org/Members/jim/StructuredTextWiki/CustomizingTheDocumentProcessor

Jim

--
Jim Fulton           mailto:jim@digicool.com   Python Powered!        
Technical Director   (888) 344-4332            http://www.python.org  
Digital Creations    http://www.digicool.com   http://www.zope.org    

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.