mirror of https://github.com/sveltejs/svelte
parent
e973bacd38
commit
a5f86c2cb4
@ -1,16 +1,10 @@
|
|||||||
import tag from './tag';
|
import { Parser } from "../index";
|
||||||
import mustache from './mustache';
|
import mustache from "./mustache";
|
||||||
import text from './text';
|
import tag from "./tag";
|
||||||
import { Parser } from '../index';
|
import text from "./text";
|
||||||
|
|
||||||
export default function fragment(parser: Parser) {
|
export default (parser: Parser) =>
|
||||||
if (parser.match('<')) {
|
[
|
||||||
return tag;
|
{ match: "<", fragment: tag },
|
||||||
}
|
{ match: "{", fragment: mustache },
|
||||||
|
].find(({ match }) => parser.match(match))?.fragment ?? text;
|
||||||
if (parser.match('{')) {
|
|
||||||
return mustache;
|
|
||||||
}
|
|
||||||
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
Reference in new issue