Switch subscript and superscript to using bracket depth from OrgSource instead of from the context.

This is for the same reasons as footnote references.
This commit is contained in:
Tom Alexander
2023-08-28 02:37:01 -04:00
parent a46b358549
commit 4c2037ec44
2 changed files with 25 additions and 68 deletions

View File

@@ -149,18 +149,6 @@ pub enum ContextElement<'r, 's> {
/// unbalanced brackets can be detected in the middle of an
/// object.
InlineSourceBlockBracket(InlineSourceBlockBracket<'s>),
/// Stores the current bracket or parenthesis depth inside a
/// superscript or superscript.
///
/// Inside the braces of a subscript or superscript there must be
/// balanced braces {}, so this stores the amount of opening
/// braces subtracted by the amount of closing braces within the
/// definition must equal zero.
///
/// A reference to the position in the string is also included so
/// unbalanced braces can be detected in the middle of an object.
SubscriptSuperscriptBrace(SubscriptSuperscriptBrace<'s>),
}
pub struct ExitMatcherNode<'r> {
@@ -180,12 +168,6 @@ pub struct InlineSourceBlockBracket<'s> {
pub depth: usize,
}
#[derive(Debug)]
pub struct SubscriptSuperscriptBrace<'s> {
pub position: OrgSource<'s>,
pub depth: usize,
}
impl<'r> std::fmt::Debug for ExitMatcherNode<'r> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("ExitMatcherNode");