fix unescaping edge case

pull/719/head
Rich Harris 8 years ago
parent 2d39b25585
commit 815c17cbe7

@ -7,5 +7,5 @@ export default function visitText(
block: Block,
node: Node
) {
generator.append(node.data.replace(/(\${|`|\\)/g, '\\$1').replace(/([^\\])?([@#])/g, '$1\\$2'));
generator.append(node.data.replace(/(\${|`|\\)/g, '\\$1').replace(/([^\\@#])?([@#])/g, '$1\\$2'));
}

@ -1,3 +1,3 @@
export default function stringify(data: string) {
return JSON.stringify(data.replace(/([^\\])?([@#])/g, '$1\\$2'));
return JSON.stringify(data.replace(/([^\\@#])?([@#])/g, '$1\\$2'));
}

Loading…
Cancel
Save