Merge branch 'raw-entities' of https://github.com/RedHatter/svelte into RedHatter-raw-entities

pull/2876/head
Richard Harris 5 years ago
commit f08964286d

@ -490,8 +490,13 @@ function read_sequence(parser: Parser, done: () => boolean): Node[] {
if (current_chunk.data) chunks.push(current_chunk);
chunks.forEach(chunk => {
if (chunk.type === 'Text')
chunk.data = decode_character_references(chunk.data);
if (chunk.type === 'Text') {
let decoded = decode_character_references(chunk.data);
if (chunk.data != decoded) {
chunk.raw = chunk.data;
chunk.data = decoded;
}
}
});
return chunks;

@ -14,10 +14,15 @@ export default function text(parser: Parser) {
data += parser.template[parser.index++];
}
parser.current().children.push({
let node = {
start,
end: parser.index,
type: 'Text',
data: decode_character_references(data),
});
};
if (node.data != data)
node.raw = data;
parser.current().children.push(node);
}

@ -20,7 +20,8 @@
"start": 15,
"end": 33,
"type": "Text",
"data": "\"quoted\""
"data": "\"quoted\"",
"raw": ""quoted""
}
]
}

@ -15,7 +15,8 @@
"start": 3,
"end": 20,
"type": "Text",
"data": "Hello & World"
"data": "Hello & World",
"raw": "Hello & World"
}
]
}

@ -8,7 +8,8 @@
"start": 0,
"end": 17,
"type": "Text",
"data": "Hello & World"
"data": "Hello & World",
"raw": "Hello & World"
}
]
},

@ -15,7 +15,8 @@
"start": 6,
"end": 12,
"type": "Text",
"data": " "
"data": " ",
"raw": " "
}
]
}

Loading…
Cancel
Save