HTML内タグの閉じ忘れをチェックするツール[ブックマークレット]
└ http://tockri.blog78.fc2.com/blog-entry-168.html
最近では、javascript (ajax)を使ってクライアント(ブラウザ)側で動的にページを生成することが多いので、あると便利あのかもしれません。ただ、純粋にhtmlファイルの文法?を確認するのであれば、HTML::Lint だって、まだまだ、使えると思います。
http://search.cpan.org/dist/HTML-Lint/
#!/usr/local/bin/perl use strict; use HTML::Lint; use Data::Dumper; main(@ARGV); sub main { my ($html_file) = @_; my $lint = HTML::Lint->new(); $lint->parse_file( $html_file ); for my $error ( $lint->errors ) { #日本語があると、「Invalid character 〜 should be written as 〜;」 #のようにうるさいので、無視しています next if $error->errcode() eq 'text-use-entity'; print $error->as_string, "\n"; } }
のようなperl scriptを書いて、
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head></head> <body> <h1>title</h1> <div>divの閉じタグなし </body> </html>
のようなhtmlを食わせると
[endo@colinux tmp]$ ./foo.pl test.html (8:1) <div> at (6:1) is never closed (9:1) <title> tag is required