Skip to content
Snippets Groups Projects
Commit 08b43172 authored by syuilo's avatar syuilo
Browse files

Refactoring

parent 83dcfec0
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,6 @@ export default function(text: string) {
return {
type: 'bold',
content: bold,
bold: bold.substr(2, bold.length - 4)
bold: match[1]
} as TextElementBold;
}
......@@ -18,7 +18,7 @@ export default function(text: string) {
return {
type: 'code',
content: code,
code: code.substr(3, code.length - 6).trim(),
html: genHtml(code.substr(3, code.length - 6).trim())
code: match[1],
html: genHtml(match[1])
} as TextElementCode;
}
......@@ -9,12 +9,12 @@ export type TextElementEmoji = {
};
export default function(text: string) {
const match = text.match(/^:[a-zA-Z0-9+-_]+:/);
const match = text.match(/^:([a-zA-Z0-9+-_]+):/);
if (!match) return null;
const emoji = match[0];
return {
type: 'emoji',
content: emoji,
emoji: emoji.substr(1, emoji.length - 2)
emoji: match[1]
} as TextElementEmoji;
}
......@@ -15,6 +15,6 @@ export default function(text: string) {
return {
type: 'quote',
content: quote,
quote: quote.substr(1, quote.length - 2).trim(),
quote: match[1].trim(),
} as TextElementQuote;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment