Merge pull request #4224 from urbit/mp/landscape/patp-punctuation

landscape: allow most patp punctation in tokenize
This commit is contained in:
matildepark 2021-01-06 13:06:10 -05:00 committed by GitHub
commit bb48d8b3c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,13 +52,16 @@ const tokenizeMessage = (text) => {
}
messages.push({ url: str });
message = [];
} else if(urbitOb.isValidPatp(str) && !isInCodeBlock) {
} else if (urbitOb.isValidPatp(str.replace(/[^a-z\-\~]/g, '')) && !isInCodeBlock) {
if (message.length > 0) {
// If we're in the middle of a message, add it to the stack and reset
messages.push({ text: message.join(' ') });
message = [];
}
messages.push({ mention: str });
messages.push({ mention: str.replace(/[^a-z\-\~]/g, '') });
if (str.replace(/[a-z\-\~]/g, '').length > 0) {
messages.push({ text: str.replace(/[a-z\-\~]/g, '') });
}
message = [];
} else {