inline: disallow whitespace after/before emph

This commit is contained in:
Noah Hellman 2023-01-26 21:59:25 +01:00
parent b78b2866a8
commit d050c504ae

View file

@ -401,6 +401,14 @@ impl<I: Iterator<Item = char> + Clone> Parser<I> {
if matches!(dir, Dir::Open) {
return None;
}
if matches!(dir, Dir::Both)
&& self
.events
.back()
.map_or(false, |ev| matches!(ev.kind, EventKind::Whitespace))
{
return None;
}
let (d, e) = self.openers[o];
let e_attr = e;
let e_opener = e + 1;
@ -476,6 +484,13 @@ impl<I: Iterator<Item = char> + Clone> Parser<I> {
if matches!(dir, Dir::Close) {
return None;
}
if matches!(dir, Dir::Both)
&& self
.peek()
.map_or(true, |t| matches!(t.kind, lex::Kind::Whitespace))
{
return None;
}
self.openers.push((delim, self.events.len()));
// push dummy event in case attributes are encountered after closing delimiter
self.events.push_back(Event {