From 50287ca9da435bdae9237842f3024b643da12ce3 Mon Sep 17 00:00:00 2001 From: Noah Hellman Date: Tue, 24 Jan 2023 17:50:21 +0100 Subject: [PATCH] Revert "block: override roman list with alpha if encountered" This reverts commit 7bdccbef65cf76da4cffaa3cac9b3f139f945036. --- src/block.rs | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/src/block.rs b/src/block.rs index 4d0d6bd..fa8efb3 100644 --- a/src/block.rs +++ b/src/block.rs @@ -112,21 +112,6 @@ struct OpenList { node: tree::NodeIndex, } -impl ListType { - fn compatible(self, other: Self) -> bool { - self == other - || if let (Self::Ordered(n0, s0), Self::Ordered(n1, s1)) = (self, other) { - s0 == s1 - && (matches!((n0, n1), (AlphaLower, RomanLower)) - || matches!((n0, n1), (RomanLower, AlphaLower)) - || matches!((n0, n1), (RomanUpper, AlphaUpper)) - || matches!((n0, n1), (AlphaLower, RomanLower))) - } else { - false - } - } -} - /// Parser for block-level tree structure of entire document. struct TreeParser<'s> { src: &'s str, @@ -199,12 +184,12 @@ impl<'s> TreeParser<'s> { }; // close list if a non list item or a list item of new type appeared - if let Some(OpenList { ty, depth, node }) = self.open_lists.last() { + if let Some(OpenList { ty, depth, .. }) = self.open_lists.last() { assert!(usize::from(*depth) <= self.tree.depth()); if self.tree.depth() == (*depth).into() && !matches!( kind, - Block::Container(Container::ListItem(ty_new)) if ty.compatible(ty_new), + Block::Container(Container::ListItem(ty_new)) if *ty == ty_new, ) { self.tree.exit(); // list @@ -308,20 +293,6 @@ impl<'s> TreeParser<'s> { depth: self.tree.depth().try_into().unwrap(), node, }); - } else if let ListType::Ordered(n @ (AlphaLower | AlphaUpper), _) = ty { - if let Some(OpenList { node, .. }) = self.open_lists.last() { - if let tree::Element::Container(Node::Container( - Container::List { - ty: ListType::Ordered(numbering, _), - .. - }, - )) = self.tree.elem_mut(*node) - { - *numbering = n; - } else { - panic!(); - } - } } }