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

Add full named entities support #8

Closed
Enuvid opened this issue Oct 30, 2019 · 3 comments · Fixed by #9
Closed

Add full named entities support #8

Enuvid opened this issue Oct 30, 2019 · 3 comments · Fixed by #9
Labels
enhancement New feature or request

Comments

@Enuvid
Copy link

Enuvid commented Oct 30, 2019

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report 
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

For now, a parser is not supporting all list of named entities, so we have errors in parsing completely correct (by WHATWG specification) data. Just because the parser side is not a complete list.

Expected behavior

Anyway, there should be no mistake. There may be two solutions. We can update the list and bring it into line with the specification (for example, from here). Or we can allow any sequence of characters between & and ;.

Minimal reproduction of the problem

Input:

<!DOCTYPE html>
<html>
<head>
<title>EXCL Entity Test</title>
</head>
<body>
<p>This is an exclamation entity: &excl;</p>
</body>
</html>

Error:

[
  {
    "span": {
      "start": {
        "file": {
          "content": "<!DOCTYPE html> <html> <head> <title>EXCL Entity Test</title> </head> <body> <p>This is an exclamation entity: &excl;</p> </body> </html>\n\n",
          "url": "angular-html-parser"
        },
        "offset": 111,
        "line": 0,
        "col": 111
      },
      "end": {
        "file": {
          "content": "<!DOCTYPE html> <html> <head> <title>EXCL Entity Test</title> </head> <body> <p>This is an exclamation entity: &excl;</p> </body> </html>\n\n",
          "url": "angular-html-parser"
        },
        "offset": 117,
        "line": 0,
        "col": 117
      },
      "details": null
    },
    "msg": "Unknown entity \"excl\" - use the \"&#<decimal>;\" or  \"&#x<hex>;\" syntax",
    "level": 1,
    "tokenType": 4
  }
]

Environment


Browser: all
 
For Tooling issues:
- Node version: all
- Platform:  all

Others:
@ikatyang
Copy link
Member

ikatyang commented Nov 1, 2019

Hi, this looks like an issue for angular itself, angular-html-parser is simply a parser extracted from angular with some modifications, you may have to open an issue there. Once it is supported in angular, we can simply sync the change from there to add support for it here.

@ikatyang ikatyang added bug Something isn't working upstream labels Nov 1, 2019
@Enuvid
Copy link
Author

Enuvid commented Nov 1, 2019

This library is about html parser. It would be logical to have full syntax support.

In angular, the compiler used a shortlist of named entities, because this dictionary goes into production bundle and thereby minimize the size of the output bundle. From the point of view of the angular, this is quite correct.

But for html parser, witch used which is used in products like 'prettier', I think this is not correct.

@ikatyang
Copy link
Member

ikatyang commented Nov 2, 2019

Make sense.

@ikatyang ikatyang added enhancement New feature or request and removed bug Something isn't working upstream labels Nov 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants