r52944 - in /trunk/libhtml-tidy-perl: ./ debian/ lib/HTML/ lib/HTML/Tidy/ t/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Wed Feb 17 02:45:59 UTC 2010
Author: jawnsy-guest
Date: Wed Feb 17 02:45:51 2010
New Revision: 52944
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=52944
Log:
New upstream release
Modified:
trunk/libhtml-tidy-perl/Changes
trunk/libhtml-tidy-perl/META.yml
trunk/libhtml-tidy-perl/Makefile.PL
trunk/libhtml-tidy-perl/Tidy.xs
trunk/libhtml-tidy-perl/debian/changelog
trunk/libhtml-tidy-perl/lib/HTML/Tidy.pm
trunk/libhtml-tidy-perl/lib/HTML/Tidy/Message.pm
trunk/libhtml-tidy-perl/t/00-load.t
trunk/libhtml-tidy-perl/t/clean-crash.t
trunk/libhtml-tidy-perl/t/extra-quote.t
trunk/libhtml-tidy-perl/t/ignore-text.t
trunk/libhtml-tidy-perl/t/ignore.t
trunk/libhtml-tidy-perl/t/levels.t
trunk/libhtml-tidy-perl/t/opt-00.t
trunk/libhtml-tidy-perl/t/perfect.t
trunk/libhtml-tidy-perl/t/roundtrip.t
trunk/libhtml-tidy-perl/t/simple.t
trunk/libhtml-tidy-perl/t/too-many-titles.t
trunk/libhtml-tidy-perl/t/unicode.t
trunk/libhtml-tidy-perl/t/version.t
Modified: trunk/libhtml-tidy-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/Changes?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/Changes (original)
+++ trunk/libhtml-tidy-perl/Changes Wed Feb 17 02:45:51 2010
@@ -1,67 +1,90 @@
Revision history for Perl extension HTML::Tidy.
+
+1.50 NEXT
+
+ HTML::Tidy now relies on the libtidy that Andy Lester maintains on github.
+
+ http://github.com/petdance/libtidy
+
+
+ [ENHANCEMENTS]
+ Now includes support for TIDY_INFO messages.
+
+ [FIXES]
+ Fixed a segfault if there are no errors.
+
+
+1.08 Fri Apr 13 22:02:20 CDT 2007
+ First new version with the massive changes from Jonathan Rockway.
+
1.07_01 Fri Nov 10 22:12:59 CST 2006
- We dumped a lot of work in here. Suffice to say that it's
- radically different.
+ We dumped a lot of work in here. Suffice to say that it's
+ radically different.
- [INTERNALS]
- * Added support for Perl::Critic, and a "make critic" target.
+ [INTERNALS]
+ * Added support for Perl::Critic, and a "make critic" target.
1.06 Fri Aug 19 10:23:29 CDT 2005
- NO FUNCTIONAL CHANGES. Just a version bump and some doc fixes.
+ NO FUNCTIONAL CHANGES. Just a version bump and some doc fixes.
+
1.05_02 Wed Apr 20 22:43:31 CDT 2005
- [FIXES]
- * Made clean() return undef if it has no input. Thanks to
- Dominique Quatravax. See RT #8051.
- * Removed line-endings so that we're happy cross-platform in
- the tests. Thanks to the anonymous contributor of RT #7836.
+ [FIXES]
+ * Made clean() return undef if it has no input. Thanks to
+ Dominique Quatravax. See RT #8051.
+ * Removed line-endings so that we're happy cross-platform in
+ the tests. Thanks to the anonymous contributor of RT #7836.
- [ENHANCEMENTS]
- * Added support for config files. Thanks to Anders Ardo!
- See RT #11120.
+ [ENHANCEMENTS]
+ * Added support for config files. Thanks to Anders Ardo!
+ See RT #11120.
+
1.05_01 Thu Sep 2 21:01:52 CDT 2004
- [FIXES]
- * Fixed some segfaults when calling $tidy->clean(). Thanks
- to Aaron Patterson, fixes CPAN #7254.
+ [FIXES]
+ * Fixed some segfaults when calling $tidy->clean(). Thanks
+ to Aaron Patterson, fixes CPAN #7254.
- * Made the Makefile.PL more portable under Mac OS X where
- libtidy had been installed by Fink. Also added some
- Debian and OS X notes to the README. Thanks to Dan
- Friedman.
+ * Made the Makefile.PL more portable under Mac OS X where
+ libtidy had been installed by Fink. Also added some
+ Debian and OS X notes to the README. Thanks to Dan
+ Friedman.
+
1.04 Wed May 12 15:18:37 CDT 2004
- [FIXES]
- * If for some reason, Tidy can't create the cleaned up doc,
- we don't segfault. Added a test to check for it with an HTML
- set that we know made it segfault in 1.02.
+ [FIXES]
+ * If for some reason, Tidy can't create the cleaned up doc,
+ we don't segfault. Added a test to check for it with an HTML
+ set that we know made it segfault in 1.02.
- [ENHANCEMENTS]
- * Portability enhancements from Dave Rolsky.
+ [ENHANCEMENTS]
+ * Portability enhancements from Dave Rolsky.
+
1.02 Wed Mar 3 22:43:57 CST 2004
- [ENHANCEMENTS]
- * Added clean() method for cleaning up using the Tidy magic.
- Thanks to Ben Trott.
+ [ENHANCEMENTS]
+ * Added clean() method for cleaning up using the Tidy magic.
+ Thanks to Ben Trott.
- [FIXES]
- * Message parsing is split on a Ctrl-J instead of \n now.
- This should fix the test problems on Win32.
+ [FIXES]
+ * Message parsing is split on a Ctrl-J instead of \n now.
+ This should fix the test problems on Win32.
- * Removed the #include "ppport.h" from Tidy.xs so it can compile
- on Win32. Thanks to crazyinsomniac.
+ * Removed the #include "ppport.h" from Tidy.xs so it can compile
+ on Win32. Thanks to crazyinsomniac.
- [MISCELLANEOUS]
- * Moved the install directions for tidylib into the README.
+ [MISCELLANEOUS]
+ * Moved the install directions for tidylib into the README.
+
1.00 Wed Feb 25 22:19:28 CST 2004
- First real version, released on an unsuspecting world.
+ First real version, released on an unsuspecting world.
- If you were one of the ones to get in on 0.01 thru 0.04, you may
- want to check your code. The API has changed some. I know that
- parse_file() is now parse(), for example. There may be others.
+ If you were one of the ones to get in on 0.01 thru 0.04, you may
+ want to check your code. The API has changed some. I know that
+ parse_file() is now parse(), for example. There may be others.
- Going forward, of course, I'll note any other API changes here.
+ Going forward, of course, I'll note any other API changes here.
Modified: trunk/libhtml-tidy-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/META.yml?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/META.yml (original)
+++ trunk/libhtml-tidy-perl/META.yml Wed Feb 17 02:45:51 2010
@@ -1,16 +1,27 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: HTML-Tidy
-version: 1.08
-version_from: lib/HTML/Tidy.pm
-installdirs: site
+--- #YAML:1.0
+name: HTML-Tidy
+version: 1.50
+abstract: (X)HTML validation in a Perl object
+author:
+ - Andy Lester <andy at petdance.com>
+license: unknown
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+build_requires:
+ ExtUtils::MakeMaker: 0
requires:
- Carp: 0
- constant: 0
- Exporter: 0
- overload: 0
- Test::Builder: 0
- Test::More: 0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+ Carp: 0
+ constant: 0
+ Exporter: 0
+ overload: 0
+ Test::Builder: 0
+ Test::More: 0
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.54
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
Modified: trunk/libhtml-tidy-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/Makefile.PL?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/Makefile.PL (original)
+++ trunk/libhtml-tidy-perl/Makefile.PL Wed Feb 17 02:45:51 2010
@@ -8,7 +8,7 @@
use ExtUtils::MakeMaker;
use ExtUtils::Liblist;
-my @vars = ExtUtils::Liblist->ext( '-L/sw/lib -ltidy', 0, 1 );
+my @vars = ExtUtils::Liblist->ext( '-ltidy', 0, 1 );
my $libs = $vars[2];
if ( !$libs ) {
@@ -16,14 +16,17 @@
print <<'EOF';
It seems that you don't have libtidy installed. HTML::Tidy does no
-real work on its own. See the section "INSTALLING LIBTIDY" in Tidy.pm
-for a step-by-step walkthrough of building the lib. You can also refer
-to http://tidy.sourceforge.net/.
+real work on its own. It's just a wrapper aound libtidy.
+
+HTML::Tidy is only tested to work with libtidy hosted at
+http://github.com/petdance/libtidy. This is mostly the same as the one
+at http://tidy.sourceforge.net/, with some changes, such as adding a
+version number so that we can tell what version we're working with.
If you do have libtidy installed, and I just haven't detected it,
go ahead and try building. If HTML::Tidy builds and tests correctly,
-then please let Andy Lester know at bug-html-tidy at rt.cpan.org so that
-he can fix the library detection code.
+then please let Andy Lester know at andy at petdance.com so that he can
+fix the library detection code.
EOF
}
@@ -71,7 +74,9 @@
ctags -f tags --recurse --totals \
--exclude=blib --exclude=t/lib \
--exclude=.svn --exclude='*~' \
- --languages=Perl --langmap=Perl:+.t
+ --languages=C,Perl --langmap=Perl:+.t \
+ .
+
critic:
perlcritic -1 \
-profile perlcriticrc \
Modified: trunk/libhtml-tidy-perl/Tidy.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/Tidy.xs?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/Tidy.xs (original)
+++ trunk/libhtml-tidy-perl/Tidy.xs Wed Feb 17 02:45:51 2010
@@ -7,38 +7,35 @@
#include <stdio.h>
#include <errno.h>
-#define HTMLTIDY_LOAD_CONFIG_HASH(tdoc,tidy_options) { \
- HE *entry; \
- (void) hv_iterinit(tidy_options); \
- while ( entry = hv_iternext(tidy_options) ) { \
- I32 key_len; \
- \
- TidyOptionId id; \
- \
- SV *sv_data; \
- const char *data; \
- STRLEN data_len; \
- \
- const char * const key = hv_iterkey(entry,&key_len); \
- const TidyOption opt = tidyGetOptionByName(tdoc,key); \
- if (!opt) { \
- warn("HTML::Tidy: Unrecognized option: ``%s''\n",key); \
- continue; \
- } \
- \
- id = tidyOptGetId(opt); \
- sv_data = hv_iterval(tidy_options,entry); \
- data = SvPV(sv_data,data_len); \
- \
- if ( ! tidyOptSetValue(tdoc,id,data) ) { \
- warn("HTML::Tidy: Can't set option: " \
- "``%s'' to ``%s''\n", \
- key, data); \
- } \
- } \
+
+static void
+_load_config_hash(TidyDoc tdoc, HV *tidy_options)
+{
+ HE *entry;
+
+ (void) hv_iterinit(tidy_options);
+
+ while ( (entry = hv_iternext(tidy_options)) != NULL ) {
+ I32 key_len;
+
+ const char * const key = hv_iterkey(entry,&key_len);
+ const TidyOption opt = tidyGetOptionByName(tdoc,key);
+
+ if (!opt) {
+ warn( "HTML::Tidy: Unrecognized option: \"%s\"\n",key );
+ }
+ else {
+ const TidyOptionId id = tidyOptGetId(opt);
+ SV * const sv_data = hv_iterval(tidy_options,entry);
+ STRLEN data_len;
+ const char * const data = SvPV(sv_data,data_len);
+
+ if ( ! tidyOptSetValue(tdoc,id,data) ) {
+ warn( "HTML::Tidy: Can't set option: \"%s\" to \"%s\"\n", key, data );
+ }
+ }
+ }
}
-
-
MODULE = HTML::Tidy PACKAGE = HTML::Tidy
PROTOTYPES: ENABLE
@@ -55,6 +52,7 @@
const char* newline;
int rc = 0;
PPCODE:
+ tidyBufInit(&errbuf);
rc = ( tidyOptSetValue( tdoc, TidyCharEncoding, "utf8" ) ? rc : -1 );
if ( (rc >= 0 ) && configfile && *configfile ) {
@@ -62,7 +60,7 @@
}
if ( rc >= 0 ) {
- HTMLTIDY_LOAD_CONFIG_HASH(tdoc,tidy_options);
+ _load_config_hash(tdoc,tidy_options);
}
if ( rc >= 0 ) {
@@ -76,7 +74,7 @@
}
if ( rc >= 0 && errbuf.bp) {
- XPUSHs( sv_2mortal(newSVpvn(errbuf.bp, errbuf.size)) );
+ XPUSHs( sv_2mortal(newSVpvn((char *)errbuf.bp, errbuf.size)) );
/* TODO: Make this a function */
switch ( tidyOptGetInt(tdoc,TidyNewline) ) {
@@ -96,7 +94,8 @@
rc = -1;
}
- tidyBufFree( &errbuf );
+ if ( errbuf.bp )
+ tidyBufFree( &errbuf );
tidyRelease( tdoc );
if ( rc < 0 ) {
@@ -117,6 +116,8 @@
const char* newline;
int rc = 0;
PPCODE:
+ tidyBufInit(&output);
+ tidyBufInit(&errbuf);
/* Set our default first. */
/* Don't word-wrap */
rc = ( tidyOptSetInt( tdoc, TidyWrapLen, 0 ) ? rc : -1 );
@@ -132,7 +133,7 @@
}
if ( rc >= 0 ) {
- HTMLTIDY_LOAD_CONFIG_HASH(tdoc,tidy_options);
+ _load_config_hash( tdoc, tidy_options );
}
if ( rc >= 0 ) {
@@ -160,8 +161,8 @@
}
if ( rc >= 0 && output.bp && errbuf.bp ) {
- XPUSHs( sv_2mortal(newSVpvn(output.bp, output.size)) );
- XPUSHs( sv_2mortal(newSVpvn(errbuf.bp, errbuf.size)) );
+ XPUSHs( sv_2mortal(newSVpvn((char *)output.bp, output.size)) );
+ XPUSHs( sv_2mortal(newSVpvn((char *)errbuf.bp, errbuf.size)) );
/* TODO: Hoist this into a function */
switch ( tidyOptGetInt(tdoc,TidyNewline) ) {
@@ -191,11 +192,11 @@
SV*
-_tidy_release_date()
+_tidy_version()
PREINIT:
const char* version;
CODE:
- version = tidyReleaseDate();
+ version = tidyVersion();
RETVAL = newSVpv(version,0); /* will be automatically "mortalized" */
OUTPUT:
RETVAL
Modified: trunk/libhtml-tidy-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/debian/changelog?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/debian/changelog (original)
+++ trunk/libhtml-tidy-perl/debian/changelog Wed Feb 17 02:45:51 2010
@@ -1,4 +1,4 @@
-libhtml-tidy-perl (1.08-2) UNRELEASED; urgency=low
+libhtml-tidy-perl (1.50-1) UNRELEASED; urgency=low
[ Nathan Handler ]
* debian/watch: Update to ignore development releases.
@@ -6,7 +6,10 @@
[ Ryan Niebur ]
* Update ryan52's email address
- -- Ryan Niebur <ryan at debian.org> Fri, 25 Sep 2009 00:25:08 -0700
+ [ Jonathan Yu ]
+ * New upstream release
+
+ -- Jonathan Yu <jawnsy at cpan.org> Tue, 16 Feb 2010 22:01:41 -0500
libhtml-tidy-perl (1.08-1) unstable; urgency=low
Modified: trunk/libhtml-tidy-perl/lib/HTML/Tidy.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/lib/HTML/Tidy.pm?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/lib/HTML/Tidy.pm (original)
+++ trunk/libhtml-tidy-perl/lib/HTML/Tidy.pm Wed Feb 17 02:45:51 2010
@@ -1,6 +1,6 @@
package HTML::Tidy;
-use 5.006001;
+use 5.008;
use strict;
use warnings;
use Carp ();
@@ -13,18 +13,18 @@
=head1 VERSION
-Version 1.08
-
-=cut
-
-our $VERSION = '1.08';
+Version 1.50
+
+=cut
+
+our $VERSION = '1.50';
=head1 SYNOPSIS
use HTML::Tidy;
my $tidy = HTML::Tidy->new( {config_file => 'path/to/config'} );
- $tidy->ignore( type => TIDY_WARNING );
+ $tidy->ignore( type => TIDY_WARNING, typed => TIDY_INFO );
$tidy->parse( "foo.html", $contents_of_foo );
for my $message ( $tidy->messages ) {
@@ -39,7 +39,7 @@
=head1 EXPORTS
-Message types C<TIDY_WARNING> and C<TIDY_ERROR>.
+Message types C<TIDY_ERROR>, C<TIDY_WARNING> and C<TIDY_INFO>.
Everything else is an object method.
@@ -47,10 +47,11 @@
use base 'Exporter';
-use constant TIDY_ERROR => 2;
-use constant TIDY_WARNING => 1;
-
-our @EXPORT = qw( TIDY_ERROR TIDY_WARNING );
+use constant TIDY_ERROR => 3;
+use constant TIDY_WARNING => 2;
+use constant TIDY_INFO => 1;
+
+our @EXPORT = qw( TIDY_ERROR TIDY_WARNING TIDY_INFO );
=head1 METHODS
@@ -95,10 +96,10 @@
); # REVIEW perhaps a list of supported options would be better
my $self = bless {
- messages => [],
- ignore_type => [],
- ignore_text => [],
- config_file => '',
+ messages => [],
+ ignore_type => [],
+ ignore_text => [],
+ config_file => '',
tidy_options => {},
}, $class;
@@ -157,11 +158,11 @@
=over 4
-=item * type => TIDY_(WARNING|ERROR)
-
-Specifies the type of messages you want to ignore, either warnings
-or errors. If you wanted, you could call ignore on both and get no
-messages at all.
+=item * type => TIDY_INFO|TIDY_WARNING|TIDY_ERROR
+
+Specifies the type of messages you want to ignore, either info or warnings
+or errors. If you wanted, you could call ignore on all three and get
+no messages at all.
$tidy->ignore( type => TIDY_WARNING );
@@ -243,11 +244,20 @@
chomp $line;
my $message;
- if ( $line =~ /^line (\d+) column (\d+) - (Warning|Error): (.+)$/ ) {
+ if ( $line =~ /^line (\d+) column (\d+) - (Warning|Error|Info): (.+)$/ ) {
my ($line, $col, $type, $text) = ($1, $2, $3, $4);
- $type = ($type eq 'Warning') ? TIDY_WARNING : TIDY_ERROR;
+ $type =
+ ($type eq 'Warning') ? TIDY_WARNING :
+ ($type eq 'Info') ? TIDY_INFO :
+ TIDY_ERROR;
$message = HTML::Tidy::Message->new( $filename, $type, $line, $col, $text );
+ }
+ elsif ( $line =~ m/^Info: (.+)$/ ) {
+ # Info line we don't want
+
+ my $text = $1;
+ $message = HTML::Tidy::Message->new( $filename, TIDY_INFO, undef, undef, $text );
}
elsif ( $line =~ /^\d+ warnings?, \d+ errors? were found!/ ) {
# Summary line we don't want
@@ -265,16 +275,12 @@
# Summary line we don't want
}
- elsif ( $line =~ m/^Info:/ ) {
- # Info line we don't want
-
- }
elsif ( $line =~ m/^\s*$/ ) {
# Blank line we don't want
}
else {
- Carp::carp "Unknown error type: $line";
+ Carp::carp "HTML::Tidy: Unknown error type: $line";
++$parse_errors;
}
push( @{$self->{messages}}, $message )
@@ -322,14 +328,12 @@
my @ignore_types = @{$self->{ignore_type}};
if ( @ignore_types ) {
- my $type = $message->type;
- return if grep { $type == $_ } @ignore_types;
+ return if grep { $message->type == $_ } @ignore_types;
}
my @ignore_texts = @{$self->{ignore_text}};
if ( @ignore_texts ) {
- my $text = $message->text;
- return if grep { $text =~ $_ } @ignore_texts;
+ return if grep { $message->text =~ $_ } @ignore_texts;
}
return 1;
@@ -337,36 +341,14 @@
=head2 libtidy_version()
- $version = HTML::Tidy->libtidy_version();
- # for example -> "1 September 2005"
- $version = HTML::Tidy->libtidy_version( { numeric => 1 } );
- # for example -> 20050901
-
Returns the version of the underling tidy library.
=cut
sub libtidy_version {
- my $self = shift;
- my $args = shift || {};
-
- my $version_str = _tidy_release_date();
-
- return $version_str unless $args->{numeric};
-
- my @version = split(/\s+/,$version_str);
-
- my %months = (
- January => 1, February => 2, March => 3,
- April => 4, May => 5, June => 6,
- July => 7, August => 8, September => 9,
- October => 10, November => 11, December => 12,
- );
- my $month = $months{$version[1]};
-
- return 10_000 * $version[2]
- + 100 * $month
- + $version[0];
+ my $version_str = _tidy_version();
+
+ return $version_str;
}
require XSLoader;
@@ -391,8 +373,7 @@
=item * It's not pure Perl
-C<HTML::Tidy> is mostly a happy wrapper around libtidy. Tidy's home
-page is at L<http://tidy.sourceforge.net>.
+C<HTML::Tidy> is mostly a happy wrapper around libtidy.
=item * The real work is done by someone else
@@ -410,11 +391,12 @@
=head1 BUGS & FEEDBACK
-Please report any bugs or feature requests to
-C<bug-html-tidy at rt.cpan.org>, or through the web interface at
-L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-Tidy>.
-I will be notified, and then you'll automatically be notified of progress on
-your bug as I make changes.
+Please report any bugs or feature requests at the issue tracker on github
+L<http://github.com/petdance/html-tidy/issues>. I will be notified,
+and then you'll automatically be notified of progress on your bug as I
+make changes.
+
+Please do NOT use L<http://rt.cpan.org>.
=head1 SUPPORT
@@ -434,9 +416,9 @@
L<http://cpanratings.perl.org/d/HTML-Tidy>
-=item * RT: CPAN's request tracker
-
-L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Tidy>
+=item * HTML::Tidy's issue queue at github
+
+L<http://github.com/petdance/html-tidy/issues>
=item * Search CPAN
@@ -444,7 +426,7 @@
=item * Subversion source code repository
-L<http://code.google.com/p/html-tidy/source>
+L<http://github.com/petdance/html-tidy>
=back
@@ -458,7 +440,7 @@
=head1 COPYRIGHT & LICENSE
-Copyright (C) 2005-2007 by Andy Lester
+Copyright (C) 2005-2010 by Andy Lester
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.1 or,
Modified: trunk/libhtml-tidy-perl/lib/HTML/Tidy/Message.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/lib/HTML/Tidy/Message.pm?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/lib/HTML/Tidy/Message.pm (original)
+++ trunk/libhtml-tidy-perl/lib/HTML/Tidy/Message.pm Wed Feb 17 02:45:51 2010
@@ -40,11 +40,11 @@
# Add an element that says what tag caused the error (B, TR, etc)
# so that we can match 'em up down the road.
my $self = {
- _file => $file,
- _type => $type,
- _line => $line,
+ _file => $file,
+ _type => $type,
+ _line => $line,
_column => $column,
- _text => $text,
+ _text => $text,
};
bless $self, $class;
@@ -95,8 +95,9 @@
my $self = shift;
my %strings = (
- 1 => 'Warning',
- 2 => 'Error',
+ 1 => 'Info',
+ 2 => 'Warning',
+ 3 => 'Error',
);
return sprintf( '%s %s %s: %s',
Modified: trunk/libhtml-tidy-perl/t/00-load.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/t/00-load.t?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/t/00-load.t (original)
+++ trunk/libhtml-tidy-perl/t/00-load.t Wed Feb 17 02:45:51 2010
@@ -10,3 +10,7 @@
BEGIN {
use_ok( 'HTML::Tidy::Message' );
}
+eval {
+ # For better test reporting
+ diag( "Testing HTML::Tidy $HTML::Tidy::VERSION, Perl $]; tidylib " . HTML::Tidy->libtidy_version());
+}
Modified: trunk/libhtml-tidy-perl/t/clean-crash.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/t/clean-crash.t?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/t/clean-crash.t (original)
+++ trunk/libhtml-tidy-perl/t/clean-crash.t Wed Feb 17 02:45:51 2010
@@ -20,7 +20,8 @@
my $tidy = new HTML::Tidy;
isa_ok( $tidy, 'HTML::Tidy' );
-$tidy->clean($html);
+$tidy->ignore( type => TIDY_INFO );
+$tidy->clean( $html );
my @mess = map { $_ ? $_->as_string() : undef } $tidy->messages();
pass( 'Ended OK' );
Modified: trunk/libhtml-tidy-perl/t/extra-quote.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/t/extra-quote.t?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/t/extra-quote.t (original)
+++ trunk/libhtml-tidy-perl/t/extra-quote.t Wed Feb 17 02:45:51 2010
@@ -27,7 +27,7 @@
shift @expected; # First one's blank
my @messages = $tidy->messages;
-is( scalar @messages, 3 );
+is( scalar @messages, 3, 'Should have exactly three messages' );
my @strings = map { $_->as_string } @messages;
s/[\r\n]+\z// for @strings;
Modified: trunk/libhtml-tidy-perl/t/ignore-text.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/t/ignore-text.t?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/t/ignore-text.t (original)
+++ trunk/libhtml-tidy-perl/t/ignore-text.t Wed Feb 17 02:45:51 2010
@@ -11,8 +11,8 @@
my $html = do { local $/; <DATA> };
my @expected_messages = split /\n/, q{
-DATA (24:78) Warning: unescaped & which should be written as &
-DATA (24:99) Warning: unescaped & which should be written as &
+DATA (24:XX) Warning: unescaped & which should be written as &
+DATA (24:XX) Warning: unescaped & which should be written as &
};
chomp @expected_messages;
@@ -28,10 +28,20 @@
$tidy->parse( 'DATA', $html );
my @returned = map { $_->as_string } $tidy->messages;
+ munge_returned( \@returned, 'DATA' );
s/[\r\n]+\z// for @returned;
is_deeply( \@returned, \@expected_messages, 'Matching warnings' );
}
+sub munge_returned {
+ # non-1 line numbers are not reliable across libtidies
+ my $returned = shift;
+ my $start_line = shift || qq{-};
+ for ( my $i = 0; $i < scalar @{$returned}; $i++ ) {
+ next if $returned->[$i] =~ m/$start_line \(\d+:1\)/;
+ $returned->[$i] =~ s/$start_line \((\d+):(\d+)\)/$start_line ($1:XX)/;
+ }
+}
__DATA__
<HTML>
<HEAD>
Modified: trunk/libhtml-tidy-perl/t/ignore.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/t/ignore.t?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/t/ignore.t (original)
+++ trunk/libhtml-tidy-perl/t/ignore.t Wed Feb 17 02:45:51 2010
@@ -11,8 +11,8 @@
my @expected_warnings = split /\n/, q{
- (1:1) Warning: missing <!DOCTYPE> declaration
- (23:1) Warning: discarding unexpected <bogotag>
-- (24:78) Warning: unescaped & which should be written as &
-- (24:99) Warning: unescaped & which should be written as &
+- (24:XX) Warning: unescaped & which should be written as &
+- (24:XX) Warning: unescaped & which should be written as &
};
chomp @expected_warnings;
shift @expected_warnings; # First one's blank
@@ -32,6 +32,7 @@
my @returned = map { $_->as_string } $tidy->messages;
s/[\r\n]+\z// for @returned;
+ munge_returned( \@returned );
is_deeply( \@returned, \@expected_warnings, 'Matching warnings' );
}
@@ -55,6 +56,15 @@
like( $@, qr/^Invalid ignore type.+blongo/, 'Throws an error' );
}
+sub munge_returned {
+ # non-1 line numbers are not reliable across libtidies
+ my $returned = shift;
+ my $start_line = shift || qq{-};
+ for ( my $i = 0; $i < scalar @{$returned}; $i++ ) {
+ next if $returned->[$i] =~ m/$start_line \(\d+:1\)/;
+ $returned->[$i] =~ s/$start_line \((\d+):(\d+)\)/$start_line ($1:XX)/;
+ }
+}
__DATA__
<HTML>
<HEAD>
Modified: trunk/libhtml-tidy-perl/t/levels.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/t/levels.t?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/t/levels.t (original)
+++ trunk/libhtml-tidy-perl/t/levels.t Wed Feb 17 02:45:51 2010
@@ -16,15 +16,26 @@
- (1:1) Warning: missing <!DOCTYPE> declaration
- (23:1) Error: <bogotag> is not recognized!
- (23:1) Warning: discarding unexpected <bogotag>
-- (24:78) Warning: unescaped & which should be written as &
-- (24:99) Warning: unescaped & which should be written as &
+- (24:XX) Warning: unescaped & which should be written as &
+- (24:XX) Warning: unescaped & which should be written as &
};
chomp @expected;
shift @expected; # First one's blank
my @messages = map { $_->as_string } $tidy->messages;
s/[\r\n]+\z// for @messages;
+munge_returned( \@messages );
is_deeply( \@messages, \@expected, 'Matching messages' );
+
+sub munge_returned {
+ # non-1 line numbers are not reliable across libtidies
+ my $returned = shift;
+ my $start_line = shift || qq{-};
+ for ( my $i = 0; $i < scalar @{$returned}; $i++ ) {
+ next if $returned->[$i] =~ m/$start_line \(\d+:1\)/;
+ $returned->[$i] =~ s/$start_line \((\d+):(\d+)\)/$start_line ($1:XX)/;
+ }
+}
__DATA__
<HTML>
Modified: trunk/libhtml-tidy-perl/t/opt-00.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/t/opt-00.t?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/t/opt-00.t (original)
+++ trunk/libhtml-tidy-perl/t/opt-00.t Wed Feb 17 02:45:51 2010
@@ -10,21 +10,21 @@
}
my $tidy = new HTML::Tidy({
- tidy_mark => 0,
- add_xml_decl => 1,
- output_xhtml => 1,
- doctype => 'strict',
- clean => 1,
- css_prefix => 'myprefix',
- drop_empty_paras => 0,
- enclose_block_text => 1,
- escape_cdata => 1,
- hide_comments => 1,
- replace_color => 1,
+ tidy_mark => 0,
+ add_xml_decl => 1,
+ output_xhtml => 1,
+ doctype => 'strict',
+ clean => 1,
+ css_prefix => 'myprefix',
+ drop_empty_paras => 0,
+ enclose_block_text => 1,
+ escape_cdata => 1,
+ hide_comments => 1,
+ replace_color => 1,
repeated_attributes => 'keep-first',
- break_before_br => 1,
- vertical_space => 1,
- newline => 'cr',
+ break_before_br => 1,
+ vertical_space => 1,
+ newline => 'cr',
});
my $input=<<'EOD';
Modified: trunk/libhtml-tidy-perl/t/perfect.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/t/perfect.t?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/t/perfect.t (original)
+++ trunk/libhtml-tidy-perl/t/perfect.t Wed Feb 17 02:45:51 2010
@@ -13,6 +13,7 @@
my $tidy = new HTML::Tidy;
isa_ok( $tidy, 'HTML::Tidy' );
+$tidy->ignore( type => TIDY_INFO );
$tidy->parse( '-', $html );
my @returned = map { $_->as_string } $tidy->messages;
Modified: trunk/libhtml-tidy-perl/t/roundtrip.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/t/roundtrip.t?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/t/roundtrip.t (original)
+++ trunk/libhtml-tidy-perl/t/roundtrip.t Wed Feb 17 02:45:51 2010
@@ -11,6 +11,7 @@
my $args = { newline => 'Lf' };
my $tidy = HTML::Tidy->new($args);
isa_ok( $tidy, 'HTML::Tidy' );
+$tidy->ignore( type => TIDY_INFO );
# clean once
$tidy->ignore( text => qr/DOCTYPE/ );
@@ -19,6 +20,7 @@
# then verify that it meets tidy's high standards
$tidy = HTML::Tidy->new($args); # reset messages;
+$tidy->ignore( type => TIDY_INFO );
$clean = $tidy->clean($clean);
my @messages = $tidy->messages( $clean );
Modified: trunk/libhtml-tidy-perl/t/simple.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/t/simple.t?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/t/simple.t (original)
+++ trunk/libhtml-tidy-perl/t/simple.t Wed Feb 17 02:45:51 2010
@@ -1,4 +1,4 @@
-#!perl -Tw
+#!perl -w
use warnings;
use strict;
@@ -14,6 +14,7 @@
my $tidy = HTML::Tidy->new;
isa_ok( $tidy, 'HTML::Tidy' );
+$tidy->ignore( type => TIDY_INFO );
$tidy->parse( '-', $html );
my @messages = $tidy->messages;
Modified: trunk/libhtml-tidy-perl/t/too-many-titles.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/t/too-many-titles.t?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/t/too-many-titles.t (original)
+++ trunk/libhtml-tidy-perl/t/too-many-titles.t Wed Feb 17 02:45:51 2010
@@ -19,6 +19,7 @@
my $tidy = new HTML::Tidy;
isa_ok( $tidy, 'HTML::Tidy' );
+$tidy->ignore( type => TIDY_INFO );
$tidy->parse( '-', $html );
my @returned = map { $_->as_string } $tidy->messages;
Modified: trunk/libhtml-tidy-perl/t/unicode.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/t/unicode.t?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/t/unicode.t (original)
+++ trunk/libhtml-tidy-perl/t/unicode.t Wed Feb 17 02:45:51 2010
@@ -12,6 +12,7 @@
my $args = { newline => 'Lf' };
my $tidy = HTML::Tidy->new($args);
+$tidy->ignore( type => TIDY_INFO );
# suck in the reference HTML document
open( my $html_in, '<:utf8', 't/unicode.html' ) or
Modified: trunk/libhtml-tidy-perl/t/version.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-tidy-perl/t/version.t?rev=52944&op=diff
==============================================================================
--- trunk/libhtml-tidy-perl/t/version.t (original)
+++ trunk/libhtml-tidy-perl/t/version.t Wed Feb 17 02:45:51 2010
@@ -9,13 +9,9 @@
use_ok( 'HTML::Tidy' );
}
-my @months = qw( January February March April May June
- July August September October November December);
-my $months = join '|', @months;
-
my $version_string = HTML::Tidy->libtidy_version();
-like( $version_string, qr/\d\d? ($months) \d\d\d\d/, 'Valid version string' );
+like( $version_string, qr/^\d\.\d{2,}$/, 'Valid version string' );
my $version_nr = HTML::Tidy->libtidy_version( {numeric =>1 } );
-cmp_ok( $version_nr, '>=', 20050901, 'Version is greater than 9/1/2005' );
+cmp_ok( $version_nr, '>=', '0.90', 'Version is greater than 0.90, which is the one I maintain' );
More information about the Pkg-perl-cvs-commits
mailing list