Edgewall Software
Modify

Opened 9 years ago

Closed 6 years ago

Last modified 6 years ago

#7124 closed enhancement (fixed)

TitleIndex (optionally) does not show pages shipped with Trac

Reported by: TJ <support@…> Owned by: mark.m.mcmahon@…
Priority: high Milestone: 1.0
Component: wiki system Version: 0.11b2
Severity: normal Keywords: consider newhelp bitesized
Cc: ryano@…
Release Notes:

TitleIndex macro supports new exclude and include arguments

API Changes:

Description

I wanted to have TitleIndex on the front page of my Trac but didn't want the clutter of listing all the pages that are shipped with it.

I've created a patch for class TitleIndexMacro to achieve my aims. There's an additional parameter ignore. When set to 1 TitleIndex will not list the built-in pages. E.g.

[[TitleIndex(format=group,ignore=1)]]

If ignore=0 or is omitted then it lists all pages.

Attachments (3)

trac-0.11b-wiki-macros.diff (1.5 KB) - added by TJ <support@…> 9 years ago.
TitleIndex optionally ignores built-in pages
trac-0.11.2-wiki-macros.patch (1.4 KB) - added by marek.lukacs@… 8 years ago.
Omit pages equals to or starting with world listed in colon separated list
trac-0.13.dev-wiki-macros.patch (4.9 KB) - added by mark.m.mcmahon@… 6 years ago.
Patch to allow extra filtering in the TitleIndex macro

Download all attachments as: .zip

Change History (21)

Changed 9 years ago by TJ <support@…>

Attachment: trac-0.11b-wiki-macros.diff added

TitleIndex optionally ignores built-in pages

comment:1 Changed 9 years ago by Christian Boos

Keywords: consider added
Milestone: 0.110.11.1

Well, that's an useful feature, but I don't think your current implementation is suitable (e.g. ignoring all 'Inter*' files). A better approach would be to explicitly ignore all pages in the list of known help pages.

But have a look at TracDev/Proposals/NewHelp branch. I think this won't even be necessary once we switch to this.

comment:2 Changed 8 years ago by osimons

Milestone: 0.11.20.12
Owner: changed from Christian Boos to osimons

'Cluttering' of the wiki by help pages is a major reason for NewHelp. Moving this to 0.12 - currently the target for this branch.

comment:3 Changed 8 years ago by osimons

Milestone: 0.130.12

Hmm. Batch update of milestones? Moving back to 0.12.

comment:4 Changed 8 years ago by anonymous

Keywords: newhelp added

comment:5 Changed 8 years ago by anonymous

Summary: Improved TitleIndex macro: optionally ignores pages shipped with TracTitleIndex (optionally) does not show pages shipped with Trac

Changed 8 years ago by marek.lukacs@…

Omit pages equals to or starting with world listed in colon separated list

comment:6 Changed 8 years ago by marek.lukacs@…

I did it in different way. I added new options to TitleIndex macro: omit=colon:separated:list:of:words and omitstartswith=colon:separated:list:of:words.

For omitting pages shipped with trac I use:

[[TitleIndex(omit=CamelCase:PageTemplates:RecentChanges:SandBox:TitleIndex,omitstartswith=Inter:Trac:Wiki)]]

comment:7 Changed 8 years ago by Christian Boos

Owner: changed from osimons to Christian Boos

Hm, why not just have include/exclude fnmatch patterns?

e.g. your example:

[[TitleIndex(include=*,exclude=Inter*:Trac*:Wiki*:CamelCase:PageTemplates:RecentChanges:SandBox:TitleIndex,)]]

Other examples:

  • replacing startswith (or is it prefix? I never know ;-))
    [[TitleIndex(include=TracDev/*)]]
    
  • listing only first sub-level:
    [[TitleIndex(include=TracDev/*,exclude=TracDev/*/*)]]
    

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

Cc: ryano@… added

comment:9 Changed 7 years ago by Remy Blank

Milestone: 0.12next-minor-0.12.x
Owner: changed from Christian Boos to Remy Blank

Nice ideas. I'll implement them, but after 0.12.

comment:10 Changed 7 years ago by Remy Blank

Keywords: bitesized added

comment:11 Changed 6 years ago by Christian Boos

Milestone: next-minor-0.12.xnext-major-0.1X

Changed 6 years ago by mark.m.mcmahon@…

Patch to allow extra filtering in the TitleIndex macro

comment:12 Changed 6 years ago by mark.m.mcmahon@…

I also liked include and exclude more than omit as they seem more consistent.

I have coded it up, and it seems to work well - I added a few tests also (included in the patch).

comment:13 Changed 6 years ago by Remy Blank

Milestone: next-major-0.1X0.13
Priority: normalhigh

Nice patch, thanks!

comment:14 Changed 6 years ago by Remy Blank

Resolution: fixed
Status: newclosed

Simplified patch committed in [10025]. The changes were the following:

  • Changed the semantics so that a missing include argument means "all pages", and exclude takes precedence over include. This is consistent with the examples in comment:7.
  • The case-sensitiveness of the fnmatch.filter() function depends on the OS, so two tests were failing here (on Linux). I used fnmatchcase() instead, which is always case-sensitive.
  • Made the filtering use a more "functional" style.

comment:15 Changed 6 years ago by Remy Blank

Owner: changed from Remy Blank to mark.m.mcmahon@…

comment:16 Changed 6 years ago by Christian Boos

Release Notes: modified (diff)

The TitleIndex page could use this, for example with an explicit list of the default wiki pages: first as exclude to show the site specific pages, then in a second call, with include, to show the help pages.

comment:17 Changed 6 years ago by geroleinemann@…

The parameters "include" and "exclude" are documented on "http://trac.edgewall.org/wiki/WikiMacros" for v.0.12, but not available in the tag/distribution v0.12 (but on the trunk, ready for v0.13).

comment:18 Changed 6 years ago by mail@…

I was hit by the issue mentioned in comment 17. It would be great to have r10025 applied to 0.12.3 it works without a problem on my installation.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain mark.m.mcmahon@….
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from mark.m.mcmahon@… 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.