mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 18:07:31 -07:00
Fix #2949
This commit is contained in:
parent
88a2b37238
commit
68cb0123a6
2 changed files with 7 additions and 2 deletions
|
@ -9,9 +9,9 @@ export type TextElementHashtag = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function(text: string, i: number) {
|
export default function(text: string, i: number) {
|
||||||
if (!(/^\s#[^\s\.,]+/.test(text) || (i == 0 && /^#[^\s\.,]+/.test(text)))) return null;
|
if (!(/^\s#[^\s\.,!\?]+/.test(text) || (i == 0 && /^#[^\s\.,!\?]+/.test(text)))) return null;
|
||||||
const isHead = text.startsWith('#');
|
const isHead = text.startsWith('#');
|
||||||
const hashtag = text.match(/^\s?#[^\s\.,]+/)[0];
|
const hashtag = text.match(/^\s?#[^\s\.,!\?]+/)[0];
|
||||||
const res: any[] = !isHead ? [{
|
const res: any[] = !isHead ? [{
|
||||||
type: 'text',
|
type: 'text',
|
||||||
content: text[0]
|
content: text[0]
|
||||||
|
|
|
@ -122,6 +122,11 @@ describe('Text', () => {
|
||||||
{ type: 'hashtag', content: '#piyo', hashtag: 'piyo' },
|
{ type: 'hashtag', content: '#piyo', hashtag: 'piyo' },
|
||||||
{ type: 'text', content: '.' }
|
{ type: 'text', content: '.' }
|
||||||
], tokens2);
|
], tokens2);
|
||||||
|
|
||||||
|
const tokens3 = analyze('#Foo!');
|
||||||
|
assert.deepEqual([
|
||||||
|
{ type: 'text', content: '#Foo!' },
|
||||||
|
], tokens3);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('quote', () => {
|
it('quote', () => {
|
||||||
|
|
Loading…
Reference in a new issue