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

Fix ambiguous entities #3071

Merged
merged 1 commit into from
Jun 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/parse/utils/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const windows_1252 = [
];

const entity_pattern = new RegExp(
`&(#?(?:x[\\w\\d]+|\\d+|${Object.keys(entities).join('|')}));?`,
`&(#?(?:x[\\w\\d]+|\\d+|${Object.keys(entities).join('|')}))(?:;|\\b)`,
'g'
);

Expand Down
2 changes: 1 addition & 1 deletion test/parser/samples/attribute-escaped/input.svelte
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div data-foo='&quot;quoted&quot;'></div>
<div data-foo='semi:&quot;space:&quot letter:&quote number:&quot1 end:&quot'></div>
12 changes: 6 additions & 6 deletions test/parser/samples/attribute-escaped/output.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"html": {
"start": 0,
"end": 41,
"end": 83,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 41,
"end": 83,
"type": "Element",
"name": "div",
"attributes": [
{
"start": 5,
"end": 34,
"end": 76,
"type": "Attribute",
"name": "data-foo",
"value": [
{
"start": 15,
"end": 33,
"end": 75,
"type": "Text",
"raw": "&quot;quoted&quot;",
"data": "\"quoted\""
"raw": "semi:&quot;space:&quot letter:&quote number:&quot1 end:&quot",
"data": "semi:\"space:\" letter:&quote number:&quot1 end:\""
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion test/runtime/samples/html-entities/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export default {
<span>A</span>
<span>€</span>

<span>&notanentity;</span>
<span>&amp;notanentity;</span>
`
};