wiki:ShowPathPlugin

Show hierarchy of current page

Description

This plugin replaces the global "Start Page" link with a path of links for hierarchical pages, for example

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.

As an example, if you are on this page, you would see:

Start Page / ShowPathPlugin.

If you were in a subpage like "ShowPathPlugin/SubPage" you would see:

Start Page / ShowPathPlugin / SubPage.

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.

In the current Trac 0.11-stable branch (at least as of t:source:branches/0.11-stable at 7581) is currently the Trac 0.11.2 release, which includes an integration of the ShowPath "patch" to Trac. If this functionality is deployed, it would basically obsolete this plugin, but is not incompatible with this plugin. What is implemented is slightly different from what this plugin does:

  • The hierarchical path is shown only if you are in a "second level" page, for example "A/B". This plugin on WikiStart shows "Start Page" (no link), and on page A, shows "Start Page / A" (only "Start Page" as a link).
  • This plugin puts the path on the left side of the context navigation bar in the upper right. The Trac 0.11.2 functionality puts it as a <p>aragraph, which appears on the left side immediately above the start of the wiki content
  • The Trac functionality puts an "Up" link in the context navigation bar when on a second-level page. The "Up" link does not appear on a first level page (i.e. WikiStart is not the parent of all other first-level pages).

The plugin does work in Trac 0.11.2, but you will see both the Trac 0.11.2 functionality (breadcrumbs on the left and "Up" link) and the added links from this plugin. If you want to hide the path generated by Trac, you could try adding a custom CSS stylesheet with the following content:

div#content > p.path { display: none; }

See also: BreadCrumbsNavPlugin

Bugs/Feature Requests

Existing bugs and feature requests for ShowPathPlugin are here.

If you have any issues, create a new ticket.

defect

1 / 1

enhancement

3 / 3

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.

Download

Download the zipped source from here.

Source

You can check out ShowPathPlugin from here using Subversion, or browse the source with Trac.

Installation

This plugin requires 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.

General instructions on installing Trac plugins can be found on the TracPlugins page.

Configuration

This plugin 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.

Recent Changes

4474 by JasonWinnebeck on 2008-10-13 12: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 21:44:33
Check type of element, to prevent AttributeError on custom ticket query pages
3702 by JasonWinnebeck on 2008-05-20 19:08:33
Closes #3047, rewritten to use IRequestFilter API, probably is more efficient now
(more)

Author/Contributors

Author: JasonWinnebeck
Maintainer: Jason Winnebeck
Contributors:

Last modified 7 years ago Last modified on Oct 30, 2017, 9:45:40 AM