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); if (current_chunk.data) chunks.push(current_chunk);
chunks.forEach(chunk => { chunks.forEach(chunk => {
if (chunk.type === 'Text') if (chunk.type === 'Text') {
chunk.data = decode_character_references(chunk.data); let decoded = decode_character_references(chunk.data);
if (chunk.data != decoded) {
chunk.raw = chunk.data;
chunk.data = decoded;
}
}
}); });
return chunks; return chunks;

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

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

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

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

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

Loading…
Cancel
Save