diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-03-18 20:05:11 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-03-18 20:05:11 +0900 |
| commit | 45e8331e261244628b134a18e3d0fbe0ebb3a7dc (patch) | |
| tree | 44ac1719fcea0a61c33698b23fb89400141e00d9 /src/common/text/elements | |
| parent | Better notification (diff) | |
| download | sharkey-45e8331e261244628b134a18e3d0fbe0ebb3a7dc.tar.gz sharkey-45e8331e261244628b134a18e3d0fbe0ebb3a7dc.tar.bz2 sharkey-45e8331e261244628b134a18e3d0fbe0ebb3a7dc.zip | |
:sushi:
Closes #12, #227 and #58
Diffstat (limited to 'src/common/text/elements')
| -rw-r--r-- | src/common/text/elements/bold.js | 14 | ||||
| -rw-r--r-- | src/common/text/elements/code.js | 17 | ||||
| -rw-r--r-- | src/common/text/elements/emoji.js | 14 | ||||
| -rw-r--r-- | src/common/text/elements/hashtag.js | 19 | ||||
| -rw-r--r-- | src/common/text/elements/inline-code.js | 17 | ||||
| -rw-r--r-- | src/common/text/elements/link.js | 19 | ||||
| -rw-r--r-- | src/common/text/elements/mention.js | 14 | ||||
| -rw-r--r-- | src/common/text/elements/url.js | 14 |
8 files changed, 0 insertions, 128 deletions
diff --git a/src/common/text/elements/bold.js b/src/common/text/elements/bold.js deleted file mode 100644 index ce25764457..0000000000 --- a/src/common/text/elements/bold.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Bold - */ - -module.exports = text => { - const match = text.match(/^\*\*(.+?)\*\*/); - if (!match) return null; - const bold = match[0]; - return { - type: 'bold', - content: bold, - bold: bold.substr(2, bold.length - 4) - }; -}; diff --git a/src/common/text/elements/code.js b/src/common/text/elements/code.js deleted file mode 100644 index 99fe6a183c..0000000000 --- a/src/common/text/elements/code.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Code (block) - */ - -const genHtml = require('../core/syntax-highlighter'); - -module.exports = text => { - const match = text.match(/^```([\s\S]+?)```/); - if (!match) return null; - const code = match[0]; - return { - type: 'code', - content: code, - code: code.substr(3, code.length - 6).trim(), - html: genHtml(code.substr(3, code.length - 6).trim()) - }; -}; diff --git a/src/common/text/elements/emoji.js b/src/common/text/elements/emoji.js deleted file mode 100644 index e24231a223..0000000000 --- a/src/common/text/elements/emoji.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Emoji - */ - -module.exports = text => { - 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) - }; -}; diff --git a/src/common/text/elements/hashtag.js b/src/common/text/elements/hashtag.js deleted file mode 100644 index 048dbd8929..0000000000 --- a/src/common/text/elements/hashtag.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Hashtag - */ - -module.exports = (text, i) => { - if (!(/^\s#[^\s]+/.test(text) || (i == 0 && /^#[^\s]+/.test(text)))) return null; - const isHead = text[0] == '#'; - const hashtag = text.match(/^\s?#[^\s]+/)[0]; - const res = !isHead ? [{ - type: 'text', - content: text[0] - }] : []; - res.push({ - type: 'hashtag', - content: isHead ? hashtag : hashtag.substr(1), - hashtag: isHead ? hashtag.substr(1) : hashtag.substr(2) - }); - return res; -}; diff --git a/src/common/text/elements/inline-code.js b/src/common/text/elements/inline-code.js deleted file mode 100644 index 37e9b1a0ff..0000000000 --- a/src/common/text/elements/inline-code.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Code (inline) - */ - -const genHtml = require('../core/syntax-highlighter'); - -module.exports = text => { - const match = text.match(/^`(.+?)`/); - if (!match) return null; - const code = match[0]; - return { - type: 'inline-code', - content: code, - code: code.substr(1, code.length - 2).trim(), - html: genHtml(code.substr(1, code.length - 2).trim()) - }; -}; diff --git a/src/common/text/elements/link.js b/src/common/text/elements/link.js deleted file mode 100644 index 35563ddc3d..0000000000 --- a/src/common/text/elements/link.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Link - */ - -module.exports = text => { - const match = text.match(/^\??\[([^\[\]]+?)\]\((https?:\/\/[\w\/:%#@\$&\?!\(\)\[\]~\.=\+\-]+?)\)/); - if (!match) return null; - const silent = text[0] == '?'; - const link = match[0]; - const title = match[1]; - const url = match[2]; - return { - type: 'link', - content: link, - title: title, - url: url, - silent: silent - }; -}; diff --git a/src/common/text/elements/mention.js b/src/common/text/elements/mention.js deleted file mode 100644 index e0fac4dd76..0000000000 --- a/src/common/text/elements/mention.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Mention - */ - -module.exports = text => { - const match = text.match(/^@[a-zA-Z0-9\-]+/); - if (!match) return null; - const mention = match[0]; - return { - type: 'mention', - content: mention, - username: mention.substr(1) - }; -}; diff --git a/src/common/text/elements/url.js b/src/common/text/elements/url.js deleted file mode 100644 index 1003aff9c3..0000000000 --- a/src/common/text/elements/url.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * URL - */ - -module.exports = text => { - const match = text.match(/^https?:\/\/[\w\/:%#@\$&\?!\(\)\[\]~\.=\+\-]+/); - if (!match) return null; - const url = match[0]; - return { - type: 'url', - content: url, - url: url - }; -}; |