diff options
| author | rinsuki <428rinsuki+git@gmail.com> | 2018-05-17 07:52:24 +0900 |
|---|---|---|
| committer | rinsuki <428rinsuki+git@gmail.com> | 2018-05-17 07:52:24 +0900 |
| commit | 829b4012e6dc14eb64a3d8f60826fe9b6a41b40d (patch) | |
| tree | 42ac37f323db349dca9316e6fdb39fc33b860686 /src/text/parse/elements/title.ts | |
| parent | add yarn.lock to gitignore (diff) | |
| parent | Update deliver.ts (diff) | |
| download | misskey-829b4012e6dc14eb64a3d8f60826fe9b6a41b40d.tar.gz misskey-829b4012e6dc14eb64a3d8f60826fe9b6a41b40d.tar.bz2 misskey-829b4012e6dc14eb64a3d8f60826fe9b6a41b40d.zip | |
Merge branch 'master' into fix/yarn-lock-ignore
Diffstat (limited to 'src/text/parse/elements/title.ts')
| -rw-r--r-- | src/text/parse/elements/title.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/text/parse/elements/title.ts b/src/text/parse/elements/title.ts new file mode 100644 index 0000000000..9f4708f5d6 --- /dev/null +++ b/src/text/parse/elements/title.ts @@ -0,0 +1,14 @@ +/** + * Title + */ + +module.exports = text => { + const match = text.match(/^【(.+?)】\n/); + if (!match) return null; + const title = match[0]; + return { + type: 'title', + content: title, + title: title.substr(1, title.length - 3) + }; +}; |