Edgewall Software
Modify

Opened 17 years ago

Closed 14 years ago

#6063 closed enhancement (fixed)

TitleIndex should have option to hide group prefixes

Reported by: Dave Abrahams <dave@…> Owned by: Christian Boos
Priority: normal Milestone: 0.12
Component: wiki system Version: devel
Severity: minor Keywords: titleindex
Cc: mmitar@…, ryano@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I wanted to list all the pages below FooBar/, but I really didn't want to see 'FooBar/' at the beginning of each name, so I added a hideprefix argument to the TitleIndex macro. The code is enclosed. A nice enhancement would hide all parent prefixes of each page name when format=group (so FooBar/Baz/Mumble would show up as a 'Mumble' sub-entry a 'Baz/', but I didn't need that so it's not implemented here. See enclosed implementation

Attachments (1)

MyTitleIndex.py (4.6 KB ) - added by Dave Abrahams <dave@…> 17 years ago.
Macro plugin

Download all attachments as: .zip

Change History (20)

by Dave Abrahams <dave@…>, 17 years ago

Attachment: MyTitleIndex.py added

Macro plugin

comment:1 by Christian Boos, 16 years ago

Resolution: duplicate
Status: newclosed

See #4654.

comment:2 by mmitar@…, 15 years ago

Cc: mmitar@… added
Resolution: duplicate
Status: closedreopened

This is not really a duplicate to #4654. It is a different enhancement. For example, currently is not possible to list only subpages of some hierarchy. If you would have a/b and a/c pages and you would like only to get a list which would be seen only as b and c. Not a list with full paths or even a nested list.

This is useful when you want to make a list of subpages of a page. Then you would like to see only names of those subpages, not whole and complete paths to them.

comment:3 by osimons, 15 years ago

The TitleIndex macro has a limited purpose of displaying the title index for the wiki, and more advanced options exist in external plugins for those that need it. I suggest you look at the th:wiki:TocMacro for instance.

I'm in favour of re-closing this ticket, but I'll leave it open a bit in case others have opinions.

comment:4 by mmitar@…, 15 years ago

As TitleIndex has already common grouping support I do not see a reason why there would not be an option to hide that common group prefix. This is useful when you want to make a TitleIndex just for subpages of a given page (and this is probably one of the reasons why common grouping was included).

TocMacro is useful for situations where you want automatic TOC building. But I would like to build a list of subpages semi-automatic, describing them and then include a list of them.

in reply to:  4 comment:5 by Christian Boos, 15 years ago

Keywords: titleindex added
Milestone: 0.12
Severity: normalminor

Replying to mmitar@…:

As TitleIndex has already common grouping support I do not see a reason why there would not be an option to hide that common group prefix.

That sounds fine by me.

comment:6 by Ryan Ollos <ryano@…>, 15 years ago

Cc: ryano@… added

Just to clarify with an example to confirm that I understand the proposed behavior, would the following be as you suggest:

I currently have a page that contains,

[[TitleIndex(SysAdmin/)]]

Which displays,

  • SysAdmin/CreatingUserAccounts
  • SysAdmin/DashBoard
  • SysAdmin/ManagementProcedures
  • SysAdmin/Subversion&TracAdministrationProcedures
  • SysAdmin/SubversionConfiguration
  • SysAdmin/TracConfiguration

Is the proposed behavior that the following would be displayed?

[[TitleIndex(SysAdmin/, hideprefix)]]
  • CreatingUserAccounts
  • DashBoard
  • ManagementProcedures
  • Subversion&TracAdministrationProcedures
  • SubversionConfiguration
  • TracConfiguration

Or is this was the attached macro actually does? If so, did I specify the hideprefix argument correctly?

comment:7 by Ryan Ollos <ryano@…>, 15 years ago

Also, if I understand correctly, which the patch provided in #4654 and this patch, the example in comment:4:ticket:4654 is would display as:

[[TitleIndex(format=hierarchy, hideprefix)]]
  • a
    • b
      • 1
      • 2
      • 3
    • c
      • 1
      • 2
      • 3

Is that the intent?

in reply to:  7 ; comment:8 by Dave Abrahams <dave@…>, 15 years ago

Replying to Ryan Ollos <ryano@…>:

Also, if I understand correctly, which the patch provided in #4654 and this patch, the example in comment:4:ticket:4654 is would display as:

(snip)

Is that the intent?

Frankly it's been so long since I reported this that I can't recall the precise intent of my proposal. However, as I submitted a patch I think you should assume that the behavior of the patch reflects the intent :-)

in reply to:  8 comment:9 by Ryan Ollos <ryano@…>, 15 years ago

Replying to Dave Abrahams <dave@…>:

However, as I submitted a patch I think you should assume that the behavior of the patch reflects the intent :-)

Oh man, you called me out on my laziness ;). I will have to stop being lazy and patch my local Trac instance and see what the behavior is. I'll do that this weekend and report back what I find.

comment:10 by Remy Blank, 14 years ago

Milestone: 0.12next-minor-0.12.x

Postponing unless somebody submits a working patch for current trunk.

comment:11 by Ryan Ollos <ryano@…>, 14 years ago

Summary: Proposed TitleIndex enhancementTitleIndex should have option to hide group prefixes

I'm going to work on this … don't hold your breath for any results given my python skills. I'm changing the Summary to be a bit more descriptive of the request. I hope that is okay.

comment:12 by Christian Boos, 14 years ago

There's also the issue of stale "/" appearing isolated as a group, not sure it's mentioned in another ticket so I keep note of this here (see in our TitleIndex, TracDev/Branches for example).

in reply to:  12 comment:13 by Christian Boos, 14 years ago

Replying to cboos:

There's also the issue of stale "/" appearing isolated as a group

That was mentioned in ticket:4654#comment:4.

comment:14 by Christian Boos, 14 years ago

Milestone: next-minor-0.12.x0.12
Resolution: fixed
Status: reopenedclosed

Glitch from comment:12 fixed in [8980].

Support for a 'hideprefix' second argument implemented in [8981], works like illustrated in comment:6.

More precisely, assuming we have the following set of pages starting with the 'Wiki' prefix:

  WikiStart
  WikiStart/First
  WikiStart/Second
  WikiStart/Third
  WikiEnd/First
  WikiEnd/Second

then,

[[TitleIndex(Wiki,format=group)]]

displays:

[[TitleIndex(Wiki,hideprefix,format=group)]]

displays:

[[TitleIndex(WikiStart/, format=hierarchy)]]

displays:

[[TitleIndex(WikiStart/,hideprefix,format=hierarchy)]]

displays:

comment:15 by vincentb1981@…, 14 years ago

What about deeper structures defined with the '/'?

Like WikiStart/First/Aa ?

As a non-working example: TitleIndex → Cookbook pages, the second level is not parsed (e.g.: subdir Configuration or Installation).

comment:16 by anonymous, 14 years ago

Resolution: fixed
Status: closedreopened

I have an idea.

In hierarchy mode

TitleIndex( prefix, format=hierarchy, divider, min, max)

Logic is simple, use divider build a hierarchy list, then use min and max depth filter it.

Assuming we have the following set of pages

Base
Base/A
Base/A/A1
Base/A/A2/AX
Base/B/B1
Base/B/B2/BX

TitleIndex(Base,format=hierarchy,/) will display all under Base

  • Base
    • A
      • A1
      • A2
        • AX
    • B
      • B1
      • B2
        • BX

TitleIndex(Base,format=hierarchy,/,max=2) will display at most 2 level

  • Base
    • A
    • B

TitleIndex(Base,format=hierarchy,/,min=2) will strip first 2 level

  • A1
  • A2
    • AX
  • B1
  • B2
    • BX

Give a long prefix

TitleIndex(Base/A,format=hierarchy,/) will display

  • Base/A
    • A1
    • A2
      • AX

TitleIndex(Base/A,format=hierarchy,/,min=1) will display

  • A1
  • A2
    • AX

comment:17 by anonymous, 14 years ago

sorry there's some mistake, page set ought to be like this

Base
Base/A
Base/A/A1
Base/A/A2/AX
Base/B/B1
Base/B/B2  <- lost this one 
Base/B/B2/BX

comment:18 by anonymous, 14 years ago

Very sorry ! This time is correct.

Base
Base/A
Base/A/A1
Base/A/A2    <- lost this one
Base/A/A2/AX
Base/B/B1
Base/B/B2    <- lost this one
Base/B/B2/BX

in reply to:  16 comment:19 by Christian Boos, 14 years ago

Resolution: fixed
Status: reopenedclosed

Replying to anonymous:

I have an idea.

In hierarchy mode

TitleIndex( prefix, format=hierarchy, divider, min, max)

Well, I'm not really convinced this is such a good idea. What if you have:

Base
Base/A/C
Base/B/C

and TitleIndex(Base,format=hierarchy,/,min=2), you'll get:

  • C
  • C

… which would be confusing.

In any case, the proposed enhancement for this ticket (support hideprefix argument in [[TitleIndex]]) has been implemented, so I'm re-closing.

Feel free to create another enhancement ticket for your own proposal, preferably once you have a patch.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.