Ticket #7124 (closed enhancement: fixed)
Opened 4 years ago
Last modified 9 months ago
TitleIndex (optionally) does not show pages shipped with Trac
| Reported by: | TJ <support@…> | Owned by: | mark.m.mcmahon@… |
|---|---|---|---|
| Priority: | high | Milestone: | 0.13 |
| 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
Change History
Changed 4 years ago by TJ <support@…>
- Attachment trac-0.11b-wiki-macros.diff added
comment:1 Changed 4 years ago by cboos
- Keywords consider added
- Milestone changed from 0.11 to 0.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 4 years ago by osimons
- Milestone changed from 0.11.2 to 0.12
- Owner changed from cboos 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 4 years ago by osimons
- Milestone changed from 0.13 to 0.12
Hmm. Batch update of milestones? Moving back to 0.12.
comment:4 Changed 3 years ago by anonymous
- Keywords newhelp added
comment:5 Changed 3 years ago by anonymous
- Summary changed from Improved TitleIndex macro: optionally ignores pages shipped with Trac to TitleIndex (optionally) does not show pages shipped with Trac
Changed 3 years ago by marek.lukacs@…
- Attachment trac-0.11.2-wiki-macros.patch added
Omit pages equals to or starting with world listed in colon separated list
comment:6 Changed 3 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 3 years ago by cboos
- Owner changed from osimons to cboos
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 2 years ago by Ryan Ollos <ryano@…>
- Cc ryano@… added
comment:9 Changed 2 years ago by rblank
- Milestone changed from 0.12 to next-minor-0.12.x
- Owner changed from cboos to rblank
Nice ideas. I'll implement them, but after 0.12.
comment:10 Changed 2 years ago by rblank
- Keywords bitesized added
comment:11 Changed 20 months ago by cboos
- Milestone changed from next-minor-0.12.x to next-major-0.1X
Changed 17 months ago by mark.m.mcmahon@…
- Attachment trac-0.13.dev-wiki-macros.patch added
Patch to allow extra filtering in the TitleIndex macro
comment:12 Changed 17 months 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 17 months ago by rblank
- Milestone changed from next-major-0.1X to 0.13
- Priority changed from normal to high
Nice patch, thanks!
comment:14 Changed 17 months ago by rblank
- Resolution set to fixed
- Status changed from new to closed
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 17 months ago by rblank
- Owner changed from rblank to mark.m.mcmahon@…
comment:16 Changed 17 months ago by cboos
- 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 17 months 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 9 months 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.



TitleIndex optionally ignores built-in pages