changeset 1702:790c1e655a5b

ImageLink gots missing feature of interwikilink added
author Reimar Bauer < rb.proj@googlemail.com >
date Fri, 05 Jan 2007 23:21:35 +0100
parents 3c6f59cafbbe
children 0803e5da055d
files MoinMoin/macro/ImageLink.py
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/macro/ImageLink.py	Thu Dec 21 03:39:57 2006 +0100
+++ b/MoinMoin/macro/ImageLink.py	Fri Jan 05 23:21:35 2007 +0100
@@ -83,10 +83,11 @@
       Reimar Bauer
              2006-09-22 bug fix of image linked to attachment and inline
              2006-10-08 patch of DavidLinke added and keys now only lowercase used
+             2006-12-16 interwikilink for pages added
 
     @copyright: 2001 by Jeff Kunce,
                 2004 by Marcin Zalewski,
-                2004-2006 by Reimar Bauer (R.Bauer@fz-juelich.de),
+                2004-2006 by Reimar Bauer,
                 2006 by Thomas Waldmann
     @license: GNU GPL, see COPYING for details.
 """
@@ -196,7 +197,16 @@
                            formatter.image(**kw),
                            formatter.url(0))
     else:
-        return "%s%s%s" % (formatter.pagelink(1, target),
-                           formatter.image(**kw),
-                           formatter.pagelink(0))
+        if ":" in target:
+            if target.startswith('wiki:'):
+                target = target[5:]
+            wikitag, wikiurl, wikitail, error = wikiutil.resolve_wiki(request, target)
+            url = wikiurl + wikiutil.quoteWikinameURL(wikitail)
+            return "%s%s%s" % (formatter.url(1, url),
+                               formatter.image(**kw),
+                               formatter.url(0))
+        else:
+            return "%s%s%s" % (formatter.pagelink(1, target),
+                               formatter.image(**kw),
+                               formatter.pagelink(0))