r12835 - in /trunk/libhtml-tagcloud-perl: CHANGES META.yml README debian/changelog debian/compat debian/control debian/copyright debian/rules lib/HTML/TagCloud.pm

emhn-guest at users.alioth.debian.org emhn-guest at users.alioth.debian.org
Wed Jan 16 14:33:20 UTC 2008


Author: emhn-guest
Date: Wed Jan 16 14:33:19 2008
New Revision: 12835

URL: http://svn.debian.org/wsvn/?sc=1&rev=12835
Log:
* New upstream release.
* Upgraded to debhelper 6.
* Upgraded standards Version.
* Fixed control file to comply with Pkg Perl policy.
* Fixed copyright file to parsable style.
* Fixed rules to match dh-make-perl templates.
* Added a proper watch file.

Modified:
    trunk/libhtml-tagcloud-perl/CHANGES
    trunk/libhtml-tagcloud-perl/META.yml
    trunk/libhtml-tagcloud-perl/README
    trunk/libhtml-tagcloud-perl/debian/changelog
    trunk/libhtml-tagcloud-perl/debian/compat
    trunk/libhtml-tagcloud-perl/debian/control
    trunk/libhtml-tagcloud-perl/debian/copyright
    trunk/libhtml-tagcloud-perl/debian/rules
    trunk/libhtml-tagcloud-perl/lib/HTML/TagCloud.pm

Modified: trunk/libhtml-tagcloud-perl/CHANGES
URL: http://svn.debian.org/wsvn/trunk/libhtml-tagcloud-perl/CHANGES?rev=12835&op=diff
==============================================================================
--- trunk/libhtml-tagcloud-perl/CHANGES (original)
+++ trunk/libhtml-tagcloud-perl/CHANGES Wed Jan 16 14:33:19 2008
@@ -1,4 +1,14 @@
 CHANGES file for HTML::TagCloud:
+
+0.34 Tue Nov  7 21:00:33 GMT 2006
+  - Internet Explorer fix, which addresses issues with Japanese text
+    (thanks to Tatsuhiko Miyagawa)
+
+0.33 Mon Mar 13 20:26:36 GMT 2006
+  - add a 'tags' method that extracts most of the logic from the html
+    method. It also adds support for setting levels as a parameter to the
+    constructor.  It defaults to the before-hardcoded 24.
+    (thanks to Marcus Ramberg)
 
 0.32 Mon Aug 22 16:32:29 BST 2005
   - make html_and_css have type="text/css" in the script tag

Modified: trunk/libhtml-tagcloud-perl/META.yml
URL: http://svn.debian.org/wsvn/trunk/libhtml-tagcloud-perl/META.yml?rev=12835&op=diff
==============================================================================
--- trunk/libhtml-tagcloud-perl/META.yml (original)
+++ trunk/libhtml-tagcloud-perl/META.yml Wed Jan 16 14:33:19 2008
@@ -1,14 +1,8 @@
----
+--- #YAML:1.0
 name: HTML-TagCloud
-version: 0.32
+version: 0.34
 author:
-  - 'Leon Brocard, C<< <acme at astray.com> >>.'
+  - Leon Brocard, C<< <acme at astray.com> >>.
 abstract: Generate An HTML Tag Cloud
 license: perl
-requires:
-  Test::More: 0
-provides:
-  HTML::TagCloud:
-    file: lib/HTML/TagCloud.pm
-    version: 0.32
-generated_by: Module::Build version 0.2611
+generated_by: Module::Build version 0.2612, without YAML.pm

Modified: trunk/libhtml-tagcloud-perl/README
URL: http://svn.debian.org/wsvn/trunk/libhtml-tagcloud-perl/README?rev=12835&op=diff
==============================================================================
--- trunk/libhtml-tagcloud-perl/README (original)
+++ trunk/libhtml-tagcloud-perl/README Wed Jan 16 14:33:19 2008
@@ -25,9 +25,11 @@
 
 CONSTRUCTOR
   new
-    The constructor takes no arguments:
+    The constructor takes one optional argument:
 
-      my $cloud = HTML::TagCloud->new;
+      my $cloud = HTML::TagCloud->new(levels=>10);
+
+    if not provided, leves defaults to 24
 
 METHODS
   add
@@ -37,6 +39,10 @@
       $cloud->add($tag1, $url1, $count1);
       $cloud->add($tag2, $url2, $count2);
       $cloud->add($tag3, $url3, $count3);
+
+  tags($limit)
+    Returns a list of hashrefs representing each tag in the cloud, sorted by
+    alphabet. each tag has the following keys; name, count, url and level.
 
   css
     This returns the CSS that will format the HTML returned by the html()

Modified: trunk/libhtml-tagcloud-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libhtml-tagcloud-perl/debian/changelog?rev=12835&op=diff
==============================================================================
--- trunk/libhtml-tagcloud-perl/debian/changelog (original)
+++ trunk/libhtml-tagcloud-perl/debian/changelog Wed Jan 16 14:33:19 2008
@@ -1,3 +1,15 @@
+libhtml-tagcloud-perl (0.34-1) unstable; urgency=low
+
+  * New upstream release.
+  * Upgraded to debhelper 6.
+  * Upgraded standards Version.
+  * Fixed control file to comply with Pkg Perl policy.
+  * Fixed copyright file to parsable style.
+  * Fixed rules to match dh-make-perl templates.
+  * Added a proper watch file.
+
+ -- Ernesto Hernández-Novich (USB) <emhn at usb.ve>  Wed, 16 Jan 2008 10:01:11 -0430
+
 libhtml-tagcloud-perl (0.32-1) unstable; urgency=low
 
   * Initial release - closes: #345403

Modified: trunk/libhtml-tagcloud-perl/debian/compat
URL: http://svn.debian.org/wsvn/trunk/libhtml-tagcloud-perl/debian/compat?rev=12835&op=diff
==============================================================================
--- trunk/libhtml-tagcloud-perl/debian/compat (original)
+++ trunk/libhtml-tagcloud-perl/debian/compat Wed Jan 16 14:33:19 2008
@@ -1,1 +1,1 @@
-4
+6

Modified: trunk/libhtml-tagcloud-perl/debian/control
URL: http://svn.debian.org/wsvn/trunk/libhtml-tagcloud-perl/debian/control?rev=12835&op=diff
==============================================================================
--- trunk/libhtml-tagcloud-perl/debian/control (original)
+++ trunk/libhtml-tagcloud-perl/debian/control Wed Jan 16 14:33:19 2008
@@ -1,20 +1,23 @@
 Source: libhtml-tagcloud-perl
-Maintainer: Ben Hutchings <ben at decadentplace.org.uk>
 Section: perl
-Priority: extra
-Build-Depends-Indep: debhelper (>= 4), perl (>= 5.6.0-16), libmodule-build-perl, libtest-pod-perl, libtest-pod-coverage-perl
-Standards-Version: 3.6.2
+Priority: optional
+Build-Depends: debhelper (>= 6), libmodule-build-perl
+Build-Depends-Indep: perl (>= 5.8.0),
+ libtest-pod-perl, libtest-pod-coverage-perl
+Standards-Version: 3.7.3
+Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
+Homepage: http://search.cpan.org/dist/HTML-TagCloud/
+Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libhtml-tagcloud-perl/
+Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tagcloud-perl/
 
 Package: libhtml-tagcloud-perl
 Architecture: all
 Depends: ${perl:Depends}
-Description: HTML::TagCloud - Generate HTML indexes of popular tags
- The HTML::TagCloud module enables you to generate "tag clouds" in HTML.
- Tag clouds serve as a textual way to visualize terms and topics that are
- used most frequently. The tags are sorted alphabetically and a larger
+Description: Generate HTML indexes of popular tags
+ HTML::TagCloud enables you to generate "tag clouds" HTML pages.
+ Tag clouds serve as a textual way to visualize terms and topics that
+ are used most frequently. The tags are sorted alphabetically and a larger
  font is used to indicate more frequent term usage.
  .
  Example sites with tag clouds: <http://www.43things.com/>,
  <http://www.astray.com/recipes/> and <http://www.flickr.com/photos/tags/>.
- .
- Homepage: http://search.cpan.org/~lbrocard/HTML-TagCloud/

Modified: trunk/libhtml-tagcloud-perl/debian/copyright
URL: http://svn.debian.org/wsvn/trunk/libhtml-tagcloud-perl/debian/copyright?rev=12835&op=diff
==============================================================================
--- trunk/libhtml-tagcloud-perl/debian/copyright (original)
+++ trunk/libhtml-tagcloud-perl/debian/copyright Wed Jan 16 14:33:19 2008
@@ -1,22 +1,23 @@
-This is the Debian-packaged version of HTML::TagCloud, put
-together by Ben Hutchings <ben at decadentplace.org.uk> using source
-from:
+This package was debianized by Ben Hutchings <ben at decadentplace.org.uk>
+using source on Sat, 31 Dec 2005 11:33:38 +0000.
 
-  http://search.cpan.org/~lbrocard/HTML-TagCloud/
+Upstream source:
+    http://search.cpan.org/dist/HTML-TagCloud/
 
-The author of HTML::TagCloud is Leon Brocard <acme at astray.com>.
+Files: *
+Copyright: © 2005-2006 Leon Brocard <acme at astray.com>.
+License: GPL-1+|Artistic
+ This program is free software; you can redistribute it and/or modify it under
+ the same terms as Perl itself.
+ .
+ Perl is distributed under your choice of the GNU General Public License or the
+ Artistic License.
+ .
+ The complete text of the GNU General Public License can be found in
+ /usr/share/common-licenses/GPL and the Artistic License can be found in
+ /usr/share/common-licenses/Artistic.
 
-You may distribute this code under the same terms as Perl itself:
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of either:
-
-    a) the GNU General Public License as published by the Free Software
-       Foundation; either version 1, or (at your option) any later
-       version, or
-
-    b) the "Artistic License" which comes with Perl.
-
-On Debian systems, the complete text of the GNU General Public License
-can be found in `/usr/share/common-licenses/GPL' and the Artistic
-Licence in `/usr/share/common-licenses/Artistic'.
+Files: debian/*
+Copyright: © 2008 Debian Perl Group <debian-perl at lists.debian.org>
+License: GPL-1|Artistic
+ Packaging is licensed under the same terms as the software itself (see above).

Modified: trunk/libhtml-tagcloud-perl/debian/rules
URL: http://svn.debian.org/wsvn/trunk/libhtml-tagcloud-perl/debian/rules?rev=12835&op=diff
==============================================================================
--- trunk/libhtml-tagcloud-perl/debian/rules (original)
+++ trunk/libhtml-tagcloud-perl/debian/rules Wed Jan 16 14:33:19 2008
@@ -1,29 +1,62 @@
 #!/usr/bin/make -f
 
-build : build-stamp
+PACKAGE=$(shell dh_listpackages)
 
-build-stamp : Build.PL
-	perl Build.PL destdir=$(CURDIR)/debian/libhtml-tagcloud-perl installdirs=vendor
-	./Build test
-	touch build-stamp
+ifndef PERL
+PERL = /usr/bin/perl
+endif
 
-binary : binary-arch binary-indep
+TMP =$(CURDIR)/debian/$(PACKAGE)
 
-binary-arch :
+build: build-stamp
+build-stamp:
+	dh_testdir
 
-binary-indep : build-stamp
+	# Add commands to compile the package her
+	$(PERL) Build.PL installdirs=vendor
+	$(PERL) Build
+	$(PERL) Build test
+
+	touch $@
+
+clean: 
+	dh_testdir
 	dh_testroot
-	./Build install
+
+	dh_clean build-stamp install-stamp
+
+	# Add commands to clean up after the build process here
+	[ ! -f Build ] || $(PERL) Build distclean
+
+install: install-stamp
+install-stamp: build-stamp
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+
+	# Add commands to install the package into debian/$PACKAGE_NAME here
+	$(PERL) Build install destdir=$(TMP) create_packlist=0
+
+	touch $@
+
+binary-arch:
+# We have nothing to do here for an architecture-independent package
+
+binary-indep: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs
+	dh_installchangelogs CHANGES
 	dh_perl
-	dh_installchangelogs CHANGES
-	dh_installdocs README
 	dh_compress
 	dh_fixperms
+	dh_installdeb
 	dh_gencontrol
+	dh_md5sums
 	dh_builddeb
 
-clean : 
-	if [ -f Build ]; then ./Build realclean; fi
-	dh_clean build-stamp
+source diff:
+	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
 
-.PHONY : build binary binary-arch binary-dep clean
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary

Modified: trunk/libhtml-tagcloud-perl/lib/HTML/TagCloud.pm
URL: http://svn.debian.org/wsvn/trunk/libhtml-tagcloud-perl/lib/HTML/TagCloud.pm?rev=12835&op=diff
==============================================================================
--- trunk/libhtml-tagcloud-perl/lib/HTML/TagCloud.pm (original)
+++ trunk/libhtml-tagcloud-perl/lib/HTML/TagCloud.pm Wed Jan 16 14:33:19 2008
@@ -1,12 +1,15 @@
 package HTML::TagCloud;
 use strict;
-our $VERSION = '0.32';
+use warnings;
+our $VERSION = '0.34';
 
 sub new {
   my $class = shift;
   my $self  = {
     counts => {},
     urls   => {},
+    levels => 24,
+    @_
   };
   bless $self, $class;
   return $self;
@@ -19,14 +22,14 @@
 }
 
 sub css {
-  my $self = @_;
+  my ($self) = @_;
   my $css = q(
 #htmltagcloud {
   text-align:  center; 
-  line-height: 16px; 
+  line-height: 1; 
 }
 );
-  foreach my $level (0..24) {
+  foreach my $level (0 .. $self->{levels}) {
     my $font = 12 + $level;
     $css .= "span.tagcloud$level { font-size: ${font}px;}\n";
     $css .= "span.tagcloud$level a {text-decoration: none;}\n";
@@ -34,22 +37,14 @@
   return $css;
 }
 
-sub html {
+sub tags {
   my($self, $limit) = @_;
   my $counts = $self->{counts};
   my $urls   = $self->{urls}; 
   my @tags = sort { $counts->{$b} <=> $counts->{$a} } keys %$counts;
-
   @tags = splice(@tags, 0, $limit) if defined $limit;
-  my $ntags = scalar(@tags);
-
-  if ($ntags == 0) {
-    return "";
-  } elsif ($ntags == 1) {
-    my $tag = $tags[0];
-    my $url = $urls->{$tag};
-    return qq{<div id="htmltagcloud"><span class="tagcloud1"><a href="$url">$tag</a></span></div>\n};
-  }
+
+  return unless scalar @tags;
 
   my $min = log($counts->{$tags[-1]});
   my $max = log($counts->{$tags[0]});
@@ -57,14 +52,38 @@
   
   # special case all tags having the same count
   if ($max - $min == 0) {
-    $min = $min - 24;
+    $min = $min - $self->{levels};
     $factor = 1;
   } else {
-    $factor = 24 / ($max - $min);
+    $factor = $self->{levels} / ($max - $min);
   }
   
-  if ($ntags < 24) {
-    $factor *= ($ntags/24);
+  if (scalar @tags < $self->{levels} ) {
+    $factor *= (scalar @tags/$self->{levels});
+  }
+  my @tag_items;
+  foreach my $tag (sort @tags) {
+    my $tag_item;
+    $tag_item->{name} = $tag;
+    $tag_item->{count} = $counts->{$tag};
+    $tag_item->{url}   = $urls->{$tag};
+    $tag_item->{level} = int((log($tag_item->{count}) - $min) * $factor);
+    push @tag_items,$tag_item;
+  }
+  return @tag_items;
+}
+
+sub html {
+  my($self, $limit) = @_;
+  my @tags=$self->tags($limit);
+
+  my $ntags = scalar(@tags);
+  if ($ntags == 0) {
+    return "";
+  } elsif ($ntags == 1) {
+    my $tag = $tags[0];
+    return qq{<div id="htmltagcloud"><span class="tagcloud1"><a href="}.
+	$tag->{url}.qq{">}.$tag->{name}.qq{</a></span></div>\n};
   }
 
 #  warn "min $min - max $max ($factor)";
@@ -72,11 +91,9 @@
 #  warn(($max - $min) * $factor);
 
   my $html = "";
-  foreach my $tag (sort @tags) {
-    my $count = $counts->{$tag};
-    my $url   = $urls->{$tag};
-    my $level = int((log($count) - $min) * $factor);
-    $html .=  qq{<span class="tagcloud$level"><a href="$url">$tag</a></span>\n};
+  foreach my $tag (@tags) {
+    $html .=  qq{<span class="tagcloud}.$tag->{level}.qq{"><a href="}.$tag->{url}.
+	      qq{">}.$tag->{name}.qq{</a></span>\n};
   }
   $html = qq{<div id="htmltagcloud">
 $html</div>};
@@ -126,9 +143,11 @@
 
 =head2 new
 
-The constructor takes no arguments:
-
-  my $cloud = HTML::TagCloud->new;
+The constructor takes one optional argument:
+
+  my $cloud = HTML::TagCloud->new(levels=>10);
+
+if not provided, levels defaults to 24
 
 =head1 METHODS
 
@@ -140,6 +159,12 @@
   $cloud->add($tag1, $url1, $count1);
   $cloud->add($tag2, $url2, $count2);
   $cloud->add($tag3, $url3, $count3);
+
+
+=head2 tags($limit)
+
+Returns a list of hashrefs representing each tag in the cloud, sorted by
+alphabet. Each tag has the following keys: name, count, url and level.
 
 =head2 css
 
@@ -171,7 +196,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2005, Leon Brocard
+Copyright (C) 2005-6, Leon Brocard
 
 This module is free software; you can redistribute it or modify it
 under the same terms as Perl itself.




More information about the Pkg-perl-cvs-commits mailing list