wiki:ListOfWikiPagesMacro

Version 14 (modified by martin_s, 5 years ago) (diff)

--

List all Wiki Pages with Last Changed Data and Author or Last Changes By Author

Description

The macro ListOfWikiPages prints a table of all (user generated, i.e. non-trac-default) wiki pages with last changed date and author as requested in Request-a-Hack #2427. Version 0.2 provides also a long format which also includes the newest version number and links to the difference and the history as well as the last comment. This was requested by #4717.

The second macro provided by this package is LastChangesBy which prints the last changes made by the given user or the logged-in user if no username is given.

Configuration

Put the following into your trac.ini configuration file:

[components]
traclistofwikipages.* = enabled

[listofwikipages]
# Optional list of ignored users, defaults to 'trac' to ignore trac's default wiki pages:
#ignore_users = trac

# Select default format 'long' or 'short'. Defaults to 'short' which is the pre-v0.2 format.
#default_format = long
#default_format = short

Bugs/Feature Requests

Existing bugs and feature requests for ListOfWikiPagesMacro are here.

If you have any issues, create a new ticket.

Download and Source

Download the zipped source, check out using Subversion from here, or browse the source with Trac.

Examples

ListOfWikiPages

You can use the ListOfWikiPages macro like this:

[[ListOfWikiPages]]                     # default format as configured in the config file
[[ListOfWikiPages(format=short)]]       # short format
[[ListOfWikiPages(format=long)]]        # long format (new v0.2)

which prints a table of all wiki pages, or with a list of wiki pages:

[[ListOfWikiPages(ThatWikiPage,ThisWikiPage,AnotherWikiPage,format=...)]]

Since v0.3 the optional arguments from and to can be used to specify a time/date range as requested by #5344. The values of this arguments are taken as negative offsets to the current time (i.e. the time the wiki page is displayed). Allowed is a number followed by a unit which can be s,m,h,d,w,o,y for seconds, minutes, hours, days, weeks, month and years. If the unit is missing seconds are assumed.

[[ListOfWikiPages(from=3d)]]            # displays all wiki pages changed in the last three days
[[ListOfWikiPages(to=15m)]]             # displays all wiki pages was where changed longer than 15 minutes ago
[[ListOfWikiPages(from=4.5w,to=15h)]]   # displays all wiki pages was where changed between 4 1/2 week and 15 hours ago

The resulting table looks like this (example links not functional) in the long format. The short format simply lacks the columns Version, Diff, History and Comment.

WikiPageLast Changed AtByVersionDiffHistoryComment
SandBox10/24/09 12:21:21 (98 minutes ago)martin43DiffHistory
test10/24/09 05:22:14 (9 hours ago)martin3DiffHistory
TracLinks10/21/09 15:05:36 (3 days ago)martin4DiffHistoryReplaced "raw-attachment:" with "htdoc:dl/".

LastChangesBy

This macro prints a table similar to the one above only with the By column missing and the author name in the table head.

[[LastChangesBy(martin_s)]]          # the last 5 changes by user `martin_s`
[[LastChangesBy(martin_s,10)]]       # the last 10 changes by user `martin_s`

[[LastChangesBy]]                    # or
[[LastChangesBy()]]                  # the last 5 changes by the current user (i.e. every user sees it's own changes, if logged-on)
[[LastChangesBy(,12)]]               # the last 12 changes by the current user

[[LastChangesBy(...,format=...]]     # Selects `long` or `short` table format
[[LastChangesBy(...,from=..,to=..]]  # Selects `from` and `to` time/date range
Last 3 changes by martin
WikiPageLast Changed At VersionDiffHistoryComment
SandBox10/24/09 12:21:21 (98 minutes ago)43DiffHistory
test10/24/09 05:22:14 (9 hours ago)3DiffHistory
TracLinks10/21/09 15:05:36 (3 days ago)4DiffHistoryReplaced "raw-attachment:" with "htdoc:dl/".

Recent Changes

[8549] by martin_s on 2010-08-30 23:57:45
Added encoding meta-comment and declared SVN keywords as unicode to avoid issues with non-english locales.
[8425] by martin_s on 2010-08-23 13:12:02
Removed outdated variable rev from setup file.
[8384] by martin_s on 2010-08-20 15:22:53
Removed import of source revisions to avoid installation issues.

Author/Contributors

Author: martin_s
Contributors: