Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy coverts valid XHTML5 to invalid XHTML 1.0 #431

Closed
chowbok opened this issue Jul 5, 2016 · 2 comments
Closed

Tidy coverts valid XHTML5 to invalid XHTML 1.0 #431

chowbok opened this issue Jul 5, 2016 · 2 comments

Comments

@chowbok
Copy link

chowbok commented Jul 5, 2016

Hi,

According to the W3C this is valid markup:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
<head>
<meta charset="utf-8"/>
<title>Tidy testcase</title>
</head>
<body>
<div><p>Foo</p></div>
</body>
</html>

But when I run that through tidy (version 5.3.5), it changes the doctype to:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Which makes it invalid, due to the "meta charset" line. Seems like tidy shouldn't be changing the doctype in this case.

@geoffmcl
Copy link
Contributor

geoffmcl commented Jul 8, 2016

@chowbok thanks for the report...

However when I run your sample through tidy 5.3.5, default config, I get -

F:\Projects\tidy-test\test>tidy5 input5\in_431.xhtml
Info: Document content looks like XHTML5
No warnings or errors were found.

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang=
"en-us">
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Windows version 5.3.5" />
<meta charset="utf-8" />
<title>Tidy testcase</title>
</head>
<body>
<div>
<p>Foo</p>
</div>
</body>
</html>

...

So what config items did you add to cause tidy to change the doctype?

I note when I add the option --doctype strict, I do get a bad <meta charset="utf-8"... Is this what you refer to here?

I guess that should be replaced with say <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> to match the DTD XHTML 1.0 Strict...

But maybe there are other output, or other config options, to also be taken into account...

Please explain more... thanks...

@geoffmcl geoffmcl added this to the 5.3 milestone Jul 8, 2016
@chowbok
Copy link
Author

chowbok commented Jul 8, 2016

Aha, I forgot I had doctype set to strict in my tidyrc. Sorry about that. Looks good now.

@chowbok chowbok closed this as completed Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants