* looking for arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-546 to compare with
* comparing to arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-546
M  MoinMoin/parser/wiki.py

* modified files

--- orig/MoinMoin/parser/wiki.py
+++ mod/MoinMoin/parser/wiki.py
@@ -435,35 +435,72 @@
 
     def _url_bracket_repl(self, word):
         """Handle bracketed URLs."""
-
         # Local extended link?
         if word[1] == ':':
             words = word[2:-1].split(':', 1)
-            if len(words) == 1: words = words * 2
+            if len(words) == 1:
+	        words = words * 2
             return self._word_repl(words[0], words[1])
 
         # Traditional split on space
         words = word[1:-1].split(None, 1)
-        if len(words) == 1: words = words * 2
+        if len(words) == 1:
+	    words = words * 2
 
-        if words[0][0] == '#':
-            # anchor link
-            return (self.formatter.url(1, words[0]) +
-                    self.formatter.text(words[1]) +
-                    self.formatter.url(0))
+        if words[0][0] == '#': # anchor link
+            scheme = words[1].split(":", 1)[0]
+            if scheme in self.attachment_schemas: # [#label attachment:img.png]
+                from MoinMoin.action import AttachFile
+                txt = words[1]
+                try:
+		    attname = txt.split(':')[1]
+                except IndexError:
+                    attname = 'Missing filename'
+                url2 = AttachFile.getAttachUrl(self.formatter.page.page_name, attname, self.request)
+                return (self.formatter.url(1, words[0]) +
+                        self.formatter.image(title=attname, alt=attname, src=url2) +
+                        self.formatter.url(0))
+            else:
+                return (self.formatter.url(1, words[0]) +
+                        self.formatter.text(words[1]) +
+                        self.formatter.url(0))
 
         scheme = words[0].split(":", 1)[0]
-        if scheme == "wiki": return self.interwiki(words, pretty_url=1)
-        if scheme in self.attachment_schemas:
-            return self.attachment(words, pretty_url=1)
+        if scheme == "wiki":
+	    return self.interwiki(words, pretty_url=1)
+        if scheme in self.attachment_schemas: # [attachment:some.png thing]
+            from MoinMoin.action import AttachFile
+            if len(words) == 2:
+                txt = words[0]
+                try:
+		    attname = txt.split(':')[1]
+                except IndexError:
+                    attname = 'Missing filename'
+                url1 = AttachFile.getAttachUrl(self.formatter.page.page_name, attname, self.request)
+                scheme = words[1].split(":", 1)[0]
+                if scheme in self.attachment_schemas: # [attachment:big.png attachment:small.png]
+                    txt = words[1]
+                    try:
+		        attname = txt.split(':')[1]
+                    except IndexError:
+                        attname = 'Missing filename'
+                    url2 = AttachFile.getAttachUrl(self.formatter.page.page_name, attname, self.request)
+                    return (self.formatter.url(1, url1) +
+                            self.formatter.image(title=attname, alt=attname, src=url2) +
+                            self.formatter.url(0))
+                else:
+                    return (self.formatter.url(1, url1) +
+                            self.formatter.text(words[1]) +
+                            self.formatter.url(0))
+            else: # can this ever happen???
+                return self.attachment(words, pretty_url=1)
 
         if wikiutil.isPicture(words[1]) and re.match(self.url_rule, words[1]):
             return (self.formatter.url(1, words[0], 'external', unescaped=1) +
                     self.formatter.image(title=words[0], alt=words[0], src=words[1]) +
                     self.formatter.url(0))
         else:
-            return (self.formatter.url(1, words[0], 'external',
-                                       type='www', unescaped=1) +
+            return (self.formatter.url(1, words[0], 'external', type='www', unescaped=1) +
                     self.formatter.text(words[1]) +
                     self.formatter.url(0))
 



