From 68dd705500bd98b7b00606e861de170939e3d528 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 27 Feb 2018 12:32:01 +0900 Subject: #1153 --- src/api/common/text/elements/quote.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/api/common/text/elements/quote.ts (limited to 'src/api/common/text/elements') diff --git a/src/api/common/text/elements/quote.ts b/src/api/common/text/elements/quote.ts new file mode 100644 index 0000000000..cc8cfffdc4 --- /dev/null +++ b/src/api/common/text/elements/quote.ts @@ -0,0 +1,14 @@ +/** + * Quoted text + */ + +module.exports = text => { + const match = text.match(/^"([\s\S]+?)\n"/); + if (!match) return null; + const quote = match[0]; + return { + type: 'quote', + content: quote, + quote: quote.substr(1, quote.length - 2).trim(), + }; +}; -- cgit v1.2.3-freya