This commit is contained in:
syuilo 2018-12-07 17:54:35 +09:00
parent 9f09afc824
commit 1e7b5a0a98
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
1 changed files with 1 additions and 0 deletions

View File

@ -211,6 +211,7 @@ const mfm = P.createLanguage({
hashtag = hashtag.substr(0, getTrailingPosition(hashtag)); hashtag = hashtag.substr(0, getTrailingPosition(hashtag));
if (hashtag.match(/^[0-9]+$/)) return P.makeFailure(i, 'not a hashtag'); if (hashtag.match(/^[0-9]+$/)) return P.makeFailure(i, 'not a hashtag');
if (input[i - 1] != null && input[i - 1].match(/[a-z0-9]/i)) return P.makeFailure(i, 'not a hashtag'); if (input[i - 1] != null && input[i - 1].match(/[a-z0-9]/i)) return P.makeFailure(i, 'not a hashtag');
if (hashtag.length > 30) return P.makeFailure(i, 'not a hashtag');
return P.makeSuccess(i + ('#' + hashtag).length, makeNode('hashtag', { hashtag: hashtag })); return P.makeSuccess(i + ('#' + hashtag).length, makeNode('hashtag', { hashtag: hashtag }));
}), }),
//#endregion //#endregion