Commits

pe...@13f79535-47bb-0310-9956-ffa450edef68  committed dcd2e94

#270 - Whitelabeling/detracify: Fix UI wiki documentation links
- Renamed wiki links label

  • Participants
  • Parent commits a4e0fbe

Comments (0)

Files changed (1)

File bhtheme/theme.py

 #  under the License.
 
 from genshi.builder import tag
+from genshi.core import TEXT           
 from genshi.filters.transform import Transformer
 
 from trac.core import *
 
     def filter_stream(self, req, method, filename, stream, data):
         """Insert default Bootstrap CSS classes if rendering 
-        legacy templates (i.e. determined by template name prefix).
+        legacy templates (i.e. determined by template name prefix) 
+        and renames wiki guide links.
         """
         tx = Transformer('body')
 
         for xpath, classes in self.BOOTSTRAP_CSS_DEFAULTS :
             tx = tx.end().select(xpath) \
                     .attr('class', add_classes(classes))
+         
+        # Rename wiki guide links
+        tx = tx.end() \
+            .select("body//a[contains(@href,'/wiki/%s')]" % wiki.GUIDE_NAME) \
+            .map(lambda text: wiki.new_name(text), TEXT)            
+                    
         return stream | tx
 
     # IRequestFilter methods