Shortcode emoji parsing
This commit is contained in:
parent
4431a3ad62
commit
c45ec852dd
|
@ -723,7 +723,20 @@ impl Context {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mention<'a>(&self, input: Span<'a>) -> IResult<Span<'a>, Token<'a>> {
|
fn shortcode_emoji<'a>(&self, input: Span<'a>) -> IResult<Span<'a>, Token<'a>> {
|
||||||
|
// TODO: Fail when preceded by alphanumerics
|
||||||
|
let (input, _) = tag(":")(input)?;
|
||||||
|
let (input, shortcode) = map(
|
||||||
|
recognize(many1(alt((alphanumeric1, recognize(one_of("_+-")))))),
|
||||||
|
Span::into_fragment,
|
||||||
|
)(input)?;
|
||||||
|
let (input, _) = tag(":")(input)?;
|
||||||
|
let (input, _) = not(alphanumeric1)(input)?;
|
||||||
|
|
||||||
|
Ok((input, Token::ShortcodeEmoji(shortcode.into())))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn tag_mention<'a>(&self, input: Span<'a>) -> IResult<Span<'a>, Token<'a>> {
|
||||||
// TODO: Escaping and skip when preceded by alphanumerics
|
// TODO: Escaping and skip when preceded by alphanumerics
|
||||||
|
|
||||||
let tags = one_of("@!");
|
let tags = one_of("@!");
|
||||||
|
|
Loading…
Reference in New Issue