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

Make tidy generate an error/warning if there are angle brackets #723

Open
petdance opened this issue Apr 23, 2018 · 3 comments
Open

Make tidy generate an error/warning if there are angle brackets #723

petdance opened this issue Apr 23, 2018 · 3 comments

Comments

@petdance
Copy link
Contributor

$ cat -n foo.html
     1  <!DOCTYPE html>
     2  <html>
     3      <head>
     4          <title> </title>
     5      </head>
     6      <body>
     7          This & that.
     8          Unescaped open angle bracket < and an unescaped close bracket >.
     9      </body>
    10  </html>

I was surprised that Tidy did not complain about the < and > on line 8.

$ tidy -q -e foo.html
$ tidy -q foo.html
<!DOCTYPE html>
<html>
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Linux version 5.6.0">
<title></title>
</head>
<body>
This & that. Unescaped open angle bracket &lt; and an unescaped
close bracket &gt;.
</body>
</html>

The -e showed no errors, and tidy just automatically converted > to &gt; and < to &lt;. I was expecting it to complain. Or did I miss a config option?

@geoffmcl
Copy link
Contributor

@petdance yes, this is one of the silent fixes tidy has virtually always done... no missing config option that I can think of...

There are several previous issues talking about these silent fixes... and while, in general, I too feel tidy should warn, at least as a user education tool, of such fixes, several have been allowed to stand over time...

As mentioned elsewhere, basically tidy has at least 3 phases - 1. parse input, 2. clean nodes, and 3. pretty print nodes...

While there can be fixes/changes made in each stage, at present only 1 and 2 issue warnings. That is call TY_(Report)(doc,...), some 240+ times, or one of the other specialized report functions, like TY_(ReportAccessError), TY_(ReportAttrError) etc, etc...

Although there may still be some silent fixes here also - need to somehow check that...

Thus, at present, fixes done in stage 3, output, all in the pprint.c module, which is where this particular fix is done, are silent. That is there are no report functions called from this module that I can see...

Certainly TY_(Report)(doc,...) is not called... Need to check and verify that no other specialized report functions are called...

Was this a deliberate idea of the founders?

Is it time to change this?

Look forward to further feedback, particularly patches or PR, to show how this would look, if yes is the answer to that question... thanks...

@petdance
Copy link
Contributor Author

petdance commented Apr 23, 2018

I too feel tidy should warn, at least as a user education tool, of such fixes, several have been allowed to stand over time...

For me and my use case, I don't ever use the tidied HTML. I only use Tidy to find problems that I then clean up myself, or to show errors in our CI test suite.

@geoffmcl
Copy link
Contributor

@petdance thanks for the additional information...

The fact that in your use case, of not using the tidied html, that is using the -errors, -e, markup: no option, means moving the detection, and fixing of these brackets, and thus issuing of a warning, up into stages 1 or 2, which in turn adds to the difficulty of implementing this Feature Request... not impossible, but certainly more work...

Given the added complexity, especially to not break anything, and the fact that no coding has been started yet, am adding an indefinite milestone... this can change if and when things progress...

Look forward to furher feedback, patches or PR... thanks...

@geoffmcl geoffmcl added this to the Indefinite future milestone Apr 24, 2018
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