[Trac] Understanding API and chrome syntax

Emmanuel Blot manu.blot at gmail.com
Tue Aug 9 11:15:23 CDT 2005


> In order to customize the mainnav i recently ran into some problems understanding a chrome
> call in 'header.cs' (<?cs call:nav(chrome.nav.mainnav) ?>).

Remember than thanks to the (I think, excellent) plugin framework, you
can customize the items in the navigation bars, using extension points
(if you don't know what I'm referring to, have a look at the TracDev
wiki page). You might not have to mess with the header.cs file.

> Perhaps somebody can enlighten me a little in that task and where to find 'nav(chrome.nav.mainnav)'
> in the trac sources.

"nav" is a macro (or function, I'm not sure about the Clearsilver
naming) which is defined at line 48 in the recent pre-0.9 releases
(trunk 20xx), in the header.cs file itself:

<?cs def:nav(items) ?><?cs
....

which basically expends the items list "chrome.nav.mainnav", which in
turn is a variable set from Python code.

I hope I'm not wrong saying that the mainnav items are added through
the extension points that implements the INavigationContributor
interface (again, see TracDev), and is managed by the trac.web.Chrome
class

HTH,

Cheers,
Manu

-- 
Manu


More information about the Trac mailing list