[Zope] Structured Text with Images in regular Zope?

Jochen Knuth J.Knuth@ipro.de
Wed, 30 May 2001 13:28:54 +0200


Hi Mike,

Mike Renfro wrote:
> 
> I'm getting tired of writing HTML for all my lab documentation, but I
> need screenshots, too. What do I need to do to get structured text
> working with inline images? I know I can just stick <img> tags in the
> file, but I'd rather not.
> 
> (Zope 2.3.1, Debian 2.2)
> 

i needed that too, so here is my local modification of the ctag function
in the file StructuredText.py (Note: this from Zope 2.3.2):

def ctag(s,
         em=regex.compile(
             ctag_prefix+(ctag_middle % (("*",)*6) )+ctag_suffix),
         strong=regex.compile(
             ctag_prefix+(ctag_middl2 % (("*",)*8))+ctag_suffix),
         under=regex.compile(
             ctag_prefix+(ctag_middle % (("_",)*6) )+ctag_suffix),
         code=regex.compile(
             ctag_prefix+(ctag_middle % (("\'",)*6))+ctag_suffix),
	 bild=regex.compile(
             ctag_prefix+(ctag_middl2 % (("_",)*8))+ctag_suffix),
         ):
    if s is None: s=''
    s=gsub(strong,'\\1<strong>\\2</strong>\\3',s)
    s=gsub(under, '\\1<u>\\2</u>\\3',s)
    s=gsub(code,  '\\1<code>\\2</code>\\3',s)
    s=gsub(em,    '\\1<em>\\2</em>\\3',s)
    s=gsub(bild,  '\\1<img src=\\2>\\3',s)
    return s 

This defines __imageobjectid__ as a new ST-Tag. Works for me, but i have
to remember every Zope-Update to check if this works.

Ciao,
Jochen
-- 
--------------------------------------------------
Jochen Knuth          WebMaster http://www.ipro.de
IPRO GmbH             Phone ++49-7152-93330
Steinbeisstr. 6       Fax ++49-7152-933340
71229 Leonberg        EMail: J.Knuth@ipro.de