Opened 15 years ago
Last modified 8 years ago
#6395 new enhancement
Option to display tag cloud in descending order
Reported by: | Adriana | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | TagsPlugin |
Severity: | normal | Keywords: | list sorted |
Cc: | Trac Release: | 0.11 |
Description
How can I modify tractags.macros to display tag cloud in descending order, starting with the most used tags? I don't understantand what is the current sort order.
Attachments (1)
Change History (9)
comment:1 Changed 15 years ago by
Summary: | display tag cloud in descending order → Option to display tag cloud in descending order |
---|
Changed 15 years ago by
Attachment: | TagCloud.png added |
---|
comment:2 Changed 15 years ago by
I don't mean alphabetical order. I would like to see the most used tags at the beginning of the cloud (tags ordered by their occurrence).
comment:3 Changed 15 years ago by
You had asked:
Replying to lizadri:
I don't understantand what is the current sort order.
I was just trying to determine what is the current sort order. Given that, maybe we can add an option to the macro ... however, the current sort order doesn't make much sense to me.
comment:4 follow-up: 7 Changed 15 years ago by
I need tags ordered by their occurrence because I'm working to create a plugin that suggests tags. :-) The first step of implementation should be suggest the most used tags (eg. top ten).
comment:5 Changed 12 years ago by
Keywords: | list sorted added |
---|
I see your point.
There is an internal object, that could be used for sorting on number of occurrences. However, please understand, that right now performance (#4503) is a much higher priority than new features, so this is still getting postponed.
comment:6 Changed 11 years ago by
Implementation of this feature request will be easier now with new Counter
objects, still it should be considered for next release's development.
comment:7 Changed 11 years ago by
Owner: | changed from Alec Thomas to Steffen Hoffmann |
---|---|
Status: | new → assigned |
Replying to lizadri:
I need tags ordered by their occurrence because I'm working to create a plugin that suggests tags. :-) The first step of implementation should be suggest the most used tags (eg. top ten).
Since [13427] we have tractags.api.TagSystem.get_all_tags()
, so it is part of current stable tractags-0.7
as well.
This method returns a Counter
object. Use its .most_common(n)
method to extract the <n> top-most tags as a list of tuples with their number of occurrence in descending order. This will likely give you all you need for your plugin application.
I'm undecided how to proceed here. The request regarding API usage for other Trac plugins is clearly resolved IMHO.
Do we need more options regarding the sorting order? For the macro and web-UI. Maybe, but if any, I suggest extending cloud_caseless_sort
into something more general, like a cloud_sort
list option, and make desc
another list entry next to caseless
. Thoughts?
comment:8 Changed 8 years ago by
Owner: | Steffen Hoffmann deleted |
---|---|
Status: | assigned → new |
It is strange, because on my Trac (running TagsPlugin
0.6
) they are mostly displayed alphabetically, with the exception of the entries at the end,