[Zope] Structured Text with Images -> enabled!

Danny William Adair danny@adair.net
Sun, 11 Nov 2001 15:06:51 +1300


On Sunday 11 November 2001 12:51, Oliver Keller wrote:
> Danny William Adair wrote:
> > On Thursday 08 November 2001 06:18, Oliver Keller wrote:
> >
> > Did you check the mail archives?
> > I've created an external method quite a while ago:
> > http://www.zope.org/Members/Barabbas/stx_to_html
>
> yes! but it did not work. i got some strange errors
> (i mailed them to the list, related to an older structured text topic of
> this list, but no one answered)

Most of the times, if a new thread starts, and it's not interesting for me, I 
don't follow it any further. Of course this way I miss out on some stuff. 
Sorry.

>
> >>thats it.
> >>so....am i the only human beeing who figured that out?
> >>i'm shure i'm not, but why did no one of the "big" zope
> >>freaks/programmers advised us?
> >>(im rellay _not_ into python. i can "just" read :-)
> >>and know some basic programming structures..)
> >
> > As you'll see in the external method (there's a helper class in there),
> > the trick is to choose the right base class(es). What if I need
> > "structured text with images" in one folder, and "structured text without
> > images" in another? HTMLWithImages gives you what you want, so just
> > create a new class that inherits from HTMLWithImages - details in
> > stx_to_html.py
>
> hm. but the *WithImages thinges are allready inherited.(from HTML- and
> DocumentClass)why don't use them directly?
> btw. i really just know the basics of python - so inheriting would be
> quite advanced i think :-)


See my comment in the .py-file:

-------------------------------------------------------------
# Technical Note:
# This function uses two helper classes to override the standard behavior
# of the preinstalled ...WithImages classes of the StructuredText package.
# 
# - The current Zope 2.4 (and 2.4.1b1) implementation has a little bug in
#   StructuredText.DocumentWithImages.doc_img() that prevents it from 
accepting
#   images with underscores in their URL. This has been fixed.
# 
# - The current Zope 2.4 (and 2.4.1b1) implementation of
#   StructuredText.HTMLWithImages.document() will add <html> and <body> tags
#   to your input. I expect this to be unwanted by most users, since
#   StructuredText.HTMLClass.document() - the standard rendering without 
images - 
#   doesn't do that. stx_to_html will only render "the inner part", nothing
#   that you didn't have in your stx input will be added.
-------------------------------------------------------------

I'm not sure, but I think both problems have been solved by today. If that is 
the case: yes, you could use them directly.

>
> > In general, if you don't know what you're doing, you should leave "core"
> > files just as they are.
>
> you can't say, i didn't knew what i did, in general.
> i've just chosen the simpliest way.
> but i understand what you mean.
> btw. before this modification to StructuredText.py i played around with
> the TreeTag.py to extend the dtml-tree functionality allowing to expand
> a single node by klicking a folder related text-link and not _only_ the
> +/- icons.(and added customizable +/- icons)
> therefore i really had to work with the corefile due to the "internal"
> tree-e variable restrictions.... maybe i will post this mod. in the
> future.(its really dirty, but hey... it works also!:-)
> [see left frame on www.kvstarnberg.brk.de ]

There are so many patches to the tree tag (even I made one for urlparam_expr 
- had to) that I sometimes think this thing should be taken out of the core, 
and put into the Products directory as an external - though pre-installed - 
product (like SiteAccess). The ZMI pages rely on it, but most websites don't 
use the tree tag themselves. Putting it there would make it easier and 
clearer for people to exchange it with more current or more powerful 
versions. Plus they're not scared of messing with core files.

Well, there's a new component structure underway, and these thoughts might 
become obsolete. I hope they will.

>
> > Did you take a look at http://dev.zope.org/Members/jim/StructuredTextWiki
> > ?
>
> oh yes. many times before.(many people suggested to look there) and i
> must say i really felt beeing left alone on that Wiki pages. i
> definitifly found nothing usefull especially about images in stx.
> and i don't like the Zwiki stuff itself either!

ZWiki:
De gustibus non est disputandum.
Love it or loath it, you won't get rid of it.

Content:
You didn't find anything useful? LOL

Images are an extension to the classic stx (see: 
http://www.zope.org/Documentation/Articles/STX --- Advanced Usage)

If you're off to customizing the document processor, how did you like
"http://www.zope.org/Members/jim/StructuredTextWiki/CustomizingTheDocumentProcessor" 
?

For ready-to-use recipes, I would always start in the mailing list archives.

Btw, have you seen http://structuredtext.sourceforge.net, especially the 
"directives" and "substitution" feature? Yes, this is not (yet) Zope 
"out-of-the-box" stuff...

>
> thanks anyways
> oli

Cheers,
Danny