fixup! block: parse captions

This commit is contained in:
Noah Hellman 2023-01-26 22:25:50 +01:00
parent e56f6b2e67
commit 7b6b2c0420

View file

@ -660,19 +660,18 @@ impl BlockParser {
!((&mut c).take(fence_length).all(|c| c == fence) !((&mut c).take(fence_length).all(|c| c == fence)
&& c.next().map_or(true, char::is_whitespace)) && c.next().map_or(true, char::is_whitespace))
} }
Block::Container(Table) if self.caption => !line.trim().is_empty(), Block::Container(Table) if self.caption => !empty,
Block::Container(Table) => { Block::Container(Table) => {
let line = line.trim(); let l = line_t.len();
let l = line.len();
match l { match l {
0 => true, 0 => true,
1..=2 => false, 1..=2 => false,
_ => { _ => {
if line.starts_with("^ ") { if line_t.starts_with("^ ") {
self.caption = true; self.caption = true;
true true
} else { } else {
line.as_bytes()[l - 1] == b'|' && line.as_bytes()[l - 2] != b'\\' line_t.as_bytes()[l - 1] == b'|' && line_t.as_bytes()[l - 2] != b'\\'
} }
} }
} }