Ticket #40: interwiki.patch
| File interwiki.patch, 2.4 kB (added by bje@…, 4 years ago) |
|---|
-
Wiki.py
58 58 r"""(?P<tickethref>#\d+)""", 59 59 r"""(?P<changesethref>\[\d+\])""", 60 60 r"""(?P<reporthref>\{\d+\})""", 61 r"""(?P<modulehref>((?P<modulename>bug|ticket|browser|source|repos|report|changeset|wiki|search):(?P<moduleargs>("(.*?)"|'(.*?)')|([^ ]*[^\., \)]))))""",62 61 r"""(?P<wikilink>(^|(?<=[^A-Za-z]))[!]?[A-Z][a-z0-9/.]+(?:[A-Z][a-z0-9/.]*[a-z0-9/])+(?=\Z|\s|,|\.|:))""", 63 62 r"""(?P<fancylink>\[(?P<fancyurl>([a-z]+:[^ ]+)) (?P<linkname>.*?)\])"""] 64 63 … … 158 157 '%s:%s#%s' % (module, args, rev), 0 159 158 else: 160 159 return self.env.href.browser(args), '%s:%s' % (module, args), 0 160 elif self.env.get_config('interwiki', module): 161 p = self.env.get_config('interwiki', module) 162 return p.replace('$page', args), '%s:%s' % (module, args), 0 161 163 else: 162 164 return None, None, 0 163 165 … … 180 182 return '<a href="%s">%s</a>' % (self.env.href.wiki(match), match) 181 183 182 184 def _url_formatter(self, match, fullmatch): 183 return '<a href="%s">%s</a>' % (match, match) 185 link, text, missing = self._expand_module_link(match) 186 if link and missing: 187 return '<a class="missing" href="%s">%s?</a>' % (link, text) 188 elif link: 189 return '<a href="%s">%s</a>' % (link, text) 190 else: 191 return '<a href="%s">%s</a>' % (match, match) 184 192 185 193 def _fancylink_formatter(self, match, fullmatch): 186 194 link = fullmatch.group('fancyurl') … … 203 211 """ 204 212 205 213 _rules = CommonFormatter._rules + \ 206 [r"""(?P<url>([a-z]+: //[^ ]+[^\., ]))"""]214 [r"""(?P<url>([a-z]+:[A-Za-z0-9\$\-_@\.\&+\%]+))"""] 207 215 208 216 _compiled_rules = re.compile('(?:' + string.join(_rules, '|') + ')') 209 217 … … 232 240 r"""(?P<list>^(?P<ldepth>\s+)(?:\*|[0-9]+\.) )""", 233 241 r"""(?P<indent>^(?P<idepth>\s+)(?=\S))""", 234 242 r"""(?P<imgurl>([a-z]+://[^ ]+)\.(PNG|png|JPG|jpg|JPEG|jpeg|GIF|gif)(\?\S+)?)""", 235 r"""(?P<url>([a-z]+: //[^ ]+[^\., \)\]\}]))""",243 r"""(?P<url>([a-z]+:[/A-Za-z0-9\$\-_@\.\&+\%]+))""", 236 244 r"""(?P<last_table_cell>\|\|$)""", 237 245 r"""(?P<table_cell>\|\|)"""] 238 246
