html-tidy icon indicating copy to clipboard operation
html-tidy copied to clipboard

Requireing quotes around attribute values

Open szabgab opened this issue 10 years ago • 4 comments

Is there a way to ask HTML::Tidy to report cases where the HTML code does not have quotes around the attributes? Like in this case:

<td class=label>

szabgab avatar Oct 24 '14 21:10 szabgab

Looks like the example is missing in the above comment (perhaps GH misinterpreted the HTML fragment?), but I guess @szabgab had something like that on mind:

<p class=foo>text</p>

holcapek avatar Jan 09 '15 23:01 holcapek

To address the question, based on the statement below (found in tidyp documentation), I would say no, there is no way to report such cases:

Things awaiting further attention ... Noticing that the document isn't really XHTML if it isn't wellformed, i.e. it lacks end tags and quotes on attribute values

https://github.com/petdance/tidyp/blob/9d13f64b4a2955d95d5f870b14978bbbdc84a30c/htmldoc/pending.html#L86

holcapek avatar Jan 09 '15 23:01 holcapek

Oh, I've forgotten to tripple-quote the code-snippet and so SO did not show it. Now fixed and you are right.

szabgab avatar Jan 10 '15 08:01 szabgab

@szabgab, @holcapek sorry to be years late to this issue ;=))

As @petdance sort of points out in the blog, there is no way to ask HTML::Tidy, based on tidyp, which was based on cvs C HTML Tidy library, to warn about this, but the C library does silently fix the issue...

Now there is discussion to replacing tidyp, with a now well maintained modern libtidy, but even modern C HTML Tidy library still does not warn about this!

But there is active discussion on this topic... see Issue 412, and Issue 561, for a broader discussion, and I am sure there have been other HTML Tidy issues on this...

The general consensus seems to be that there should at least be an option to ask libTidy to report such situations, even though it does silently provide the fix in the cleaned output...

So if @petdance embraces this change, which he seems to, then the correct place to file such an issue would be here... Then if added to C HTML Tidy library, perl HTML::Tidy would automatically benefit... thanks...

I have now completed both a Windows and Linux build of such a perl HTML::Tidy update in my fork, in the test1 branch, for Windows, and the test2 branch, for Linux... still a WIP... but any help or testing would be greatly appreciated... thanks...

geoffmcl avatar May 29 '17 19:05 geoffmcl