UNPKG

svelte

Version:

Cybernetically enhanced web apps

24 lines (19 loc) 580 B
/** @import { AST } from '#compiler' */ /** @import { Parser } from '../index.js' */ import { decode_character_references } from '../utils/html.js'; /** @param {Parser} parser */ export default function text(parser) { const start = parser.index; while (parser.index < parser.template.length && !parser.match('<') && !parser.match('{')) { parser.index++; } const data = parser.template.slice(start, parser.index); /** @type {AST.Text} */ parser.append({ type: 'Text', start, end: parser.index, raw: data, data: decode_character_references(data, false) }); }