|Version 5 (modified by JasonWinnebeck, 8 years ago) (diff)|
A Trac 0.11 version of the TracShowPathPatch as a single-file plugin, since in Trac 0.11 this can be done without source code modification, thanks to the ITemplateStreamFilter interface in Trac. This is a modification of Morris's work at t:wiki:MacroBazaar#ShowPath. His code works, but only if the trac instance is at the root of the web server (like trac-hacks.org). My modifications use the Trac environment href API to form the proper URLs.
Trac 0.11 and Genshi 0.5. Current version released is 0.4, so Genshi trunk will be needed. I tested with r851 of Genshi trunk. Genshi 0.5 is needed for the Transformer API to replace the "Start Page" link on the context navigation bar.
From the source:
0.11dev rewrite of original ShowPath functionality. Replaces the global "Start Page" link with a path of links for hierarchical pages. e.g., http://mytrac.com/wiki/ParentPage/ChildPage/GrandchildPage ..would create a ShowPath of Start Page / ParentPage / ChildPage / GrandchildPage ..where all are links except for the current, GrandchildPage. * http://trac-hacks.org/wiki/ShowPathPlugin Just drop in your trac/<projectname>/plugins dir. If you are using an inherited plugins_dir in Trac, that will also work to place this file there. Supports one optional trac.ini setting, sep_character, which specifies the character to use in the path display: [showpath] sep_character = » The default is a forward slash (/); note that no matter what character is specified, it will always be rendered with a single space on either side. If you specify a string of more than one character, only the first non-whitespace character will be used. 2007 Morris - email@example.com rfmorris on irc://freenode/trac 2008 Modification by Jason Winnebeck
If you have any issues, create a new ticket.
- Minor issue: I need help on how to figure out where/how to put the documentation such that the web admin console can see descriptions on it.
- Also I wonder if the way that the Transformation uses XPath, if there is a better/more efficient way to do the replacement.
Download the zipped source from [download:showpathplugin here].
Replaces the "Start Page" link in the Trac bar. If you are on this page, you would see
Start Page / ShowPathPlugin
instead. If you were in a a subpage like "ShowPathPlugin/SubPage" you would see
Start Page / ShowPathPlugin / SubPage.
- 4474 by JasonWinnebeck on 2008-10-13 14:44:28
Removed debugging print, which seems to be crashing Trac when run under CGI. I'm 90% sure that this closes #3638
- 3932 by JasonWinnebeck on 2008-07-01 23:44:33
Check type of element, to prevent AttributeError on custom ticket query pages
- 3702 by JasonWinnebeck on 2008-05-20 21:08:33
Closes #3047, rewritten to use IRequestFilter API, probably is more efficient now