Subject: | Add TIDY_ACCESSIBILITY |
While working with HTML::Tidy I found that it was returning messages
containing accessibility information we weren't overly concerned with so
I tried changing the accessibility-check only to have HTML::Tidy spew
heaps of notices to stderr.
Attached is a patch that catches those notices, makes them filterable,
and/or returnable as TIDY_ACCESSIBILITY messages
Subject: | Tidy.diff |
diff -ru Old/HTML/Tidy/Message.pm New/HTML/Tidy/Message.pm
--- Old/HTML/Tidy/Message.pm 2010-06-07 14:56:17.000000000 +1000
+++ New/HTML/Tidy/Message.pm 2010-06-07 14:57:00.000000000 +1000
@@ -98,6 +98,7 @@
1 => 'Info',
2 => 'Warning',
3 => 'Error',
+ 4 => 'Accessibility',
);
return sprintf( '%s %s %s: %s',
diff -ru Old/HTML/Tidy.pm New/HTML/Tidy.pm
--- Old/HTML/Tidy.pm 2010-06-07 14:41:06.000000000 +1000
+++ New/HTML/Tidy.pm 2010-06-07 14:43:33.000000000 +1000
@@ -47,11 +47,12 @@
use base 'Exporter';
-use constant TIDY_ERROR => 3;
-use constant TIDY_WARNING => 2;
-use constant TIDY_INFO => 1;
+use constant TIDY_ACCESSIBILITY => 4;
+use constant TIDY_ERROR => 3;
+use constant TIDY_WARNING => 2;
+use constant TIDY_INFO => 1;
-our @EXPORT = qw( TIDY_ERROR TIDY_WARNING TIDY_INFO );
+our @EXPORT = qw( TIDY_ACCESSIBILITY TIDY_ERROR TIDY_WARNING TIDY_INFO );
=head1 METHODS
@@ -248,9 +249,10 @@
chomp $line;
my $message;
- if ( $line =~ /^line (\d+) column (\d+) - (Warning|Error|Info): (.+)$/ ) {
+ if ( $line =~ /^line (\d+) column (\d+) - (Warning|Error|Info|Access): (.+)$/ ) {
my ($line, $col, $type, $text) = ($1, $2, $3, $4);
$type =
+ ($type eq 'Access') ? TIDY_ACCESSIBILITY :
($type eq 'Warning') ? TIDY_WARNING :
($type eq 'Info') ? TIDY_INFO :
TIDY_ERROR;
@@ -279,6 +281,10 @@
# Summary line we don't want
}
+ elsif ( $line =~ /Accessibility Checks: Version/ ) {
+ # Summary line we don't want
+
+ }
elsif ( $line =~ m/^\s*$/ ) {
# Blank line we don't want