/usr/bin/weblint is in weblint-perl 2.20+dfsg-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | #!/usr/bin/perl -w
eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
if 0; # not running under some shell
use warnings;
use strict;
use Getopt::Long;
use HTML::Lint;
use HTML::Lint::HTML4;
my $help;
my $context;
my $structure = 1;
my $helper = 1;
my $fluff = 1;
GetOptions(
'help' => \$help,
'context:i' => \$context,
'only' => sub { $structure = $helper = $fluff = 0; },
'structure!' => \$structure,
'helper!' => \$helper,
'fluff!' => \$fluff,
) or $help = 1;
if ( !@ARGV || $help ) {
print "weblint v$HTML::Lint::VERSION\n";
print <DATA>;
exit 1;
}
my @types;
push( @types, HTML::Lint::Error::STRUCTURE ) if $structure;
push( @types, HTML::Lint::Error::HELPER ) if $helper;
push( @types, HTML::Lint::Error::FLUFF ) if $fluff;
my $lint = HTML::Lint->new;
$lint->only_types( @types ) if @types;
for my $url ( @ARGV ) {
my @lines;
$lint->newfile( $url );
if ( $url =~ /^https?:/ ) {
eval { require LWP::Simple };
if ( $@ ) {
warn q{Can't retrieve URLs without LWP::Simple installed};
next;
}
my $content = LWP::Simple::get( $url );
if ( $content ) {
@lines = split( /\n/, $content );
$_ = "$_\n" for @lines;
}
else {
warn "Unable to fetch $url\n";
next;
}
}
else {
open( my $fh, '<', $url ) or die "Can't open $url: $!";
@lines = <$fh>;
close $fh or die $!;
}
$lint->parse( $_ ) for @lines;
$lint->eof();
for my $error ( $lint->errors() ) {
print $error->as_string(), "\n";
if ( defined $context ) {
$context += 0;
my $lineno = $error->line - 1;
my $start = $lineno-$context;
$start = 0 if $start < 0;
my $end = $lineno+$context;
$end = $#lines if $end > $#lines;
print " $_\n" for @lines[$start..$end];
print "\n";
}
}
$lint->clear_errors();
} # for files
__END__
Usage: weblint [filename or url]... (filename - reads STDIN)
--help This message
--context[=n] Show the offending line (and n surrounding lines)
Error types: (default: all on)
--[no]structure Structural issues, like unclosed tag pairs
--[no]helper Helper issues, like missing HEIGHT & WIDTH
--[no]fluff Fluff that can be removed, like bad tag attributes
--only Turns off all other error types, as in --only --fluff
|