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

--quote-ampersand does not change anything #724

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

--quote-ampersand does not change anything #724

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

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      </body>
     9  </html>
$ tidy --quote-ampersand yes -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.
</body>
</html>

It doesn't matter if --quote-ampersand is yes, no or omitted entirely. The docs at http://api.html-tidy.org/tidy/quickref_5.6.0.html#quote-ampersand say that it should be quoting ampersands by default.

@petdance petdance added the Bug label Apr 23, 2018
@geoffmcl
Copy link
Contributor

@petdance have not had time to fully research this, but try the following input -

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
           "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Is #724-1</title>
</head>
<body>
This & that.
</body>
</html>

HTML5 allow a single & to stand, while not if it is a legacy document... And you should find that --quote-ampersand no makes a difference if HTML4...

At this time this looks more like a documentation issue, rather than a bug...

Or are you suggesting a Feature Request that it be escaped in HTML5, even though it is not necessary...

Seek further clarification... thanks...

@vitaly-zdanevich
Copy link
Contributor

Related issue: I cannot disable warning about & in a href='a?b&c'

@cmb69
Copy link
Contributor

cmb69 commented Oct 20, 2018

@vitaly-zdanevich This is not valid according to HTML 5.2.

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

No branches or pull requests

4 participants