From 79ffbf95db9d0cc019d06ab93b1bfa6ba0d4f9ae Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 21 Nov 2018 05:11:00 +0900 Subject: Improve MFM parser (#3337) * wip * wip * Refactor * Refactor * wip * wip * wip * wip * Refactor * Refactor * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Clean up * Update misskey-flavored-markdown.ts * wip * wip * wip * wip * Update parser.ts * wip * Add new test * wip * Add new test * Add new test * wip * Refactor * Update parse.ts * Refactor * Update parser.ts * wip --- src/mfm/parse/elements/quote.ts | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 src/mfm/parse/elements/quote.ts (limited to 'src/mfm/parse/elements/quote.ts') diff --git a/src/mfm/parse/elements/quote.ts b/src/mfm/parse/elements/quote.ts deleted file mode 100644 index 969c1fb4a9..0000000000 --- a/src/mfm/parse/elements/quote.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Quoted text - */ - -export type TextElementQuote = { - type: 'quote'; - content: string; - quote: string; -}; - -export default function(text: string, before: string) { - const isBegin = before == ''; - - const match = text.match(/^"([\s\S]+?)\n"/) || text.match(/^\n>([\s\S]+?)(\n\n|$)/) || - (isBegin ? text.match(/^>([\s\S]+?)(\n\n|$)/) : null); - - if (!match) return null; - - const quote = match[1] - .split('\n') - .map(line => line.replace(/^>+/g, '').trim()) - .join('\n') - .trim(); - - return { - type: 'quote', - content: match[0], - quote: quote, - } as TextElementQuote; -} -- cgit v1.2.3-freya