Skip to content
This repository has been archived by the owner on Apr 14, 2019. It is now read-only.

Does not support HTML5 #36

Open
Gilwyad opened this issue Feb 14, 2015 · 3 comments
Open

Does not support HTML5 #36

Gilwyad opened this issue Feb 14, 2015 · 3 comments

Comments

@Gilwyad
Copy link

Gilwyad commented Feb 14, 2015

#!/usr/bin/perl -w

use strict;
use HTML::Lint;

my $lint = HTML::Lint->new();

my $data = q^

<!DOCTYPE html>
<html lang="en">
<head>
<title>html5 test</title>
</head>
<body>
<header>menu</header>
<time datetime="2015-01-25 21:56:23+00:00"></time>
</body>
</html>

^;

$lint->parse( $data );

foreach my $error ( $lint->errors ) {
    print $error->as_string, "\n";
}

prints the following errors when executed:

 (9:1) Unknown element <header>
 (10:1) Unknown element <time>

Is this module strictly for HTML4? Will 5 be ever supported? Or how can I ignore HTML5 elements?

What can I use to validate HTML5?

@petdance
Copy link
Owner

petdance commented Apr 1, 2015

HTML::Lint only supports HTML4. Chances are that it will never support HTML5. The W3C is updating the tidy tool to support HTML5, so that might be a place to look. https://github.com/htacg/tidy-html5

@Gilwyad
Copy link
Author

Gilwyad commented May 31, 2015

I'm assuming you mean only supports HTML4 and might never support HTML5.

Thanks, I ended up using HTML::Lint::Pluggable::HTML5, works perfectly with Test::WWW::Mechanize autolint.

my $lint = HTML::Lint::Pluggable->new();       # plugin system for HTML::Lint
$lint -> load_plugin("HTML5");                 # loads HTML::Lint::Pluggable::HTML5
$lint -> load_plugin("TinyEntitesEscapeRule"); # loads HTML::Lint::Pluggable::TinyEntitesEscapeRule

my $mech = Test::WWW::Mechanize->new(
                                     autolint => $lint,
                                     cookie_jar => undef
                                    );

@petdance
Copy link
Owner

Please take a look at https://github.com/petdance/html-tidy5

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants