Submitted by : peterq at: 2004-03-10T11:02:21+00:00 (13 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

Uploading (inline) images to reStructuredText Pages yields <img bla bla... >. Since mixing HTML and reSt is not supported , this does not work. I solved it, by adding the inline image adding functionality to the PageType class. I was to lazy, to do the same for the other PageTypes. So Editing.py has to be changed as follows (diffed against 0.28)

--- 0.28/Editing.py  2004-02-27 21:35:07.000000000 +0100
+++ 0.28_patched/Editing.py 2004-03-06 01:14:34.000000000 +0100
@@ -869,7 +869,10 @@
         if content_type[0:5] == image and \
            not (hasattr(REQUEST,dontinline) and REQUEST.dontinline) and \
            size <= LARGE_FILE_SIZE :
-            linktxt = \n\n<img src="%s%s" />\n % (filepath,file_id)
+           if hasattr(self.pageType(), "inlineImage"):
+               linktxt = self.pageType().inlineImage("%s%s" % (filepath,file_id))
+           else:
+                linktxt = \n\n<img src="%s%s" />\n % (filepath,file_id)
         else:
             linktxt = '\n\n%s\n' % (filepath,file_id,file_id)
         self.setText(self.read()+linktxt,REQUEST)

The `hasattr` test is because I was to lazy adding inlineImage to the other PageTypes?. (shame on me)

This is how I implemented inlineImage for the reStructuredText pagetype. (This goes in PageTypes?.py somewhere in class ZWikiRstPageType?)

def inlineImage(self, imgid): return \n\n.. image:: %s\n % imgid

Comments are welcomed.


comments:

thanks --simon, Mon, 24 May 2004 23:34:38 -0700 reply
I have checked this and linkFile in for 0.31. How should we link a file in RST by the way ?

property change --simon, Mon, 24 May 2004 23:34:51 -0700 reply
Status: pending => closed

property change -- Sun, 30 Jan 2005 08:52:10 -0800 reply
Category: user-pagetypes => user-editing-rst