diff -Nru libhtml-lint-perl-2.22+dfsg/Changes libhtml-lint-perl-2.26+dfsg/Changes --- libhtml-lint-perl-2.22+dfsg/Changes 2015-04-06 20:50:33.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/Changes 2016-12-30 04:37:22.000000000 +0000 @@ -6,6 +6,62 @@ Please DO NOT send bug reports to http://rt.cpan.org/. +2.26 Thu Dec 29 22:36:54 CST 2016 + Stable release. No changes from previous release. + + +2.25_02 Tue Dec 27 14:34:22 CST 2016 + [FIXES] + html_fragment_ok() was not properly excluding document-level errors. + It was effectively the same as html_ok(). + + +2.25_01 Fri Dec 23 22:36:17 CST 2016 + [ENHANCEMENTS] + Added two new types of errors to let you know you're using the + API incorrectly. You should be parsing files like this: + + my $lint = HTML::Lint->new; + $lint->newfile( $filename ); + $lint->parse( $line ); + $lint->eof(); + my @errors = $lint->errors(); + + If you neglect to call ->parse or ->eof, you'll get an error returned + in the list of errors from ->errors(). + + [FIXES] + Test::HTML::Lint::html_fragment_ok() was not properly calling ->eof. + + +2.24 Wed Dec 7 22:20:13 CST 2016 + Official release. No changes from 2.23_01. + + +2.23_01 Tue Dec 6 22:48:56 CST 2016 + [ENHANCEMENTS] + Added detection of unknown HTML entities, like "known &unclosed + &entities are not found". Also fixes the case where HTML::Lint + gets confused by an entity like "²" which it thought was an + unterminated "⊃" entity. Thanks, Klaus S. Madsen. + + [FIXES] + Errors of the type doc-tag-required did not come out in any defined + order. They are now sorted by tag name. This was discovered + because hash randomization caused tests to fail on Perl 5.18 and + above. Thanks, Slaven Rezic, Andrew Main and Lisa Hare. + + Handle some warnings that get thrown if certain values are undef. + Thanks, Yves Lavoie. + + Handle characters that are not handled by HTML::Entities. (GitHub + issue #13) Thanks, Tim Landscheidt. + + [INTERNALS] + Add a test to verify a fixed bug. Thanks to Lance Wicks as part of + the CPAN Pull Request Challenge. + + 2.22 Mon Apr 6 15:47:11 CDT 2015 [CHANGES THAT COULD BREAK YOUR CODE] Previously, html_ok() would not check the entire structure of a web diff -Nru libhtml-lint-perl-2.22+dfsg/debian/changelog libhtml-lint-perl-2.26+dfsg/debian/changelog --- libhtml-lint-perl-2.22+dfsg/debian/changelog 2017-08-01 16:57:46.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/debian/changelog 2017-11-12 10:52:25.000000000 +0000 @@ -1,3 +1,20 @@ +libhtml-lint-perl (2.26+dfsg-1) unstable; urgency=medium + + * Team upload + + [ gregor herrmann ] + * debian/rules: replace dpkg-parsechangelog call with /usr/share/dpkg + /pkg-info.mk. + + [ Damyan Ivanov ] + * New upstream version 2.26+dfsg + * drop fix-test-hash-sort-order.patch, applied upstream + * update years of upstream copyright + * use https in debian/watch + * declare conformance with Policy 4.1.1 + + -- Damyan Ivanov Sun, 12 Nov 2017 10:52:25 +0000 + libhtml-lint-perl (2.22+dfsg-2) unstable; urgency=medium * Team upload. diff -Nru libhtml-lint-perl-2.22+dfsg/debian/control libhtml-lint-perl-2.26+dfsg/debian/control --- libhtml-lint-perl-2.22+dfsg/debian/control 2017-08-01 16:57:46.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/debian/control 2017-11-12 10:51:34.000000000 +0000 @@ -15,7 +15,7 @@ libtest-pod-coverage-perl (>= 1.04), txt2man, dh-buildinfo -Standards-Version: 4.0.0 +Standards-Version: 4.1.1 Vcs-Browser: https://anonscm.debian.org/cgit/pkg-perl/packages/libhtml-lint-perl.git Vcs-Git: https://anonscm.debian.org/git/pkg-perl/packages/libhtml-lint-perl.git Homepage: https://metacpan.org/release/HTML-Lint diff -Nru libhtml-lint-perl-2.22+dfsg/debian/copyright libhtml-lint-perl-2.26+dfsg/debian/copyright --- libhtml-lint-perl-2.22+dfsg/debian/copyright 2017-08-01 16:57:46.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/debian/copyright 2017-11-12 10:49:09.000000000 +0000 @@ -9,7 +9,7 @@ + t/embed-extensions.t Files: * -Copyright: 2003-2015, Andy Lester +Copyright: 2003-2016, Andy Lester License: Artistic-2.0 Files: debian/* diff -Nru libhtml-lint-perl-2.22+dfsg/debian/patches/fix-test-hash-sort-order.patch libhtml-lint-perl-2.26+dfsg/debian/patches/fix-test-hash-sort-order.patch --- libhtml-lint-perl-2.22+dfsg/debian/patches/fix-test-hash-sort-order.patch 2017-08-01 16:57:46.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/debian/patches/fix-test-hash-sort-order.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -Description: fix tests failing due to hash randomization -Origin: upstream VCS - ---- a/lib/HTML/Lint/Parser.pm -+++ b/lib/HTML/Lint/Parser.pm -@@ -102,7 +102,7 @@ - sub _end_document { - my ($self,$line,$column) = @_; - -- for my $tag ( keys %isRequired ) { -+ for my $tag ( sort keys %isRequired ) { - if ( !$self->{_first_seen}->{$tag} ) { - $self->gripe( 'doc-tag-required', tag => $tag ); - } diff -Nru libhtml-lint-perl-2.22+dfsg/debian/patches/series libhtml-lint-perl-2.26+dfsg/debian/patches/series --- libhtml-lint-perl-2.22+dfsg/debian/patches/series 2017-08-01 16:57:46.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -fix-test-hash-sort-order.patch diff -Nru libhtml-lint-perl-2.22+dfsg/debian/rules libhtml-lint-perl-2.26+dfsg/debian/rules --- libhtml-lint-perl-2.22+dfsg/debian/rules 2017-08-01 16:57:46.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/debian/rules 2017-11-12 10:41:52.000000000 +0000 @@ -33,8 +33,9 @@ DEB_INSTALL_MANPAGES_weblint-perl := debian/weblint.1 +include /usr/share/dpkg/pkg-info.mk common-build-indep:: - txt2man -t weblint -s 1 -v "Linux Reference Manual" -r $$(dpkg-parsechangelog -SVersion) debian/weblint.txt > debian/weblint.1 + txt2man -t weblint -s 1 -v "Linux Reference Manual" -r $(DEB_VERSION) debian/weblint.txt > debian/weblint.1 common-binary-post-install-indep:: mv debian/libhtml-lint-perl/usr/bin debian/weblint-perl/usr diff -Nru libhtml-lint-perl-2.22+dfsg/debian/watch libhtml-lint-perl-2.26+dfsg/debian/watch --- libhtml-lint-perl-2.22+dfsg/debian/watch 2017-08-01 16:57:46.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/debian/watch 2017-11-12 10:51:39.000000000 +0000 @@ -1,3 +1,3 @@ version=3 opts="dversionmangle=s/\+dfsg//,repacksuffix=+dfsg" \ -http://metacpan.org/release/HTML-Lint .*/HTML-Lint-v?(\d[\d.]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)$ +https://metacpan.org/release/HTML-Lint .*/HTML-Lint-v?(\d[\d.]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)$ diff -Nru libhtml-lint-perl-2.22+dfsg/lib/HTML/Lint/Error.pm libhtml-lint-perl-2.26+dfsg/lib/HTML/Lint/Error.pm --- libhtml-lint-perl-2.22+dfsg/lib/HTML/Lint/Error.pm 2015-04-06 20:50:33.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/lib/HTML/Lint/Error.pm 2016-12-24 04:39:20.000000000 +0000 @@ -110,7 +110,7 @@ while ( @_ ) { my $var = shift; my $val = shift; - $str =~ s/\$\{$var\}/$val/g; + $str =~ s/\$\{$var\}/$val/g if defined $str; } $self->{_errtext} = $str; @@ -233,6 +233,8 @@ =cut %errors = ( + 'api-parse-not-called' => ['The parse() method has not been called on this file.', CONFIG], + 'api-eof-not-called' => ['The eof() method has not been called on this file.', CONFIG], 'config-unknown-directive' => ['Unknown directive "${directive}"', CONFIG], 'config-unknown-value' => ['Unknown value "${value}" for ${directive} directive', CONFIG], @@ -256,6 +258,14 @@ 'text-use-entity' => ['Character "${char}" should be written as ${entity}', STRUCTURE], ); +=head2 api-parse-not-called + +You called the C method before calling C and C. + +=head2 api-parse-not-called + +You called the C method before calling C. + =head2 config-unknown-directive Unknown directive "DIRECTIVE" @@ -326,7 +336,7 @@ =head1 COPYRIGHT & LICENSE -Copyright 2005-2015 Andy Lester. +Copyright 2005-2016 Andy Lester. This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0. diff -Nru libhtml-lint-perl-2.22+dfsg/lib/HTML/Lint/HTML4.pm libhtml-lint-perl-2.26+dfsg/lib/HTML/Lint/HTML4.pm --- libhtml-lint-perl-2.22+dfsg/lib/HTML/Lint/HTML4.pm 2015-04-06 20:50:33.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/lib/HTML/Lint/HTML4.pm 2016-12-22 04:39:15.000000000 +0000 @@ -205,7 +205,7 @@ =head1 COPYRIGHT -Copyright 2005-2015 Andy Lester. +Copyright 2005-2016 Andy Lester. This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0. diff -Nru libhtml-lint-perl-2.22+dfsg/lib/HTML/Lint/Parser.pm libhtml-lint-perl-2.26+dfsg/lib/HTML/Lint/Parser.pm --- libhtml-lint-perl-2.22+dfsg/lib/HTML/Lint/Parser.pm 2015-04-06 20:50:33.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/lib/HTML/Lint/Parser.pm 2016-12-30 04:37:31.000000000 +0000 @@ -7,7 +7,7 @@ use HTML::Tagset 3.03; use HTML::Lint::HTML4 qw( %isKnownAttribute %isRequired %isNonrepeatable %isObsolete ); -use HTML::Entities qw( %char2entity ); +use HTML::Entities qw( %char2entity %entity2char ); use base 'HTML::Parser'; @@ -17,11 +17,11 @@ =head1 VERSION -Version 2.22 +Version 2.26 =cut -our $VERSION = '2.22'; +our $VERSION = '2.26'; =head1 SYNOPSIS @@ -102,7 +102,7 @@ sub _end_document { my ($self,$line,$column) = @_; - for my $tag ( keys %isRequired ) { + for my $tag ( sort keys %isRequired ) { if ( !$self->{_first_seen}->{$tag} ) { $self->gripe( 'doc-tag-required', tag => $tag ); } @@ -161,8 +161,11 @@ sub _text { my ($self,$text) = @_; - while ( $text =~ /&(?![#0-9a-z])/ig ) { - $self->gripe( 'text-use-entity', char => '&', entity => '&' ); + if ( not $self->{_entity_lookup} ) { + my @entities = sort keys %HTML::Entities::entity2char; + # Strip his semicolons + s/;$// for @entities; + $self->{_entity_lookup} = { map { ($_,1) } @entities }; } while ( $text =~ /([^\x09\x0A\x0D -~])/g ) { @@ -170,51 +173,35 @@ $self->gripe( 'text-use-entity', char => sprintf( '\x%02lX', ord($bad) ), - entity => $char2entity{ $bad }, + entity => $char2entity{ $bad } || '&#' . ord($bad) . ';', ); } - if ( not $self->{_unclosed_entities_regex} ) { - # Get Gisle's list - my @entities = sort keys %HTML::Entities::entity2char; + while ( $text =~ /&([^ ;]*;?)/g ) { + my $match = $1; - # Strip his semicolons - s/;$// for @entities; - - # Build a regex - my $entities = join( '|', @entities ); - $self->{_unclosed_entities_regex} = qr/&($entities)(?!;)/; - - $self->{_entity_lookup} = { map { ($_,1) } @entities }; - } - - while ( $text =~ m/$self->{_unclosed_entities_regex}/g ) { - my $ent = $1; - $self->gripe( 'text-unclosed-entity', entity => "&$ent;" ); - } - - while ( $text =~ m/&([^;]+);/g ) { - my $ent = $1; - - # Numeric entities are fine, if they're not too large. - if ( $ent =~ /^#(\d+)$/ ) { + if ( $match eq '' ) { + $self->gripe( 'text-use-entity', char => '&', entity => '&' ); + } elsif ( $match !~ m/;$/ ) { + if ( exists $self->{_entity_lookup}->{$match} + || $match =~ m/^#(\d+)$/ || $match =~ m/^#x[\dA-F]+$/i) { + $self->gripe( 'text-unclosed-entity', entity => "&$match;" ); + } else { + $self->gripe( 'text-unknown-entity', entity => "&$match" ); + } + } elsif ( $match =~ m/^#(\d+);$/ ) { if ( $1 > 65536 ) { - $self->gripe( 'text-invalid-entity', entity => "&$ent;" ); + $self->gripe( 'text-invalid-entity', entity => "&$match" ); } - next; - } - - # Hex entities are fine, if they're not too large. - if ( $ent =~ /^#x([\dA-F]+)$/i ) { + } elsif ( $match =~ m/^#x([\dA-F]+);$/i ) { if ( length($1) > 4 ) { - $self->gripe( 'text-invalid-entity', entity => "&$ent;" ); + $self->gripe( 'text-invalid-entity', entity => "&$match" ); + } + } else { + $match =~ s/;$//; + unless ( exists $self->{_entity_lookup}->{$match} ) { + $self->gripe( 'text-unknown-entity', entity => "&$match;" ); } - next; - } - - # If it's not a numeric entity, then check the lookup table. - if ( !exists $self->{_entity_lookup}{$ent} ) { - $self->gripe( 'text-unknown-entity', entity => "&$ent;" ); } } @@ -398,7 +385,7 @@ my ($self,$tag,%attr) = @_; my ($type,$alt) = @attr{qw( type alt )}; - if ( lc($type) eq 'image' ) { + if ( defined($type) && (lc($type) eq 'image') ) { my $ok = defined($alt); if ( $ok ) { $alt =~ s/^ +//; diff -Nru libhtml-lint-perl-2.22+dfsg/lib/HTML/Lint.pm libhtml-lint-perl-2.26+dfsg/lib/HTML/Lint.pm --- libhtml-lint-perl-2.22+dfsg/lib/HTML/Lint.pm 2015-04-06 20:50:33.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/lib/HTML/Lint.pm 2016-12-30 04:37:39.000000000 +0000 @@ -14,20 +14,28 @@ =head1 VERSION -Version 2.22 +Version 2.26 =cut -our $VERSION = '2.22'; +our $VERSION = '2.26'; =head1 SYNOPSIS my $lint = HTML::Lint->new; $lint->only_types( HTML::Lint::Error::STRUCTURE ); - $lint->parse( $data ); + # Parse lines of data. + $lint->newfile( $filename ); + while ( my $line = <> ) { + $lint->parse( $line ); + } + $lint->eof(); + + # Or, parse an entire file at once. $lint->parse_file( $filename ); + # Fetch the errors that the linter found. my $error_count = $lint->errors; foreach my $error ( $lint->errors ) { @@ -124,7 +132,11 @@ sub parse { my $self = shift; - return $self->parser->parse( @_ ); + my $rc = $self->parser->parse( @_ ); + + $self->{_parse_called} = 1; + + return $rc; } =head2 $lint->parse_file( $file ) @@ -140,7 +152,7 @@ return $self->parser->parse_file( @_ ); } -=head2 $lint->eof +=head2 $lint->eof() Signals the end of a block of text getting passed in. This must be called to make sure that all parsing is complete before looking at errors. @@ -156,8 +168,9 @@ my $rc; my $parser = $self->parser; if ( $parser ) { - $rc = $self->parser->eof(@_); + $rc = $parser->eof(@_); delete $self->{_parser}; + $self->{_eof_called} = 1; } return $rc; @@ -175,6 +188,13 @@ sub errors { my $self = shift; + if ( !$self->{_parse_called} ) { + $self->gripe( 'api-parse-not-called' ); + } + elsif ( !$self->{_eof_called} ) { + $self->gripe( 'api-eof-not-called' ); + } + if ( wantarray ) { return @{$self->{_errors}}; } @@ -256,8 +276,12 @@ of linting. Otherwise, the object thinks everything is from the same file. Note that the list of errors is NOT cleared. -Note that I<$filename> does NOT need to match what's put into parse() -or parse_file(). It can be a description, a URL, or whatever. +Note that I<$filename> does NOT need to match what's put into C +or C. It can be a description, a URL, or whatever. + +You should call C even if you are only validating one file. If +you do not call C then your errors will not have a filename +attached to them. =cut @@ -266,6 +290,8 @@ my $file = shift; delete $self->{_parser}; + delete $self->{_parse_called}; + delete $self->{_eof_called}; $self->{_file} = $file; $self->{_line} = 0; $self->{_column} = 0; @@ -346,7 +372,7 @@ =head1 COPYRIGHT & LICENSE -Copyright 2005-2015 Andy Lester. +Copyright 2005-2016 Andy Lester. This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0. diff -Nru libhtml-lint-perl-2.22+dfsg/lib/Test/HTML/Lint.pm libhtml-lint-perl-2.26+dfsg/lib/Test/HTML/Lint.pm --- libhtml-lint-perl-2.22+dfsg/lib/Test/HTML/Lint.pm 2015-04-06 20:50:33.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/lib/Test/HTML/Lint.pm 2016-12-30 04:37:51.000000000 +0000 @@ -18,11 +18,11 @@ =head1 VERSION -Version 2.22 +Version 2.26 =cut -$VERSION = '2.22'; +$VERSION = '2.26'; my $Tester = Test::Builder->new; @@ -174,14 +174,19 @@ } else { $lint->parse( $html ); - my $nerr = scalar $lint->errors; + $lint->eof(); + + # Ignore doc-level errors. + my @errors = grep { $_->errcode ne 'doc-tag-required' } $lint->errors; + + my $nerr = @errors; $ok = !$nerr; $Tester->ok( $ok, $name ); if ( !$ok ) { my $msg = 'Errors:'; $msg .= " $name" if $name; $Tester->diag( $msg ); - $Tester->diag( $_->as_string ) for $lint->errors; + $Tester->diag( $_->as_string ) for @errors; } } @@ -217,7 +222,7 @@ =head1 COPYRIGHT & LICENSE -Copyright 2005-2015 Andy Lester. +Copyright 2005-2016 Andy Lester. This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0. diff -Nru libhtml-lint-perl-2.22+dfsg/Makefile.PL libhtml-lint-perl-2.26+dfsg/Makefile.PL --- libhtml-lint-perl-2.22+dfsg/Makefile.PL 2015-03-31 18:12:11.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/Makefile.PL 2016-12-30 04:35:37.000000000 +0000 @@ -20,14 +20,15 @@ PMLIBDIRS => [qw(lib/)], AUTHOR => 'Andy Lester ', PREREQ_PM => { - 'Exporter' => 0, - 'Test::More' => 0, - 'Test::Builder' => 0, + 'Exporter' => 0, + 'Test::More' => 0, + 'Test::Builder' => 0, + 'Test::Builder::Tester' => 0, - 'File::Find' => 0, - 'HTML::Entities' => 0, - 'HTML::Parser' => '3.47', - 'HTML::Tagset' => '3.03', + 'File::Find' => 0, + 'HTML::Entities' => 0, + 'HTML::Parser' => '3.47', + 'HTML::Tagset' => '3.03', }, EXE_FILES => [qw(bin/weblint)], dist => { diff -Nru libhtml-lint-perl-2.22+dfsg/MANIFEST libhtml-lint-perl-2.26+dfsg/MANIFEST --- libhtml-lint-perl-2.22+dfsg/MANIFEST 2015-07-03 13:54:34.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/MANIFEST 2016-12-30 04:38:39.000000000 +0000 @@ -22,6 +22,8 @@ t/40-where.t t/50-multiple-files.t t/60-add-tags.t +t/api-eof-not-called.t +t/api-parse-not-called.t t/attr-repeated.t t/attr-unknown.t t/config-unknown-directive.t @@ -35,6 +37,7 @@ t/elem-unclosed.t t/elem-unknown.t t/elem-unopened.t +t/embed-extensions.t t/pod-coverage.t t/pod.t t/random-nobr.t diff -Nru libhtml-lint-perl-2.22+dfsg/META.json libhtml-lint-perl-2.26+dfsg/META.json --- libhtml-lint-perl-2.22+dfsg/META.json 2015-04-06 20:51:22.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/META.json 2016-12-30 04:38:39.000000000 +0000 @@ -4,7 +4,7 @@ "Andy Lester " ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.132830", + "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150005", "license" : [ "artistic_2" ], @@ -38,6 +38,7 @@ "HTML::Parser" : "3.47", "HTML::Tagset" : "3.03", "Test::Builder" : "0", + "Test::Builder::Tester" : "0", "Test::More" : "0" } } @@ -55,5 +56,6 @@ "url" : "https://github.com/petdance/html-lint" } }, - "version" : "2.22" + "version" : "2.26", + "x_serialization_backend" : "JSON::PP version 2.27300" } diff -Nru libhtml-lint-perl-2.22+dfsg/META.yml libhtml-lint-perl-2.26+dfsg/META.yml --- libhtml-lint-perl-2.22+dfsg/META.yml 2015-04-06 20:51:22.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/META.yml 2016-12-30 04:38:39.000000000 +0000 @@ -3,31 +3,33 @@ author: - 'Andy Lester ' build_requires: - ExtUtils::MakeMaker: 0 + ExtUtils::MakeMaker: '0' configure_requires: - ExtUtils::MakeMaker: 0 + ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.132830' +generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150005' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + version: '1.4' name: HTML-Lint no_index: directory: - t - inc requires: - Exporter: 0 - File::Find: 0 - HTML::Entities: 0 - HTML::Parser: 3.47 - HTML::Tagset: 3.03 - Test::Builder: 0 - Test::More: 0 + Exporter: '0' + File::Find: '0' + HTML::Entities: '0' + HTML::Parser: '3.47' + HTML::Tagset: '3.03' + Test::Builder: '0' + Test::Builder::Tester: '0' + Test::More: '0' resources: bugtracker: https://github.com/petdance/html-lint/issues homepage: http://search.cpan.org/dist/html-lint license: http://www.opensource.org/licenses/artistic-license-2.0.php repository: https://github.com/petdance/html-lint -version: 2.22 +version: '2.26' +x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -Nru libhtml-lint-perl-2.22+dfsg/t/12-html_fragment_ok.t libhtml-lint-perl-2.26+dfsg/t/12-html_fragment_ok.t --- libhtml-lint-perl-2.22+dfsg/t/12-html_fragment_ok.t 2015-04-06 20:50:33.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/t/12-html_fragment_ok.t 2016-12-30 04:35:37.000000000 +0000 @@ -1,21 +1,67 @@ use warnings; use strict; -require 't/LintTest.pl'; -# This test passes the HTML into html_ok, which expects a fully-formed -# HTML document. +use Test::More tests => 4; -checkit( [ - [ 'elem-img-alt-missing' => 'Set #1 (4:5) does not have ALT text defined' ], - [ 'doc-tag-required' => 'Set #1 (6:1) tag is required' ], - [ 'doc-tag-required' => 'Set #1 (6:1) tag is required' ], - [ 'doc-tag-required' => 'Set #1 (6:1) tag is required' ], -], [<DATA>] ); +use Test::Builder::Tester; +use Test::HTML::Lint; -__DATA__ -<body> +my $not_so_good_html = <<'HTML'; <p> - This is a valid fragment, but an incomplete document. + This is a valid fragment (with some errors), but an incomplete document. <img src="alpha.jpg" height="21" width="12"> + <input type="image"> </p> -</body> +HTML + +HTML_OK: { + test_out( 'not ok 1 - Called html_ok' ); + test_fail( +8 ); + test_diag( 'Errors: Called html_ok' ); + test_diag( ' (3:5) <img src="alpha.jpg"> does not have ALT text defined' ); + test_diag( ' (4:5) <input name="" type="image"> does not have non-blank ALT text defined' ); + test_diag( ' (5:1) <body> tag is required' ); + test_diag( ' (5:1) <head> tag is required' ); + test_diag( ' (5:1) <html> tag is required' ); + test_diag( ' (5:1) <title> tag is required' ); + html_ok( $not_so_good_html, 'Called html_ok' ); + test_test( 'html_ok works on wonky fragment' ); +} + +HTML_FRAGMENT_OK: { + test_out( 'not ok 1 - Called html_fragment_ok' ); + test_fail( +4 ); + test_diag( 'Errors: Called html_fragment_ok' ); + test_diag( ' (3:5) <img src="alpha.jpg"> does not have ALT text defined' ); + test_diag( ' (4:5) <input name="" type="image"> does not have non-blank ALT text defined' ); + html_fragment_ok( $not_so_good_html, 'Called html_fragment_ok' ); + test_test( 'html_fragment_ok works on wonky fragment' ); +} + + +# HTML that is a valid fragment, but not a valid document. +my $ok_fragment = <<'HTML'; +<p> + This is a valid fragment (with some errors), but an incomplete document. + <img src="alpha.jpg" height="21" width="12" alt="alpha"> + <input type="image" alt="foo"> +</p> +HTML + +HTML_OK: { + test_out( 'not ok 1 - Called html_ok' ); + test_fail( +6 ); + test_diag( 'Errors: Called html_ok' ); + test_diag( ' (5:1) <body> tag is required' ); + test_diag( ' (5:1) <head> tag is required' ); + test_diag( ' (5:1) <html> tag is required' ); + test_diag( ' (5:1) <title> tag is required' ); + html_ok( $ok_fragment, 'Called html_ok' ); + test_test( 'html_ok gets back doc-level errors on fragment' ); +} + +HTML_FRAGMENT_OK: { + test_out( 'ok 1 - Called html_fragment_ok' ); + html_fragment_ok( $ok_fragment, 'Called html_fragment_ok' ); + test_test( 'html_fragment_ok passes on fragment' ); +} diff -Nru libhtml-lint-perl-2.22+dfsg/t/20-error-types-skip.t libhtml-lint-perl-2.26+dfsg/t/20-error-types-skip.t --- libhtml-lint-perl-2.22+dfsg/t/20-error-types-skip.t 2015-03-31 18:12:11.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/t/20-error-types-skip.t 2016-12-24 04:39:20.000000000 +0000 @@ -13,18 +13,21 @@ my $lint = HTML::Lint->new(); isa_ok( $lint, 'HTML::Lint' ); $lint->parse( $text ); + $lint->eof; is( scalar $lint->errors, 1, 'One error with a clean lint' ); $lint->newfile(); $lint->clear_errors(); $lint->only_types( HELPER, FLUFF ); $lint->parse( $text ); + $lint->eof; is( scalar $lint->errors, 0, 'No errors if helper & fluff' ); $lint->newfile(); $lint->clear_errors(); $lint->only_types( STRUCTURE ); $lint->parse( $text ); + $lint->eof; my @errors = $lint->errors; if ( !is( scalar @errors, 1, 'One error if we specify STRUCTURE if we turn it off' ) ) { diag( $_->as_string ) for @errors; diff -Nru libhtml-lint-perl-2.22+dfsg/t/40-where.t libhtml-lint-perl-2.26+dfsg/t/40-where.t --- libhtml-lint-perl-2.22+dfsg/t/40-where.t 2015-03-31 18:12:11.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/t/40-where.t 2016-12-24 04:39:20.000000000 +0000 @@ -1,22 +1,18 @@ -#!perl -Tw - -use warnings; use strict; +use warnings; +require 't/LintTest.pl'; -use Test::More tests => 4; - -BEGIN { use_ok( 'HTML::Lint' ); } - -my $lint = HTML::Lint->new(); -isa_ok( $lint, "HTML::Lint" ); -$lint->parse( '</body>' ); +my $html = '</body>'; -my @errors = $lint->errors; -my $error = shift @errors; -is( $error->as_string, " (1:1) </body> with no opening <body>", "Got expected error" ); -is( scalar @errors, 0, "No more errors" ); +checkit( [ + [ 'elem-unopened' => 'Set #1 (1:1) </body> with no opening <body>' ], + [ 'doc-tag-required' => 'Set #1 (1:1) <body> tag is required' ], + [ 'doc-tag-required' => 'Set #1 (1:1) <head> tag is required' ], + [ 'doc-tag-required' => 'Set #1 (1:1) <html> tag is required' ], + [ 'doc-tag-required' => 'Set #1 (1:1) <title> tag is required' ], +], [$html] ); -__DATA__ +__END__ This doesn't test the error finding as much as the where() method. It fixes the following bug: diff -Nru libhtml-lint-perl-2.22+dfsg/t/api-eof-not-called.t libhtml-lint-perl-2.26+dfsg/t/api-eof-not-called.t --- libhtml-lint-perl-2.22+dfsg/t/api-eof-not-called.t 1970-01-01 00:00:00.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/t/api-eof-not-called.t 2016-12-24 04:39:20.000000000 +0000 @@ -0,0 +1,21 @@ +#!perl + +use warnings; +use strict; + +use Test::More tests => 3; + +use HTML::Lint; +use HTML::Lint::HTML4; + + +my $lint = HTML::Lint->new; +isa_ok( $lint, 'HTML::Lint', 'Created lint object' ); + +$lint->newfile( '<DATA>' ); +$lint->parse( '<p>Blah blah</p>' ); +my @errors = $lint->errors(); +cmp_ok( scalar @errors, '>', 0, 'Should get back at least one error' ); + +my $error = $errors[-1]; +is( $error->errcode, 'api-eof-not-called', 'The last error in the list is the API error' ); diff -Nru libhtml-lint-perl-2.22+dfsg/t/api-parse-not-called.t libhtml-lint-perl-2.26+dfsg/t/api-parse-not-called.t --- libhtml-lint-perl-2.22+dfsg/t/api-parse-not-called.t 1970-01-01 00:00:00.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/t/api-parse-not-called.t 2016-12-24 04:39:20.000000000 +0000 @@ -0,0 +1,21 @@ +#!perl + +use warnings; +use strict; + +use Test::More tests => 3; + +use HTML::Lint; +use HTML::Lint::HTML4; + + +my $lint = HTML::Lint->new; +isa_ok( $lint, 'HTML::Lint', 'Created lint object' ); + +$lint->newfile( '<DATA>' ); +$lint->eof; +my @errors = $lint->errors(); +cmp_ok( scalar @errors, '>', 0, 'Should get back at least one error' ); + +my $error = $errors[-1]; +is( $error->errcode, 'api-parse-not-called', 'The last error in the list is the API error' ); diff -Nru libhtml-lint-perl-2.22+dfsg/t/text-unclosed-entity.t libhtml-lint-perl-2.26+dfsg/t/text-unclosed-entity.t --- libhtml-lint-perl-2.22+dfsg/t/text-unclosed-entity.t 2015-03-31 18:12:11.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/t/text-unclosed-entity.t 2016-12-07 04:45:48.000000000 +0000 @@ -7,6 +7,8 @@ checkit( [ [ 'text-unclosed-entity' => qr/Entity ö is missing its closing semicolon/ ], + [ 'text-unclosed-entity' => qr/Entity ? is missing its closing semicolon/ ], + [ 'text-unknown-entity' => qr/Entity &middle is unknown/ ], ], [<DATA>] ); __DATA__ @@ -22,8 +24,10 @@ </script> </head> <body bgcolor="white"> - Motörhead rulez! + Motö rhead rulez! + ⊃ ² But can we find an unclosed entity at the end of the line ? <p> + What about unclosed unknown entities in the &middle of the line? Here's an awesome link to <a href="http://www.youtube.com/watch?v=8yLhA0ROGi4&feature=related">"You Better Swim"</a> from the SpongeBob movie. <!-- Here in the safety of comments, we can put whatever &invalid; and &malformed entities we want, & diff -Nru libhtml-lint-perl-2.22+dfsg/t/text-use-entity.t libhtml-lint-perl-2.26+dfsg/t/text-use-entity.t --- libhtml-lint-perl-2.22+dfsg/t/text-use-entity.t 2015-03-31 18:12:11.000000000 +0000 +++ libhtml-lint-perl-2.26+dfsg/t/text-use-entity.t 2016-12-08 04:19:55.000000000 +0000 @@ -1,13 +1,15 @@ +use utf8; use warnings; use strict; require 't/LintTest.pl'; checkit( [ [ 'text-use-entity' => qr/Character "\\x0B" should be written as / ], + [ 'text-use-entity' => qr/Character "\\x38C" should be written as Ό/ ], [ 'text-use-entity' => qr/Character "\\xF1" should be written as ñ/ ], [ 'text-use-entity' => qr/Character "&" should be written as &/ ], - [ 'text-use-entity' => qr/Character "&" should be written as &/ ], [ 'text-unclosed-entity' => qr/Entity ö is missing its closing semicolon/ ], + [ 'text-use-entity' => qr/Character "&" should be written as &/ ], ], [<DATA>] ); __DATA__ @@ -25,9 +27,11 @@ <body bgcolor="white"> Here's a non-entityable char [ ]. <P> - We'll get to it mañana, which should really have an ñ. + And here's a non-entityable char over 255 [ÎŒ]. + <P> + We'll get to it mañana, which should really have an ñ. <p> - Who wants a peanut butter & jelly? Motörhead does! They love rock & + Who wants a peanut butter & jelly? Motö rhead does! They love rock & roll! <p> Here's an awesome link to <a href="http://www.youtube.com/watch?v=8yLhA0ROGi4&feature=related">"You Better Swim"</a> from the SpongeBob movie.