Opened 16 years ago
Closed 10 years ago
#3203 closed defect (wontfix)
SubWiki macro: (reversed) alphabetical sort order
Reported by: | jholg | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | HierWikiPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
Sort order of the SubWiki macro doesn't seem to be alphabetical for me, at least not like I'm used to Python ordering strings. This can be easily enforced by using sorted().
Plus, I'd like to reverse the sort order, to have pages that contain timestamp-like parts in their name show up with the latest one on top, e.g.
- subpages/2008-06-13
- subpages/2008-06-11
- ...
Patch attached that enforces alphabetical order and adds an optional 3rd argument reverse.
Btw I'm running 0.11b2 and the SubWiki macro seems to run without problems for me.
Holger
Attachments (2)
Change History (6)
Changed 16 years ago by
Attachment: | subwiki.py.patch added |
---|
comment:1 Changed 14 years ago by
I've adapted my patch to add an optional 'reverse' parameter to reverse sort order to r9404, respecting the new style parameter, both for the 0.11 and 0.12 macro versions. I haven't bothered with the <= 0.10 versions.
The patch also adds documentation to the previously pretty much undocumented level and style parameters:
Inserts an alphabetic list of sub-wiki pages into the output. A sub-wiki page is a page that is is deeper in the hierachy than the current page. e.g. if the current page is People, the this will return a list of all wiki entries th at start with "People/" Parameters: prefix: optional prefix string. If provided, only pages with names that start with the prefix are included in the resulting list. If this parameter is omitted, all pages are listed. level: optional, how many 'levels' to go down in hierarchy (default: 0 i.e. unrestricted) style: optional output style parameter (default: 1). Possible styles: 0: pagename, title 1: short pagename, title 2: title 3: pagename 4: short pagename reverse: optional boolean parameter, reverse page sorting (default: False)
Note that I've only been able to test with Trac 0.11 (0.11.7) but these are the only 0.11/0.12 differences in the patched files:
$ diff hierwikiplugin/0.11/hierwiki/macros/subwiki.py hierwikiplugin/0.12/hierwiki/macros/subwiki.py 85,88c85 < self.good_pages.sort() < # 0.11 supports Python 2.3 which has no .sort(reverse=True) keyword arg < if self.reverse: < self.good_pages.reverse() --- > self.good_pages.sort(reverse=self.reverse
Patch file: attachment:hierwikiplugin_subwiki_reverse_order.diff
Changed 14 years ago by
Attachment: | hierwikiplugin_subwiki_reverse_order.diff added |
---|
optional reverse sort order parameter patch
comment:2 Changed 14 years ago by
Forgot to mention that attachment:hierwikiplugin_subwiki_reverse_order.diff also fixes the erroneous parameter handling (must check for 'None' rather than None).
comment:3 Changed 10 years ago by
Owner: | Noah Kantrowitz deleted |
---|
comment:4 Changed 10 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
The plugin is deprecated since Trac has equivalent functionality as of trac:milestone:1.1.2. If you find any missing function please open a ticket for Trac.
reversible alphabetical order in SubWiki macro