[parsing/mfm] Fix mentions in parentheses not getting parsed correctly
This commit is contained in:
parent
5a26c5e7f2
commit
b773876028
2 changed files with 5 additions and 3 deletions
|
@ -237,7 +237,7 @@ module private MfmParser =
|
||||||
|>> fun c -> MfmCenterNode(aggregateTextInline c) :> MfmNode
|
|>> fun c -> MfmCenterNode(aggregateTextInline c) :> MfmNode
|
||||||
|
|
||||||
let mentionNode =
|
let mentionNode =
|
||||||
previousCharSatisfiesNot isNotWhitespace
|
(previousCharSatisfiesNot isNotWhitespace <|> previousCharSatisfies (isAnyOf <| "()"))
|
||||||
>>. skipString "@"
|
>>. skipString "@"
|
||||||
>>. many1Chars (
|
>>. many1Chars (
|
||||||
satisfy isLetterOrNumber
|
satisfy isLetterOrNumber
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class MfmTests
|
||||||
public void TestMention()
|
public void TestMention()
|
||||||
{
|
{
|
||||||
const string input =
|
const string input =
|
||||||
"test @test test @test@instance.tld @test_ @_test @test_@ins-tance.tld @_test@xn--mastodn-f1a.de @_test@-xn--mastodn-f1a.de";
|
"test @test test @test@instance.tld @test_ @_test @test_@ins-tance.tld @_test@xn--mastodn-f1a.de @_test@-xn--mastodn-f1a.de (@test@domain.tld)";
|
||||||
List<MfmNode> expected =
|
List<MfmNode> expected =
|
||||||
[
|
[
|
||||||
new MfmTextNode("test "),
|
new MfmTextNode("test "),
|
||||||
|
@ -90,7 +90,9 @@ public class MfmTests
|
||||||
new MfmMentionNode("test_@ins-tance.tld", "test_", "ins-tance.tld"),
|
new MfmMentionNode("test_@ins-tance.tld", "test_", "ins-tance.tld"),
|
||||||
new MfmTextNode(" "),
|
new MfmTextNode(" "),
|
||||||
new MfmMentionNode("_test@xn--mastodn-f1a.de", "_test", "xn--mastodn-f1a.de"),
|
new MfmMentionNode("_test@xn--mastodn-f1a.de", "_test", "xn--mastodn-f1a.de"),
|
||||||
new MfmTextNode(" @_test@-xn--mastodn-f1a.de")
|
new MfmTextNode(" @_test@-xn--mastodn-f1a.de ("),
|
||||||
|
new MfmMentionNode("test@domain.tld", "test", "domain.tld"),
|
||||||
|
new MfmTextNode(")"),
|
||||||
];
|
];
|
||||||
var res = Mfm.parse(input);
|
var res = Mfm.parse(input);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue