From 7b6b2c0420aaac1d059ab1fabd38f5bea8a037eb Mon Sep 17 00:00:00 2001 From: Noah Hellman Date: Thu, 26 Jan 2023 22:25:50 +0100 Subject: [PATCH] fixup! block: parse captions --- src/block.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/block.rs b/src/block.rs index 280e715..b71c708 100644 --- a/src/block.rs +++ b/src/block.rs @@ -660,19 +660,18 @@ impl BlockParser { !((&mut c).take(fence_length).all(|c| c == fence) && 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) => { - let line = line.trim(); - let l = line.len(); + let l = line_t.len(); match l { 0 => true, 1..=2 => false, _ => { - if line.starts_with("^ ") { + if line_t.starts_with("^ ") { self.caption = true; true } 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'\\' } } }