changeset 1723:4916528e1cd7

text_gedit: displays now images from subpages and http sources
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Mon, 08 Jan 2007 23:56:13 +0100
parents 366650d8772b
children 40345ea89a70
files MoinMoin/formatter/text_gedit.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/formatter/text_gedit.py	Mon Jan 08 00:53:08 2007 +0100
+++ b/MoinMoin/formatter/text_gedit.py	Mon Jan 08 23:56:13 2007 +0100
@@ -102,6 +102,7 @@
                 args = []
             url = None
             kw = {}
+            kw['src'] = None
             pos = 0
             for arg in args:
                 if '=' in arg:
@@ -115,11 +116,18 @@
                 else:
                     if pos == 0 and arg:
                         url = arg
-                        kw['title'] = "attachment:%s" % wikiutil.quoteWikinameURL(url)
+                        if url.startswith('http'):
+                            kw['src'] = url
+                        else:
+                            if '/' in arg:
+                                pagename, arg = arg.split('/')
+                                url = arg
+                            kw['title'] = "attachment:%s" % wikiutil.quoteWikinameURL(url)
                     elif pos == 1 and arg:
                         kw['target'] = arg
                     pos += 1
-            kw['src'] = AttachFile.getAttachUrl(pagename, url, self.request, addts=1)              
+            if not kw['src']:
+               kw['src'] = AttachFile.getAttachUrl(pagename, url, self.request, addts=1)
             return self.image(**kw)
 
         elif args is not None: