[Zope] Structured Text with Images -> enabled!

Danny William Adair danny@adair.net
Thu, 8 Nov 2001 11:14:53 +1300


On Thursday 08 November 2001 06:18, Oliver Keller wrote:
> hi folks,
>
> I just figured out how to use images in strucured-text with syntax like
> "alternative text":img:image.jpg
> Because i never read how to do that anywhere (nor on zope.org!)

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

(you can also find it under "http://www.zope.org/Products")

> i feel free to tell you that simple modification to the zope source.
>
> Goto $ZOPE/lib/python/StructurdText/ folder.
> You see some files that contain "WithImages" in their names.
> As i saw that i simply tried to tell the StructuredText.py file
> to use them, and not the others - and it wooorked.
> well now the only thing todo in StructuredText.py is:
>
> change source (around line 90 ) to:
> import HTMLWithImages, DocumentWithImages, ClassicDocumentClass
>
> and in line 96/97 to:
> Document = DocumentWithImages.DocumentWithImages()
> HTMLNG = HTMLWithImages.HTMLWithImages()
>
> 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

>
> ....or is that the way of zope => see and try !?? ;-)

:-)

In general, if you don't know what you're doing, you should leave "core" 
files just as they are.

> (i'm rather new to zope/python...)
>
> a truthful puzzled but happy
> oli keller
>
> P.S.: that worked with zope 2.4.2 and 2.5.0a2
>
> P.P.S.: i want to extend the :img syntax to accept "parameters" to
> adjust the alignment of the image. any advise/suggestion what syntax to
> use?
> what about just implementing :img-right and :img-center? thats probably
> not the way the structured text authors would go...wouldn't they?

Mmmh.

In the class that inherited all the stuff you needed to include images, you 
can add new or override existing functions to provide whatever you need on 
top of that.

Did you take a look at http://dev.zope.org/Members/jim/StructuredTextWiki ?

hth,
Danny

>
>
>
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )