You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/src/parse/state/text.ts

24 lines
467 B

import { decodeCharacterReferences } from '../utils/html';
import { Parser } from '../index';
export default function text(parser: Parser) {
const start = parser.index;
let data = '';
while (
parser.index < parser.template.length &&
!parser.match('<') &&
!parser.match('{{')
) {
data += parser.template[parser.index++];
}
parser.current().children.push({
start,
end: parser.index,
type: 'Text',
data: decodeCharacterReferences(data),
});
}