r40610 - in /trunk/libtext-formattable-perl: Changes MANIFEST META.yml Makefile.PL README debian/README.source debian/changelog debian/control debian/copyright debian/watch lib/Text/FormatTable.pm test.pl
carnil-guest at users.alioth.debian.org
carnil-guest at users.alioth.debian.org
Fri Jul 24 07:59:44 UTC 2009
Author: carnil-guest
Date: Fri Jul 24 07:59:32 2009
New Revision: 40610
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=40610
Log:
# TODO: rules, patch update, control ...
* New upstream release
* debian/control:
- Add myself to uploaders
- Bump Standards-Version to 3.8.2 (no changes)
* debian/watch: Remove comments from file.
* debian/README.source: Shorten text and point to the more
extensive quilt file under /usr/share/doc/quilt/README.source.
* Update debian/changelog and use machine-readable debian/copyright
format specifications from dep5 proposal.
Modified:
trunk/libtext-formattable-perl/Changes
trunk/libtext-formattable-perl/MANIFEST
trunk/libtext-formattable-perl/META.yml
trunk/libtext-formattable-perl/Makefile.PL
trunk/libtext-formattable-perl/README
trunk/libtext-formattable-perl/debian/README.source
trunk/libtext-formattable-perl/debian/changelog
trunk/libtext-formattable-perl/debian/control
trunk/libtext-formattable-perl/debian/copyright
trunk/libtext-formattable-perl/debian/watch
trunk/libtext-formattable-perl/lib/Text/FormatTable.pm
trunk/libtext-formattable-perl/test.pl
Modified: trunk/libtext-formattable-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-formattable-perl/Changes?rev=40610&op=diff
==============================================================================
--- trunk/libtext-formattable-perl/Changes (original)
+++ trunk/libtext-formattable-perl/Changes Fri Jul 24 07:59:32 2009
@@ -1,6 +1,12 @@
Revision history for Perl extension Text::FormatTable.
-2004-06-10
+2009-07-23 (1.02)
+ * Added support for ASCII color sequences. The escape codes are
+ no longer included when calculating column widths. (Trey
+ Harris)
+ * Trey Harris takes over maintainership.
+
+2004-06-10 (1.01)
* Fixed column width and bottom alignment (Veselin Slavov)
2003-01-28
Modified: trunk/libtext-formattable-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-formattable-perl/MANIFEST?rev=40610&op=diff
==============================================================================
--- trunk/libtext-formattable-perl/MANIFEST (original)
+++ trunk/libtext-formattable-perl/MANIFEST Fri Jul 24 07:59:32 2009
@@ -1,8 +1,8 @@
Changes
+example.pl
+lib/Text/FormatTable.pm
Makefile.PL
-MANIFEST
+MANIFEST This list of files
+META.yml
README
-lib/Text/FormatTable.pm
-example.pl
test.pl
-META.yml Module meta-data (added by MakeMaker)
Modified: trunk/libtext-formattable-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-formattable-perl/META.yml?rev=40610&op=diff
==============================================================================
--- trunk/libtext-formattable-perl/META.yml (original)
+++ trunk/libtext-formattable-perl/META.yml Fri Jul 24 07:59:32 2009
@@ -1,10 +1,13 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: Text-FormatTable
-version: 1.01
-version_from: lib/Text/FormatTable.pm
-installdirs: site
-requires:
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+--- #YAML:1.0
+name: Text-FormatTable
+version: 1.02
+abstract: Format text tables
+license: perl
+author:
+ - Trey Harris <treyharris at gmail.com>
+generated_by: ExtUtils::MakeMaker version 6.42
+distribution_type: module
+requires:
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
Modified: trunk/libtext-formattable-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-formattable-perl/Makefile.PL?rev=40610&op=diff
==============================================================================
--- trunk/libtext-formattable-perl/Makefile.PL (original)
+++ trunk/libtext-formattable-perl/Makefile.PL Fri Jul 24 07:59:32 2009
@@ -7,5 +7,6 @@
'PREREQ_PM' => {}, # e.g., Module::Name => 1.1
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Text/FormatTable.pm', # retrieve abstract from module
- AUTHOR => 'David Schweikert <dws at ee.ethz.ch>') : ()),
+ AUTHOR => 'Trey Harris <treyharris at gmail.com>',
+ LICENSE => 'perl') : ()),
);
Modified: trunk/libtext-formattable-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-formattable-perl/README?rev=40610&op=diff
==============================================================================
--- trunk/libtext-formattable-perl/README (original)
+++ trunk/libtext-formattable-perl/README Fri Jul 24 07:59:32 2009
@@ -26,6 +26,7 @@
COPYRIGHT AND LICENCE
Copyright (c) 2001, Swiss Federal Institute of Technology, Zurich.
+ (c) 2009 Trey Harris
All Rights Reserved.
This module is free software; you can redistribute it and/or
Modified: trunk/libtext-formattable-perl/debian/README.source
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-formattable-perl/debian/README.source?rev=40610&op=diff
==============================================================================
--- trunk/libtext-formattable-perl/debian/README.source (original)
+++ trunk/libtext-formattable-perl/debian/README.source Fri Jul 24 07:59:32 2009
@@ -2,56 +2,4 @@
source. Changes are stored in the source package as diffs in
debian/patches and applied during the build.
-To configure quilt to use debian/patches instead of patches, you want
-either to export QUILT_PATCHES=debian/patches in your environment
-or use this snippet in your ~/.quiltrc:
-
- for where in ./ ../ ../../ ../../../ ../../../../ ../../../../../; do
- if [ -e ${where}debian/rules -a -d ${where}debian/patches ]; then
- export QUILT_PATCHES=debian/patches
- fi
- done
-
-To get the fully patched source after unpacking the source package, cd to
-the root level of the source package and run:
-
- quilt push -a
-
-The last patch listed in debian/patches/series will become the current
-patch.
-
-To add a new set of changes, first run quilt push -a, and then run:
-
- quilt new <patch>
-
-where <patch> is a descriptive name for the patch, used as the filename in
-debian/patches. Then, for every file that will be modified by this patch,
-run:
-
- quilt add <file>
-
-before editing those files. You must tell quilt with quilt add what files
-will be part of the patch before making changes or quilt will not work
-properly. After editing the files, run:
-
- quilt refresh
-
-to save the results as a patch.
-
-Alternately, if you already have an external patch and you just want to
-add it to the build system, run quilt push -a and then:
-
- quilt import -P <patch> /path/to/patch
- quilt push -a
-
-(add -p 0 to quilt import if needed). <patch> as above is the filename to
-use in debian/patches. The last quilt push -a will apply the patch to
-make sure it works properly.
-
-To remove an existing patch from the list of patches that will be applied,
-run:
-
- quilt delete <patch>
-
-You may need to run quilt pop -a to unapply patches first before running
-this command.
+See /usr/share/doc/quilt/README.source for a detailed explanation.
Modified: trunk/libtext-formattable-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-formattable-perl/debian/changelog?rev=40610&op=diff
==============================================================================
--- trunk/libtext-formattable-perl/debian/changelog (original)
+++ trunk/libtext-formattable-perl/debian/changelog Fri Jul 24 07:59:32 2009
@@ -1,4 +1,6 @@
-libtext-formattable-perl (1.01-4) UNRELEASED; urgency=low
+libtext-formattable-perl (1.02-1) UNRELEASED; urgency=low
+
+ # TODO: rules, patch update, control ...
[ gregor herrmann ]
* debian/control: Changed: Switched Vcs-Browser field to ViewSVN
@@ -8,7 +10,18 @@
[ Nathan Handler ]
* debian/watch: Update to ignore development releases.
- -- gregor herrmann <gregoa at debian.org> Sun, 16 Nov 2008 20:48:17 +0100
+ [ Salvatore Bonaccorso ]
+ * New upstream release
+ * debian/control:
+ - Add myself to uploaders
+ - Bump Standards-Version to 3.8.2 (no changes)
+ * debian/watch: Remove comments from file.
+ * debian/README.source: Shorten text and point to the more
+ extensive quilt file under /usr/share/doc/quilt/README.source.
+ * Update debian/changelog and use machine-readable debian/copyright
+ format specifications from dep5 proposal.
+
+ -- Salvatore Bonaccorso <salvatore.bonaccorso at gmail.com> Fri, 24 Jul 2009 09:44:39 +0200
libtext-formattable-perl (1.01-3) unstable; urgency=low
Modified: trunk/libtext-formattable-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-formattable-perl/debian/control?rev=40610&op=diff
==============================================================================
--- trunk/libtext-formattable-perl/debian/control (original)
+++ trunk/libtext-formattable-perl/debian/control Fri Jul 24 07:59:32 2009
@@ -6,8 +6,9 @@
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
Uploaders: Damyan Ivanov <dmn at debian.org>,
Gunnar Wolf <gwolf at debian.org>,
- gregor herrmann <gregor+debian at comodo.priv.at>
-Standards-Version: 3.8.0
+ gregor herrmann <gregor+debian at comodo.priv.at>,
+ Salvatore Bonaccorso <salvatore.bonaccorso at gmail.com>
+Standards-Version: 3.8.2
Homepage: http://search.cpan.org/dist/Text-FormatTable/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libtext-formattable-perl/
Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libtext-formattable-perl/
Modified: trunk/libtext-formattable-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-formattable-perl/debian/copyright?rev=40610&op=diff
==============================================================================
--- trunk/libtext-formattable-perl/debian/copyright (original)
+++ trunk/libtext-formattable-perl/debian/copyright Fri Jul 24 07:59:32 2009
@@ -1,24 +1,34 @@
-Upstream author: David Schweikert <dws at ee.ethz.ch>
+Format-Specification: http://dep.debian.net/deps/dep5/
+Name: Text-FormatTable
+X-Comment:
+ Upstream author: David Schweikert <dws at ee.ethz.ch>
Fixed column width and bottom alignment written by Veselin Slavov
- <vslavov at creditreform.bg>
-
-Upstream source location: http://search.cpan.org/dist/Text-FormatTable/
+ <vslavov at creditreform.bg>.
+Maintainer: Trey Harris
+Source: http://search.cpan.org/dist/Text-FormatTable/
Files: *
-Copyright: Copyright (c) 2001-2004 Swiss Federal Institute of Technology, Zurich.
+Copyright: Copyright (c) 2001-2004 Swiss Federal Institute of Technology, Zurich.
All Rights Reserved.
-License: GPL-1+ | Artistic
- This module 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. On Debian GNU/Linux 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'.
+ Copyright (c) 2009 Trey Harris
+License: GPL-1+ or Artistic
Files: debian/*
-Copyright:
- Copyright 2004-2008, Debian Perl Group
-License: GPL-1+ | Artistic
- The contributors put their work under the same license as the software
- itself.
+Copyright: Copyright 2004-2009, Debian Perl Group members, cf. debian/changelogs
+License: GPL-1+ or Artistic
+
+License: Artistic
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the Artistic License, which comes with Perl.
+X-Comment:
+ On Debian GNU/Linux systems, the complete text of the Artistic License
+ can be found in `/usr/share/common-licenses/Artistic'
+
+License: GPL-1+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+X-Comment:
+ On Debian GNU/Linux systems, the complete text of the GNU General
+ Public License can be found in `/usr/share/common-licenses/GPL'
Modified: trunk/libtext-formattable-perl/debian/watch
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-formattable-perl/debian/watch?rev=40610&op=diff
==============================================================================
--- trunk/libtext-formattable-perl/debian/watch (original)
+++ trunk/libtext-formattable-perl/debian/watch Fri Jul 24 07:59:32 2009
@@ -1,6 +1,2 @@
-# Example watch control file for uscan
-# Rename this file to "watch" and then you can run the "uscan" command
-# to check for upstream updates and more.
-# Site Directory Pattern Version Script
version=3
http://search.cpan.org/dist/Text-FormatTable/ .*/Text-FormatTable-v?(\d[\d.]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)
Modified: trunk/libtext-formattable-perl/lib/Text/FormatTable.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-formattable-perl/lib/Text/FormatTable.pm?rev=40610&op=diff
==============================================================================
--- trunk/libtext-formattable-perl/lib/Text/FormatTable.pm (original)
+++ trunk/libtext-formattable-perl/lib/Text/FormatTable.pm Fri Jul 24 07:59:32 2009
@@ -4,7 +4,7 @@
use strict;
use vars qw($VERSION);
-$VERSION = '1.01';
+$VERSION = '1.02';
=head1 NAME
@@ -31,13 +31,21 @@
=cut
+# Remove ANSI color sequences when calculating length
+sub _uncolorized_length($)
+{
+ my $str = shift;
+ $str =~ s/\e \[ [^m]* m//xmsg;
+ return length $str;
+}
+
# minimal width of $1 if word-wrapped
sub _min_width($)
{
my $str = shift;
my $min;
for my $s (split(/\s+/,$str)) {
- my $l = length $s;
+ my $l = _uncolorized_length $s;
$min = $l if not defined $min or $l > $min;
}
return $min;
@@ -47,7 +55,7 @@
sub _max_width($)
{
my $str = shift;
- return length $str;
+ return _uncolorized_length $str;
}
sub _max($$)
@@ -76,7 +84,7 @@
my @t = ($text);
while(1) {
my $t = pop @t;
- my $l = length $t;
+ my $l = _uncolorized_length $t;
if($l <= $width){
# last line is ok => done
push @t, $t;
@@ -89,7 +97,7 @@
}
elsif($t =~ /(.{$width,}?\S)\s+(\S.*?)$/) {
# nearest space > width
- if ( length $1 > $width_m1 )
+ if ( _uncolorized_length $1 > $width_m1 )
{
# hard hyphanation
my $left = substr($1,0,$width);
@@ -123,7 +131,7 @@
{
my ($width, $text) = @_;
my $lines = _wrap($width, $text);
- map { $_ .= ' 'x($width-length($_)) } @$lines;
+ map { $_ .= ' 'x($width-_uncolorized_length($_)) } @$lines;
return $lines;
}
@@ -132,7 +140,7 @@
{
my ($width, $text) = @_;
my $lines = _wrap($width, $text);
- map { $_ = (' 'x($width-length($_)).$_) } @$lines;
+ map { $_ = (' 'x($width-_uncolorized_length($_)).$_) } @$lines;
return $lines;
}
@@ -524,14 +532,21 @@
=head1 COPYRIGHT
Copyright (c) 2001-2004 Swiss Federal Institute of Technology, Zurich.
+ (c) 2009 Trey Harris
All Rights Reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
+=head1 CODE REPOSITORY
+
+Git - http://github.com/treyharris/Text-FormatTable/tree/master
+
=head1 AUTHOR
S<David Schweikert <dws at ee.ethz.ch>>
+
+Maintained by S<Trey Harris <treyharris at gmail.com>>
Fixed column width and bottom alignment written by
S<Veselin Slavov <vslavov at creditreform.bg>>
Modified: trunk/libtext-formattable-perl/test.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-formattable-perl/test.pl?rev=40610&op=diff
==============================================================================
--- trunk/libtext-formattable-perl/test.pl (original)
+++ trunk/libtext-formattable-perl/test.pl Fri Jul 24 07:59:32 2009
@@ -1,18 +1,19 @@
use Test;
-BEGIN { plan tests => 2 };
+BEGIN { plan tests => 4 };
use Text::FormatTable;
ok(1); # If we made it this far, we're ok.
-my $table = Text::FormatTable->new('r| l l');
+{
+ my $table = Text::FormatTable->new('r| l l');
$table->head('a', 'b', 'c');
-$table->rule('=');
-$table->row('this a test, a nice test', 'oh, cool, a test!', 'yep');
-$table->rule;
-$table->row('you mean it\'s really a test?', 'yes, it is.', 'z');
-$table->rule('=');
-my $is = $table->render(15);
+ $table->rule('=');
+ $table->row('this a test, a nice test', 'oh, cool, a test!', 'yep');
+ $table->rule;
+ $table->row('you mean it\'s really a test?', 'yes, it is.', 'z');
+ $table->rule('=');
+ my $is = $table->render(15);
-my $shouldbe = <<'END';
+ my $shouldbe = <<'END';
a| b c
=================
this a| oh, yep
@@ -29,4 +30,31 @@
=================
END
-ok($is, $shouldbe);
+ ok($is, $shouldbe);
+}
+
+# Test behavior with ANSI-colored header
+{
+ my $colortable = Text::FormatTable->new('l l l');
+ my $RED = "\e[31m";
+ my $RESET = "\e[0m";
+ $colortable->head('foo', $RED . 'bar' . $RESET, 'bat');
+ $colortable->rule('=');
+ $colortable->row(qw(a b c));
+ my $output = $colortable->render();
+ my ($rule) = ($output =~ /(=+)/);
+ ok(length($rule), length("foo bar bat"));
+}
+
+# Test behavior with ANSI-colored row data
+{
+ my $colortable = Text::FormatTable->new('l l l');
+ my $RED = "\e[31m";
+ my $RESET = "\e[0m";
+ $colortable->head('foo', 'bar', 'bat');
+ $colortable->rule('=');
+ $colortable->row('a', $RED . 'b' . $RESET, 'c');
+ my $output = $colortable->render();
+ my ($rule) = ($output =~ /(=+)/);
+ ok(length($rule), length("foo bar bat"));
+}
More information about the Pkg-perl-cvs-commits
mailing list