Modify

Opened 11 years ago

Closed 2 years ago

#1207 closed defect (wontfix)

Doesn't appear to sort alphabetically, at least in this particular use case?

Reported by: anonymous Owned by:
Priority: normal Component: HierWikiPlugin
Severity: major Keywords:
Cc: Trac Release: 0.10

Description

While attempting to use the SubWiki macro, it seems to put the entries in an order that doesn't make any sense to me. I expected them to be in alphabet order.

The macro I used was:

[[SubWiki(UserManual/Vol1/,2)]]

This resulted in (rendered):

  • UserManual/Vol1/Sec1 Introduction
  • UserManual/Vol1/Sec4 Menu Functions
  • UserManual/Vol1/Sec5 Jzz Tools Overview
  • UserManual/Vol1/Sec2 Jzz Overview
  • UserManual/Vol1/Sec3 Jzz Plan View Display

The order I would expect is Sec1, Sec2, Sec3, Sec4, and then Sec5. If instead it sorted by the title of the wiki pages, I would have expected it to be "Introduction", "Jzz Overview", "Jzz Plan View Display", "JZZ Tools Overview", and finally "Menu Functions".

Am I doing something wrong? I have tried grabbing the latest version from trac-hacks and it did not change the behavior. Thanks for any help!!

Attachments (0)

Change History (9)

comment:1 Changed 10 years ago by trac-hacks.org@…

Severity: normalmajor

This is till a problem.

comment:2 Changed 10 years ago by trac-hacks.org@…

*still

comment:3 Changed 10 years ago by peter.koerner@…

Currently pages are added to the good_pages-array with the pagename as key and the title as value. then the array is sorted by keys. I'm new to python but MAYBE it will work if you replace in macros/subwiki.py

good_pages.append((p, title)) with good_pages.append((title, p))

put good_pages.sort() before return html.UL(

and replace ) for p,t in good_pages wit ) for t,p in good_pages I'm currently not able to test this because the only trac I have access to is a live system ;)

comment:4 in reply to:  3 ; Changed 10 years ago by anonymous

Replying to peter.koerner@tmp.de:

put good_pages.sort() before return html.UL(

This sorts it on the pagename. (which is fine for me)

To sort on the title, it seems you need to pass a compare function to the sort operation: http://effbot.org/zone/python-list.htm#sorting. But I am also new to python.

comment:5 in reply to:  4 Changed 10 years ago by anonymous

This sorts it on the pagename. (which is fine for me)

If you also do the other changes I suggested, it should sort on the title, becouse I changed the order of p and t (pagename and title).

comment:6 Changed 10 years ago by aboyko

Confirmed as a problem for me, too. Sorting on pagename would be fine for me, too.

comment:7 Changed 10 years ago by peter.koerner@…

Did you have a look on my suggest obove? I testet it and it works.

comment:8 Changed 2 years ago by Ryan J Ollos

Owner: Noah Kantrowitz deleted

comment:9 Changed 2 years ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.