Skip to content

Commit

Permalink
Fix ambiguous entities
Browse files Browse the repository at this point in the history
  • Loading branch information
thgh committed Jun 22, 2019
1 parent fee4d35 commit e96be8f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
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": 82,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 41,
"end": 78,
"type": "Element",
"name": "div",
"attributes": [
{
"start": 5,
"end": 34,
"end": 75,
"type": "Attribute",
"name": "data-foo",
"value": [
{
"start": 15,
"end": 33,
"end": 74,
"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>
`
};

0 comments on commit e96be8f

Please sign in to comment.