fixup! inline: disallow whitespace after/before emph

This commit is contained in:
Noah Hellman 2023-01-26 22:09:50 +01:00
parent d050c504ae
commit 0605a0d901

View file

@ -116,7 +116,7 @@ impl<I: Iterator<Item = char> + Clone> Parser<I> {
.or_else(|| self.parse_container(&first)) .or_else(|| self.parse_container(&first))
.or_else(|| self.parse_atom(&first)) .or_else(|| self.parse_atom(&first))
.unwrap_or(Event { .unwrap_or(Event {
kind: if first.kind == lex::Kind::Whitespace { kind: if matches!(first.kind, lex::Kind::Whitespace) {
EventKind::Whitespace EventKind::Whitespace
} else { } else {
EventKind::Str EventKind::Str
@ -402,10 +402,9 @@ impl<I: Iterator<Item = char> + Clone> Parser<I> {
return None; return None;
} }
if matches!(dir, Dir::Both) if matches!(dir, Dir::Both)
&& self && self.events.back().map_or(false, |ev| {
.events matches!(ev.kind, EventKind::Whitespace | EventKind::Atom(Softbreak))
.back() })
.map_or(false, |ev| matches!(ev.kind, EventKind::Whitespace))
{ {
return None; return None;
} }