| 285 | | # IWikiSyntaxProvider methods |
|---|
| 286 | | |
|---|
| 287 | | def get_wiki_syntax(self): |
|---|
| 288 | | return [] |
|---|
| 289 | | |
|---|
| 290 | | def get_link_resolvers(self): |
|---|
| 291 | | return [('repos', self._format_link), |
|---|
| 292 | | ('source', self._format_link), |
|---|
| 293 | | ('browser', self._format_link)] |
|---|
| 294 | | |
|---|
| 295 | | def _format_link(self, formatter, ns, path, label): |
|---|
| 296 | | match = IMG_RE.search(path) |
|---|
| 297 | | if formatter.flavor != 'oneliner' and match: |
|---|
| 298 | | return '<img src="%s" alt="%s" />' % \ |
|---|
| 299 | | (formatter.href.file(path, format='raw'), label) |
|---|
| 300 | | path, rev, line = get_path_rev_line(path) |
|---|
| 301 | | if line is not None: |
|---|
| 302 | | anchor = '#L%d' % line |
|---|
| 303 | | else: |
|---|
| 304 | | anchor = '' |
|---|
| 305 | | label = urllib.unquote(label) |
|---|
| 306 | | return '<a class="source" href="%s%s">%s</a>' \ |
|---|
| 307 | | % (util.escape(formatter.href.peerReviewBrowser(path, rev=rev)), anchor, |
|---|
| 308 | | label) |
|---|