Ace of ♠ is your single source for everything related to Motörhead.
Here's an icon of my girlfriend Jenny:
And here's an icon of a deceased cow:
Another deceased cow: &xdeadbeef;
Here's an awesome link to "You Better Swim" from the SpongeBob movie.
libhtml-lint-perl-2.22+dfsg.orig/t/elem-img-alt-missing.t 0000644 0001750 0001750 00000000606 12506561573 021043 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'elem-img-alt-missing' => qr/ does not have ALT text defined/i ],
], [] );
__DATA__
Test stuff
This is my paragraph
libhtml-lint-perl-2.22+dfsg.orig/t/config-unknown-directive.t 0000644 0001750 0001750 00000000740 12506561573 022037 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
# [ 'config-unknown-directive' => q{Set #1 (6:5) Unknown directive "bongo"} ],
[ 'config-unknown-directive' => qr/Unknown directive "bongo"$/ ],
], [] );
__DATA__
Test stuff
libhtml-lint-perl-2.22+dfsg.orig/t/text-unclosed-entity.t 0000644 0001750 0001750 00000001554 12506561573 021235 0 ustar fs fs #!perl
use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'text-unclosed-entity' => qr/Entity ö is missing its closing semicolon/ ],
], [] );
__DATA__
Ace of ♠: A tribute to Motörhead.
Motörhead rulez!
Here's an awesome link to "You Better Swim" from the SpongeBob movie.
libhtml-lint-perl-2.22+dfsg.orig/t/50-multiple-files.t 0000644 0001750 0001750 00000001752 12506561573 020302 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
my @files = get_paragraphed_files();
checkit( [
[ 'elem-unopened' => qr/<\/p> with no opening
/i ],
[ 'elem-unclosed' => qr/ at \(6:5\) is never closed/i ],
[ 'elem-unclosed' => qr/ at \(7:5\) is never closed/i ],
[ 'elem-unopened' => qr/<\/b> with no opening /i ],
], @files );
__DATA__
Test stuff
This is my paragraph
Test stuff
This is my paragraph
This is another paragraph
Test stuff
Gratuitous unnecessary closing tag that does NOT match to the opening [B] above.
This is my paragraph
libhtml-lint-perl-2.22+dfsg.orig/t/elem-unopened.t 0000644 0001750 0001750 00000000460 12506561573 017655 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'elem-unopened' => qr/<\/p> with no opening
/i ],
], [] );
__DATA__
Test stuff
This is my paragraph
libhtml-lint-perl-2.22+dfsg.orig/t/config-unknown-value.t 0000644 0001750 0001750 00000001245 12506561573 021176 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'config-unknown-value' => qr/Unknown value "14" for elem-img-sizes-missing directive$/ ],
], [] );
__DATA__
Test stuff
libhtml-lint-perl-2.22+dfsg.orig/t/60-add-tags.t 0000644 0001750 0001750 00000001436 12510570631 017021 0 ustar fs fs #!perl
use warnings;
use strict;
require 't/LintTest.pl';
use HTML::Lint::HTML4;
# This test is the same as t/attr-unknown.t, but with tag table modification.
HTML::Lint::HTML4::add_attribute( 'p', 'food' );
HTML::Lint::HTML4::add_attribute( 'body', 'cuisine' );
HTML::Lint::HTML4::add_tag( 'meal' );
HTML::Lint::HTML4::add_attribute( 'meal', 'type' );
checkit( [
[ 'attr-unknown' => qr/Unknown attribute "Yummy" for tag /i ],
], [] );
__DATA__
Test stuff
This is my paragraph about burritos
This is my paragraph about refried beansSteak burrito
libhtml-lint-perl-2.22+dfsg.orig/t/elem-unknown.t 0000644 0001750 0001750 00000000733 12506561573 017542 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'elem-unknown' => qr/unknown element /i ],
[ 'elem-unclosed' => qr/ at \(\d+:\d+\) is never closed/i ],
], [] );
__DATA__
Test stuff
This is my paragraph
libhtml-lint-perl-2.22+dfsg.orig/t/LintTest.pl 0000644 0001750 0001750 00000003122 12507334676 017037 0 ustar fs fs use Test::More;
use HTML::Lint;
sub checkit {
my @expected = @{+shift};
my @linesets = @_;
plan( tests => 3*(scalar @expected) + 4 );
my $lint = new HTML::Lint;
isa_ok( $lint, 'HTML::Lint', 'Created lint object' );
my $n;
for my $set ( @linesets ) {
++$n;
$lint->newfile( "Set #$n" );
$lint->parse( $_ ) for @$set;
$lint->eof;
}
my @errors = $lint->errors();
is( scalar @errors, scalar @expected, 'Right # of errors' );
while ( @errors && @expected ) {
my $error = shift @errors;
isa_ok( $error, 'HTML::Lint::Error' );
my $expected = shift @expected;
is( $error->errcode, $expected->[0], 'Error codes match' );
my $match = $expected->[1];
if ( ref $match eq "Regexp" ) {
like( $error->as_string, $match, 'Error matches regex' );
}
else {
is( $error->as_string, $match, 'Error matches string' );
}
}
my $dump;
is( scalar @errors, 0, 'No unexpected errors found' ) or $dump = 1;
is( scalar @expected, 0, 'No expected errors missing' ) or $dump = 1;
if ( $dump && @errors ) {
diag( "Leftover errors..." );
diag( $_->as_string ) for @errors;
}
}
# Read in a set of sets of lines, where each "file" is separated by a
# blank line in
sub get_paragraphed_files {
local $/ = "";
my @sets;
while ( my $paragraph = ) {
my @lines = split /\n/, $paragraph;
@lines = map { "$_\n" } @lines;
push( @sets, [@lines] );
}
return @sets;
}
1; # happy
libhtml-lint-perl-2.22+dfsg.orig/t/strong-id.t 0000644 0001750 0001750 00000001643 12506561573 017032 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'attr-unknown' => qr/Unknown attribute "bongo" for tag / ],
], [] );
=pod
HTML::Lint 2.02 and weblint, Red Hat EL 3
This should result in no warnings:
echo 'qwerasdf' | weblint -
- (1:45) Unknown attribute "id" for tag
but it gives:
- (1:45) Unknown attribute "id" for tag
id is a core attribute in HTML4/XHTML1: http://www.w3.org/TR/html4/html40.txt
=cut
__DATA__
Test stuff
libhtml-lint-perl-2.22+dfsg.orig/t/attr-repeated.t 0000644 0001750 0001750 00000000474 12506561573 017666 0 ustar fs fs use strict;
use warnings;
require 't/LintTest.pl';
checkit( [
[ 'attr-repeated' => qr/ALIGN attribute in
is repeated/i ],
], [] );
__DATA__
Test stuff
This is my paragraph
libhtml-lint-perl-2.22+dfsg.orig/t/doc-tag-required.t 0000644 0001750 0001750 00000000442 12506561573 020254 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'doc-tag-required' => qr/ tag is required/ ],
], [] );
__DATA__
Test stuff
This is my paragraph
libhtml-lint-perl-2.22+dfsg.orig/t/12-html_fragment_ok.t 0000644 0001750 0001750 00000001167 12510570631 020653 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
# This test passes the HTML into html_ok, which expects a fully-formed
# HTML document.
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__
This is a valid fragment, but an incomplete document.
libhtml-lint-perl-2.22+dfsg.orig/t/30-test-builder.t 0000644 0001750 0001750 00000000416 12510570631 017732 0 ustar fs fs #!perl -Tw
use warnings;
use strict;
# The test is not that html_ok() works, but that the tests=>1 gets
# acts as it should.
use Test::HTML::Lint tests=>1;
my $chunk = 'A fine chunk of code';
html_ok( $chunk );
libhtml-lint-perl-2.22+dfsg.orig/t/elem-unclosed.t 0000644 0001750 0001750 00000000655 12506561573 017662 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'elem-unclosed' => qr/\Q at (6:5) is never closed/i ],
[ 'elem-unclosed' => qr/\Q at (7:5) is never closed/i ],
], [] );
__DATA__
Test stuff
This is my paragraph
This is another paragraph
libhtml-lint-perl-2.22+dfsg.orig/t/pod.t 0000644 0001750 0001750 00000000215 12506561573 015700 0 ustar fs fs #!perl -Tw
use Test::More;
eval "use Test::Pod 1.14";
plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
all_pod_files_ok();
libhtml-lint-perl-2.22+dfsg.orig/t/elem-nonrepeatable.t 0000644 0001750 0001750 00000000557 12506561573 020666 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'elem-nonrepeatable' => qr/ is not repeatable, but already appeared at \(3:2\)/i ],
], [] );
__DATA__
Test stuffAs if one title isn't enough
This is my paragraph
libhtml-lint-perl-2.22+dfsg.orig/t/20-error-types-skip.t 0000644 0001750 0001750 00000003031 12506561573 020573 0 ustar fs fs #!perl -Tw
use strict;
use warnings;
use Test::More tests => 10;
BEGIN { use_ok( 'HTML::Lint' ); }
BEGIN { use_ok( 'HTML::Lint::Error', ':types' ); }
my $text = do { local $/ = undef; };
FUNC_METHOD: {
my $lint = HTML::Lint->new();
isa_ok( $lint, 'HTML::Lint' );
$lint->parse( $text );
is( scalar $lint->errors, 1, 'One error with a clean lint' );
$lint->newfile();
$lint->clear_errors();
$lint->only_types( HELPER, FLUFF );
$lint->parse( $text );
is( scalar $lint->errors, 0, 'No errors if helper & fluff' );
$lint->newfile();
$lint->clear_errors();
$lint->only_types( STRUCTURE );
$lint->parse( $text );
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;
}
}
CONSTRUCTOR_METHOD_SCALAR: {
my $lint = HTML::Lint->new( only_types => STRUCTURE );
isa_ok( $lint, 'HTML::Lint' );
$lint->parse( $text );
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;
}
}
CONSTRUCTOR_METHOD_ARRAYREF: {
my $lint = HTML::Lint->new( only_types => [HELPER, FLUFF] );
isa_ok( $lint, 'HTML::Lint' );
$lint->parse( $text );
is( scalar $lint->errors, 0, 'No errors if helper & fluff' );
}
__DATA__
Test stuff
This is my paragraph
libhtml-lint-perl-2.22+dfsg.orig/t/10-test-html-lint.t 0000644 0001750 0001750 00000000532 12510570631 020211 0 ustar fs fs #!perl -Tw
use warnings;
use strict;
use Test::More tests => 3;
use Test::HTML::Lint;
BEGIN {
use_ok( 'Test::HTML::Lint' );
}
my $chunk = 'A fine chunk of code';
TODO: { # undef should fail
local $TODO = "This test should NOT succeed";
html_ok( undef );
}
html_ok( $chunk );
libhtml-lint-perl-2.22+dfsg.orig/t/20-error-types.t 0000644 0001750 0001750 00000001013 12506561573 017625 0 ustar fs fs #!perl -Tw
use warnings;
use strict;
use Test::More tests => 5;
BEGIN { use_ok( 'HTML::Lint::Error' ); }
my $err = HTML::Lint::Error->new( undef, undef, undef, 'elem-empty-but-closed' );
ok( $err->is_type( HTML::Lint::Error::STRUCTURE ) );
ok( !$err->is_type( HTML::Lint::Error::FLUFF, HTML::Lint::Error::HELPER ) );
$err = HTML::Lint::Error->new( undef, undef, undef, 'attr-unknown' );
ok( $err->is_type( HTML::Lint::Error::FLUFF ) );
ok( !$err->is_type( HTML::Lint::Error::STRUCTURE, HTML::Lint::Error::HELPER ) );
libhtml-lint-perl-2.22+dfsg.orig/t/02-versions.t 0000644 0001750 0001750 00000000632 12506561573 017210 0 ustar fs fs #!perl -Tw
use warnings;
use strict;
use Test::More tests => 5;
BEGIN {
use_ok( 'HTML::Lint::Parser' );
}
BEGIN {
use_ok( 'HTML::Lint' );
}
BEGIN {
use_ok( 'Test::HTML::Lint' );
}
is( $HTML::Lint::VERSION, $Test::HTML::Lint::VERSION, 'HTML::Lint and Test::HTML::Lint versions match' );
is( $HTML::Lint::VERSION, $HTML::Lint::Parser::VERSION, 'HTML::Lint and Test::HTML::Lint versions match' );
libhtml-lint-perl-2.22+dfsg.orig/t/elem-img-sizes-missing.t 0000644 0001750 0001750 00000001124 12506561573 021414 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'elem-img-sizes-missing' => qr/\Q tag has no HEIGHT and WIDTH attributes/i ],
[ 'elem-img-sizes-missing' => qr/\Q tag has no HEIGHT and WIDTH attributes/i ],
], [] );
__DATA__
Test stuff
This is my paragraph
libhtml-lint-perl-2.22+dfsg.orig/t/xhtml-html.t 0000644 0001750 0001750 00000002251 12506561573 017216 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
], [] );
__DATA__
Test stuff
This test brought to you by Mötley Crüe.
Blah blah blah
Now listen up
She's razor sharp
If she don't get her way
She'll slice you apart
Now she's cool cool black
Moves like a cat
If you don't get her game
You might not make it back
(Pre chorus)
She's got the look's that kill
That kill
She's got the look's that kill
That kill
(Chorus)
She's got the looks that kill
Now she's bullet proof
Keeps her motor clean
And believe me you
She's a number thirteen
The church strikes midnight
She's lookin' louder and louder
She's gonna turn on your juice, boy
So she turns on the power
(Pre-chorus)
She's got the looks that kill
(Chorus)(Solo)(Verse)(Pre-chorus)(Chorus)
libhtml-lint-perl-2.22+dfsg.orig/t/elem-empty-but-closed.t 0000644 0001750 0001750 00000000477 12506561573 021245 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'elem-empty-but-closed' => qr/ is not a container -- <\/hr> is not allowed/ ],
], [] );
__DATA__
Test stuffThis is a bad paragraph
libhtml-lint-perl-2.22+dfsg.orig/t/11-test-html-lint-overload.t 0000644 0001750 0001750 00000000702 12506561573 022034 0 ustar fs fs #!perl -Tw
use strict;
use warnings;
use Test::More tests => 4;
BEGIN { use_ok( 'Test::HTML::Lint' ); }
BEGIN { use_ok( 'HTML::Lint' ); }
BEGIN { use_ok( 'HTML::Lint::Error' ); }
my $lint = HTML::Lint->new();
$lint->only_types( HTML::Lint::Error::FLUFF );
# This code is invalid, but the linter should ignore it
my $chunk = << 'END';
This is a fine chunk of code
END
html_ok( $lint, $chunk, 'STRUCTUREally naughty code passed' );
libhtml-lint-perl-2.22+dfsg.orig/t/text-unknown-entity.t 0000644 0001750 0001750 00000001373 12506561573 021117 0 ustar fs fs #!perl
use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'text-unknown-entity' => qr/Entity &metalhorns; is unknown/ ],
], [] );
__DATA__
Ace of ♠: A tribute to Motörhead. ® &metalhorns;
Thanks for visiting Ace of ♠
Here's an awesome link to "You Better Swim" from the SpongeBob movie.
libhtml-lint-perl-2.22+dfsg.orig/t/20-error-types-export.t 0000644 0001750 0001750 00000000643 12506561573 021154 0 ustar fs fs #!perl -Tw
use warnings;
use strict;
use Test::More tests => 5;
BEGIN { use_ok( 'HTML::Lint::Error', ':types' ); }
my $err = HTML::Lint::Error->new( undef, undef, undef, 'elem-empty-but-closed' );
ok( $err->is_type( STRUCTURE ) );
ok( !$err->is_type( FLUFF, HELPER ) );
$err = HTML::Lint::Error->new( undef, undef, undef, 'attr-unknown' );
ok( $err->is_type( FLUFF ) );
ok( !$err->is_type( STRUCTURE, HELPER ) );
libhtml-lint-perl-2.22+dfsg.orig/t/elem-input-alt-missing.t 0000644 0001750 0001750 00000002157 12510570631 021417 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'elem-input-alt-missing' => qr/ does not have non-blank ALT text defined/i ],
[ 'elem-input-alt-missing' => qr/ does not have non-blank ALT text defined/i ],
[ 'elem-input-alt-missing' => qr/ does not have non-blank ALT text defined/i ],
[ 'elem-input-alt-missing' => qr/ does not have non-blank ALT text defined/i ],
], [] );
__DATA__
Test stuff
This is my paragraph
libhtml-lint-perl-2.22+dfsg.orig/t/attr-unknown.t 0000644 0001750 0001750 00000000734 12507334721 017565 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'attr-unknown' => qr/Unknown attribute "FOOD" for tag
/i ],
[ 'attr-unknown' => qr/Unknown attribute "Yummy" for tag /i ],
], [] );
__DATA__
Test stuff
This is my paragraph about burritos
This is my paragraph about refried beans
libhtml-lint-perl-2.22+dfsg.orig/t/00-load.t 0000644 0001750 0001750 00000000275 12506561573 016260 0 ustar fs fs #!perl -Tw
use Test::More tests => 2;
BEGIN {
use_ok( 'HTML::Lint' );
}
BEGIN {
use_ok( 'Test::HTML::Lint' );
}
diag( "Testing HTML::Lint $HTML::Lint::VERSION, Perl $], $^X" );
libhtml-lint-perl-2.22+dfsg.orig/t/40-where.t 0000644 0001750 0001750 00000002130 12506561573 016447 0 ustar fs fs #!perl -Tw
use warnings;
use strict;
use Test::More tests => 4;
BEGIN { use_ok( 'HTML::Lint' ); }
my $lint = HTML::Lint->new();
isa_ok( $lint, "HTML::Lint" );
$lint->parse( '' );
my @errors = $lint->errors;
my $error = shift @errors;
is( $error->as_string, " (1:1) with no opening ", "Got expected error" );
is( scalar @errors, 0, "No more errors" );
__DATA__
This doesn't test the error finding as much as the where() method.
It fixes the following bug:
Date: Mon, 22 Dec 2003 22:07:54 -0800
From: Adam Monsen
To: Andy Lester
Subject: HTML::Lint::Error bug
The following demonstrates a bug in HTML::Lint that is seen when an
offending tag is flush left ...
use HTML::Lint;
my $lint = HTML::Lint->new();
$lint->parse('');
warn $_->as_string."\n" for $lint->errors;
The warning I'm getting looks like this:
Argument "" isn't numeric in addition (+) at /usr/lib/perl5/site_perl/5.8.1/HTML/Lint/Error.pm line 176.
If I change the parse() call as follows (by adding a leading space):
$lint->parse(' ');
the warning disappears.
libhtml-lint-perl-2.22+dfsg.orig/t/01-coverage.t 0000644 0001750 0001750 00000000636 12506561573 017136 0 ustar fs fs #!perl -Tw
# This test verifies that there is a t/*.t file for every possible Lint error.
use Test::More 'no_plan';
BEGIN {
use_ok( 'HTML::Lint::Error' );
}
my @errors = do { no warnings; keys %HTML::Lint::Error::errors };
isnt( scalar @errors, 0, 'There are at least some errors to be found.' );
for my $error ( @errors ) {
my $filename = "t/$error.t";
ok( -e $filename, "$filename exists" );
}
libhtml-lint-perl-2.22+dfsg.orig/t/random-nobr.t 0000644 0001750 0001750 00000000620 12506561573 017334 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'elem-unknown' => qr/unknown element /i ],
[ 'elem-unclosed' => qr/ at \(\d+:\d+\) is never closed/i ],
], [] );
__DATA__
Test stuffNOBR is fine with me!But Donky is not
libhtml-lint-perl-2.22+dfsg.orig/t/pod-coverage.t 0000644 0001750 0001750 00000000307 12506561573 017473 0 ustar fs fs #!perl -Tw
use warnings;
use strict;
use Test::More;
eval "use Test::Pod::Coverage 1.04";
plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
all_pod_coverage_ok();
libhtml-lint-perl-2.22+dfsg.orig/t/text-use-entity.t 0000644 0001750 0001750 00000002542 12506561573 020213 0 ustar fs fs use warnings;
use strict;
require 't/LintTest.pl';
checkit( [
[ 'text-use-entity' => qr/Character "\\x0B" 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/ ],
], [] );
__DATA__
Test stuff
Here's a non-entityable char [].
We'll get to it maņana, which should really have an ñ.
Who wants a peanut butter & jelly? Motörhead does! They love rock &
roll!
Here's an awesome link to "You Better Swim" from the SpongeBob movie.
libhtml-lint-perl-2.22+dfsg.orig/lib/ 0000755 0001750 0001750 00000000000 12510570712 015224 5 ustar fs fs libhtml-lint-perl-2.22+dfsg.orig/lib/Test/ 0000755 0001750 0001750 00000000000 12510570712 016143 5 ustar fs fs libhtml-lint-perl-2.22+dfsg.orig/lib/Test/HTML/ 0000755 0001750 0001750 00000000000 12510570712 016707 5 ustar fs fs libhtml-lint-perl-2.22+dfsg.orig/lib/Test/HTML/Lint.pm 0000644 0001750 0001750 00000012054 12510570631 020155 0 ustar fs fs package Test::HTML::Lint;
use warnings;
use strict;
use Test::Builder;
use Exporter;
use HTML::Lint;
use vars qw( @ISA $VERSION @EXPORT );
@ISA = qw( HTML::Parser Exporter );
=head1 NAME
Test::HTML::Lint - Test::More-style wrapper around HTML::Lint
=head1 VERSION
Version 2.22
=cut
$VERSION = '2.22';
my $Tester = Test::Builder->new;
=head1 SYNOPSIS
use Test::HTML::Lint tests => 4;
my $table = build_display_table();
html_ok( $table, 'Built display table properly' );
=head1 DESCRIPTION
This module provides a few convenience methods for testing exception
based code. It is built with L and plays happily with
L and friends.
If you are not already familiar with L now would be the time
to go take a look.
=head1 EXPORT
C
=cut
@EXPORT = qw(
html_ok
html_fragment_ok
);
sub import {
my $self = shift;
my $pack = caller;
$Tester->exported_to($pack);
$Tester->plan(@_);
$self->export_to_level(1, $self, @EXPORT);
return;
}
=head2 html_ok( [$lint, ] $html, $name )
Checks to see if C<$html> is a valid HTML document, including checks
for having C<< >>, C<< >>, C<< > >> and
C<< >> tags.
If you're checking something that is only a fragment of an HTML document,
use C.
If you pass an HTML::Lint object, C will use that for its
settings.
my $lint = new HTML::Lint( only_types => STRUCTURE );
html_ok( $lint, $content, "Web page passes structural tests only" );
Otherwise, it will use the default rules.
html_ok( $content, "Web page passes ALL tests" );
Note that if you pass in your own HTML::Lint object, C
will clear its errors before using it.
=cut
sub html_ok {
my $lint;
if ( ref($_[0]) eq 'HTML::Lint' ) {
$lint = shift;
$lint->newfile();
$lint->clear_errors();
}
else {
$lint = HTML::Lint->new;
}
my $html = shift;
my $name = shift;
my $ok = defined $html;
if ( !$ok ) {
$Tester->ok( 0, $name );
}
else {
$lint->parse( $html );
$lint->eof();
my $nerr = scalar $lint->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;
}
}
return $ok;
}
=head2 html_fragment_ok( [$lint, ] $html, $name )
Checks that C<$fragment> is valid HTML, but not necessarily a valid
HTML document.
For example, this is a valid fragment, but not a valid HTML document:
Lorem ipsum
because it doesn't contain C<< >> and C<< >> tags. If you
want to check that it is a valid document, use C.
If you pass an HTML::Lint object, C will use that for its
settings.
my $lint = new HTML::Lint( only_types => STRUCTURE );
html_fragment_ok( $lint, $content, 'Web page passes structural tests only' );
Otherwise, it will use the default rules.
html_fragment_ok( $content, 'Fragment passes ALL tests' );
Note that if you pass in your own HTML::Lint object, C
will clear its errors before using it.
=cut
sub html_fragment_ok {
my $lint;
if ( ref($_[0]) eq 'HTML::Lint' ) {
$lint = shift;
$lint->newfile();
$lint->clear_errors();
}
else {
$lint = HTML::Lint->new;
}
my $html = shift;
my $name = shift;
my $ok = defined $html;
if ( !$ok ) {
$Tester->ok( 0, $name );
}
else {
$lint->parse( $html );
my $nerr = scalar $lint->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;
}
}
return $ok;
}
=head1 BUGS
All bugs and requests are now being handled through GitHub.
https://github.com/petdance/html-lint/issues
DO NOT send bug reports to http://rt.cpan.org/ or http://code.google.com/
=head1 TO DO
There needs to be a C to check that the HTML is a
self-contained, well-formed table, and then a comparable one for
C.
If you think this module should do something that it doesn't do at the
moment please let me know.
=head1 ACKNOWLEDGEMENTS
Thanks to chromatic and Michael G Schwern for the excellent Test::Builder,
without which this module wouldn't be possible.
Thanks to Adrian Howard for writing Test::Exception, from which most of
this module is taken.
=head1 COPYRIGHT & LICENSE
Copyright 2005-2015 Andy Lester.
This program is free software; you can redistribute it and/or modify
it under the terms of the Artistic License v2.0.
http://www.opensource.org/licenses/Artistic-2.0
Please note that these modules are not products of or supported by the
employers of the various contributors to the code.
=head1 AUTHOR
Andy Lester, C
=cut
1;
libhtml-lint-perl-2.22+dfsg.orig/lib/HTML/ 0000755 0001750 0001750 00000000000 12510570712 015770 5 ustar fs fs libhtml-lint-perl-2.22+dfsg.orig/lib/HTML/Lint/ 0000755 0001750 0001750 00000000000 12510570712 016676 5 ustar fs fs libhtml-lint-perl-2.22+dfsg.orig/lib/HTML/Lint/Error.pm 0000644 0001750 0001750 00000024763 12510570631 020341 0 ustar fs fs package HTML::Lint::Error;
use warnings;
use strict;
use base 'Exporter';
our @EXPORT = ();
our @EXPORT_OK = qw( STRUCTURE HELPER FLUFF );
our %EXPORT_TAGS = ( types => [@EXPORT_OK] );
our %errors;
=head1 NAME
HTML::Lint::Error - Error object for the Lint functionality
=head1 SYNOPSIS
See L for all the gory details.
=head1 EXPORTS
None. It's all object-based.
=head1 METHODS
Almost everything is an accessor.
=head1 Error types: C, C, C
Each error has a type. Note that these roughly, but not exactly, go
from most severe to least severe.
=over 4
=item * C
For problems that relate to the structural validity of the code.
Examples: Unclosed