Edgewall Software
Modify

Opened 9 years ago

Closed 6 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@…
Release Notes:
API 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@…> 9 years ago.
Macro plugin

Download all attachments as: .zip

Change History (20)

Changed 9 years ago by Dave Abrahams <dave@…>

Attachment: MyTitleIndex.py added

Macro plugin

comment:1 Changed 9 years ago by Christian Boos

Resolution: duplicate
Status: newclosed

See #4654.

comment:2 Changed 7 years ago by mmitar@…

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 Changed 7 years ago by osimons

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 Changed 7 years ago by 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. 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.

comment:5 in reply to:  4 Changed 7 years ago by Christian Boos

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 Changed 7 years ago by Ryan Ollos <ryano@…>

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 Changed 7 years ago by 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:

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

Is that the intent?

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

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 :-)

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

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 Changed 7 years ago by Remy Blank

Milestone: 0.12next-minor-0.12.x

Postponing unless somebody submits a working patch for current trunk.

comment:11 Changed 7 years ago by Ryan Ollos <ryano@…>

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 Changed 7 years ago by Christian Boos

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).

comment:13 in reply to:  12 Changed 7 years ago by Christian Boos

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 Changed 7 years ago by Christian Boos

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 Changed 7 years ago by vincentb1981@…

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 Changed 6 years ago by anonymous

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 Changed 6 years ago by anonymous

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 Changed 6 years ago by anonymous

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

comment:19 in reply to:  16 Changed 6 years ago by Christian Boos

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.