-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
46 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -447,9 +447,19 @@ describe('FullParser', () => { | |
assert.deepStrictEqual(mfm.parse(input), output); | ||
}); | ||
|
||
it('ignore a italic syntax if the before char is neither a space nor an LF', () => { | ||
const input = 'before*abc*after'; | ||
const output = [TEXT('before*abc*after')]; | ||
it('ignore a italic syntax if the before char is neither a space nor an LF nor [^a-z0-9]i', () => { | ||
let input = 'before*abc*after'; | ||
let output: mfm.MfmNode[] = [TEXT('before*abc*after')]; | ||
assert.deepStrictEqual(mfm.parse(input), output); | ||
|
||
input = 'あいう*abc*えお'; | ||
output = [ | ||
TEXT('あいう'), | ||
ITALIC([ | ||
TEXT('abc') | ||
]), | ||
TEXT('えお') | ||
]; | ||
assert.deepStrictEqual(mfm.parse(input), output); | ||
}); | ||
}); | ||
|
@@ -477,9 +487,19 @@ describe('FullParser', () => { | |
assert.deepStrictEqual(mfm.parse(input), output); | ||
}); | ||
|
||
it('ignore a italic syntax if the before char is neither a space nor an LF', () => { | ||
const input = 'before_abc_after'; | ||
const output = [TEXT('before_abc_after')]; | ||
it('ignore a italic syntax if the before char is neither a space nor an LF nor [^a-z0-9]i', () => { | ||
let input = 'before_abc_after'; | ||
let output: mfm.MfmNode[] = [TEXT('before_abc_after')]; | ||
assert.deepStrictEqual(mfm.parse(input), output); | ||
|
||
input = 'あいう_abc_えお'; | ||
output = [ | ||
TEXT('あいう'), | ||
ITALIC([ | ||
TEXT('abc') | ||
]), | ||
TEXT('えお') | ||
]; | ||
assert.deepStrictEqual(mfm.parse(input), output); | ||
}); | ||
}); | ||
|
@@ -526,6 +546,12 @@ describe('FullParser', () => { | |
const output = [TEXT('[email protected]')]; | ||
assert.deepStrictEqual(mfm.parse(input), output); | ||
}); | ||
|
||
it('detect as a mention if the before char is [^a-z0-9]i', () => { | ||
const input = 'あいう@abc'; | ||
const output = [TEXT('あいう'), MENTION('abc', null, '@abc')]; | ||
assert.deepStrictEqual(mfm.parse(input), output); | ||
}); | ||
}); | ||
|
||
describe('hashtag', () => { | ||
|
@@ -554,9 +580,13 @@ describe('FullParser', () => { | |
assert.deepStrictEqual(mfm.parse(input), output); | ||
}); | ||
|
||
it('ignore a hashtag if the before char is neither a space nor an LF', () => { | ||
const input = 'abc#abc'; | ||
const output = [TEXT('abc#abc')]; | ||
it('ignore a hashtag if the before char is neither a space nor an LF nor [^a-z0-9]i', () => { | ||
let input = 'abc#abc'; | ||
let output: mfm.MfmNode[] = [TEXT('abc#abc')]; | ||
assert.deepStrictEqual(mfm.parse(input), output); | ||
|
||
input = 'あいう#abc'; | ||
output = [TEXT('あいう'), HASHTAG('abc')]; | ||
assert.deepStrictEqual(mfm.parse(input), output); | ||
}); | ||
}); | ||
|