CC: | Ask Bjørn Hansen <ask [...] develooper.com> |
Subject: | [PATCH] lowercase sort the tags; most users don't care that Zebra technically comes before antelope |
Date: | Thu, 28 Aug 2008 01:17:59 -0700 |
To: | bug-HTML-TagCloud [...] rt.cpan.org |
From: | Ask Bjørn Hansen <ask [...] develooper.com> |
---
lib/perl5/HTML/TagCloud.pm | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/lib/perl5/HTML/TagCloud.pm b/lib/perl5/HTML/TagCloud.pm
index 7e0714f..a08a19c 100644
--- a/lib/perl5/HTML/TagCloud.pm
+++ b/lib/perl5/HTML/TagCloud.pm
@@ -62,7 +62,10 @@ sub tags {
$factor *= (scalar @tags/$self->{levels});
}
my @tag_items;
- foreach my $tag (sort @tags) {
+ my @sorted = map { $_->[0] }
+ sort { $a->[1] cmp $b->[1] }
+ map { [ $_, lc($_) ] } @tags;
+ foreach my $tag (@sorted) {
my $tag_item;
$tag_item->{name} = $tag;
$tag_item->{count} = $counts->{$tag};
--
1.6.0