Index: Wiki.py
===================================================================
--- Wiki.py	(revision 39)
+++ Wiki.py	(working copy)
@@ -58,7 +58,6 @@
               r"""(?P<tickethref>#\d+)""",
               r"""(?P<changesethref>\[\d+\])""",
               r"""(?P<reporthref>\{\d+\})""",
-              r"""(?P<modulehref>((?P<modulename>bug|ticket|browser|source|repos|report|changeset|wiki|search):(?P<moduleargs>(&#34;(.*?)&#34;|'(.*?)')|([^ ]*[^\., \)]))))""",
               r"""(?P<wikilink>(^|(?<=[^A-Za-z]))[!]?[A-Z][a-z0-9/.]+(?:[A-Z][a-z0-9/.]*[a-z0-9/])+(?=\Z|\s|,|\.|:))""",
               r"""(?P<fancylink>\[(?P<fancyurl>([a-z]+:[^ ]+)) (?P<linkname>.*?)\])"""]
 
@@ -158,6 +157,9 @@
                        '%s:%s#%s' % (module, args, rev), 0
             else:
                 return self.env.href.browser(args), '%s:%s' % (module, args), 0
+        elif self.env.get_config('interwiki', module):
+            p = self.env.get_config('interwiki', module)
+            return p.replace('$page', args), '%s:%s' % (module, args), 0
         else:
             return None, None, 0
         
@@ -180,7 +182,13 @@
             return '<a href="%s">%s</a>' % (self.env.href.wiki(match), match)
 
     def _url_formatter(self, match, fullmatch):
-        return '<a href="%s">%s</a>' % (match, match)
+        link, text, missing = self._expand_module_link(match)
+        if link and missing:
+            return '<a class="missing" href="%s">%s?</a>' % (link, text)
+        elif link:
+            return '<a href="%s">%s</a>' % (link, text)
+        else:
+            return '<a href="%s">%s</a>' % (match, match)
 
     def _fancylink_formatter(self, match, fullmatch):
         link = fullmatch.group('fancyurl')
@@ -203,7 +211,7 @@
     """
     
     _rules = CommonFormatter._rules + \
-             [r"""(?P<url>([a-z]+://[^ ]+[^\., ]))"""]
+             [r"""(?P<url>([a-z]+:[A-Za-z0-9\$\-_@\.\&+\%]+))"""]
     
     _compiled_rules = re.compile('(?:' + string.join(_rules, '|') + ')')
 
@@ -232,7 +240,7 @@
               r"""(?P<list>^(?P<ldepth>\s+)(?:\*|[0-9]+\.) )""",
               r"""(?P<indent>^(?P<idepth>\s+)(?=\S))""",
               r"""(?P<imgurl>([a-z]+://[^ ]+)\.(PNG|png|JPG|jpg|JPEG|jpeg|GIF|gif)(\?\S+)?)""",
-              r"""(?P<url>([a-z]+://[^ ]+[^\., \)\]\}]))""",
+              r"""(?P<url>([a-z]+:[/A-Za-z0-9\$\-_@\.\&+\%]+))""",
               r"""(?P<last_table_cell>\|\|$)""",
               r"""(?P<table_cell>\|\|)"""]
     
