Opened 10 years ago

Closed 10 years ago

# titleindex change in behaviour following #1784

Reported by: Owned by: jouvin@… jouvin normal TocMacro normal Odd Simon Simonsen 0.11

### Description

Hi,

As the original author for titleindex feature in TOC, I don't like the change introduced in #1784 when no page is specified. In fact, it broke my sites...

Originally, the intent was to give an index of all the pages with the same parent as the page where titleindex is invoked. When you have site structured with several areas reflected in Wiki page names by one of several / in the page name, it was very handy as it was possible to just have the following very generic line to produce a title index of a specific wiki area :

[[TOC(titleindex)]]


No matter what is the name of the parent page. It seems this is no longer possible with the current implementation.

Would you agree on the principle to revert to previous behaviour with the following addition (I thought it was in the initial implementation) that a page ending with a / is interpreted as a parent and all the title of all the pages below is displayed instead of the matching page title and / as a special case to say all pages (like now with the empty page parameter).

Michel

### comment:1 Changed 10 years ago by Odd Simon Simonsen

Trac Release: 0.10 → 0.11

I've been using the TOC macro since 0.9 myself, and back in 0.9 version titleindex worked like it now does again for 0.11 - a plain, non-restricted index of all pages. That changed for 0.10 where making such an index was actually impossible as there was no way to pick all pages. Our favorite trick was to do [[TOC(A,B,C,....,titleindex)]] and hope they all started with capital letters.... I ended up using my own custom version for 0.10 based off the 0.9 version.

Anyway, I do see the value of your proposal with page templates and the like - easily start pages like here on trac-hacks where each top-level page may be be a section of pages and without making any modifications to the macro to insert a specific ancestor page name. I'm not in favour of reverting to previous behavior for titleindex default page selection, but how about making an explicit [[TOC(sectionindex)]] argument instead? Without any page argument it will find the top-level ancestor and list all its decendants, and with page arguments it will find all decendants of those pages. How does that sound?

I'll happily apply such a patch if provided.

### comment:2 Changed 10 years ago by jouvin@…

Your proposal is fine with me. That will requires some editing on my side/sites but nothing really critical anyway. I'll try to have a look at it when I have some spare time, but probably not before end of the week...

Michel

### comment:3 Changed 10 years ago by jouvin@…

Owner: changed from Noah Kantrowitz to anonymous new → assigned

In fact, it was a so easy and small change that I implemented it already. This is in r3417. I incremented version to 11.0.0.3 (this is implemented only in the TocMacro for Trac v0.11). See documentation for more information about this option (sectionindex).

### comment:4 Changed 10 years ago by Odd Simon Simonsen

Owner: changed from anonymous to jouvin assigned → new

Ah. Of course. You already have commit permission. Looks good :-)

You may also want to add documentation of sectionindex in macro.py as well so that it shows up in the usual help page inside projects.

### comment:5 Changed 10 years ago by jouvin@…

Resolution: → fixed new → closed

Sorry for forgetting it in the first run. Done in r3418. I close the ticket, feel free to reopen it if something hurts.

### Modify Ticket

Change Properties