33from trac .web .api import IRequestFilter , IRequestHandler
44from trac .wiki .web_ui import WikiModule
55from trac .util import Markup
6+ from trac .util .html import tag
7+ from tracext .github import GitHubBrowser
68
79
810class CustomWikiModule (WikiModule ):
@@ -55,7 +57,7 @@ class CustomNavigationBar(Component):
5557 implements (INavigationContributor )
5658
5759 def get_active_navigation_item (self , req ):
58- return ""
60+ return "custom_reports "
5961
6062 def get_navigation_items (self , req ):
6163 return [
@@ -67,22 +69,14 @@ def get_navigation_items(self, req):
6769 ]
6870
6971
70- try :
71- # Provided by https://github.com/aaugustin/trac-github
72- from tracext .github import GitHubBrowser
73- except ImportError :
74- pass
75- else :
76- from genshi .builder import tag
77-
78- class GitHubBrowserWithSVNChangesets (GitHubBrowser ):
79- def _format_changeset_link (self , formatter , ns , chgset , label , fullmatch = None ):
80- # Dead-simple version for SVN changesets
81- if chgset .isnumeric ():
82- href = formatter .href .changeset (chgset , None , "/" )
83- return tag .a (label , class_ = "changeset" , href = href )
84-
85- # Fallback to the default implemntation
86- return super (GitHubBrowserWithSVNChangesets , self )._format_changeset_link (
87- formatter , ns , chgset , label , fullmatch
88- )
72+ class GitHubBrowserWithSVNChangesets (GitHubBrowser ):
73+ def _format_changeset_link (self , formatter , ns , chgset , label , fullmatch = None ):
74+ # Dead-simple version for SVN changesets.
75+ if chgset .isnumeric ():
76+ href = formatter .href .changeset (chgset , None , "/" )
77+ return tag .a (label , class_ = "changeset" , href = href )
78+
79+ # Fallback to the default implementation.
80+ return super (GitHubBrowserWithSVNChangesets , self )._format_changeset_link (
81+ formatter , ns , chgset , label , fullmatch
82+ )
0 commit comments