htacg / tidy-html5

The granddaddy of HTML tools, with support for modern standards
http://www.html-tidy.org
2.7k stars 414 forks source link

Lower-case hex-color #874

Open Winand opened 4 years ago

Winand commented 4 years ago

I cannot find an information if tidylib always converts hex-color to upper case. Is it inevitable or there's an option? I just want to leave the value as is.

D:\andray\Software\Python\_dist\tidy>tidy
<p bgcolor="#277f8f"></p>
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 1 column 1 - Warning: inserting implicit <body>
^Z
line 1 column 1 - Warning: inserting missing 'title' element
line 1 column 1 - Warning: <p> proprietary attribute "bgcolor"
Info: Document content looks like HTML5
Tidy found 4 warnings and 0 errors!

<!DOCTYPE html>
<html>
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Windows version 5.6.0">
<title></title>
</head>
<body>
<p bgcolor="#277F8F"></p>
</body>
</html>
geoffmcl commented 3 years ago

@Winand, had never noticed, but I think you are right...

Why is Tidy altering that attributes quoted string? Can not see any good reason...

It does NOT do that in other cases, like -

<style>
.bgc {background-color: #277f8f;}
</style>

If no good reason found, suggest Tidy NOT translate that hex string... or at least an option, to turn it off...

Need some feedback, discussion, patches, PR, to move this issue forward... thanks...