Implement a function to detect the end of a footnote reference definition with balanced brackets.
This commit is contained in:
@@ -141,6 +141,18 @@ pub enum ContextElement<'r, 's> {
|
||||
/// org-mode document since text needs to be re-parsed to look for
|
||||
/// radio links matching the contents of radio targets.
|
||||
RadioTarget(Vec<&'r Vec<Object<'s>>>),
|
||||
|
||||
/// Stores the current bracket depth inside a footnote reference's definition.
|
||||
///
|
||||
/// The definition inside a footnote reference must have balanced
|
||||
/// brackets [] inside the definition, so this stores the amount
|
||||
/// of opening brackets subtracted by the amount of closing
|
||||
/// brackets within the definition.
|
||||
///
|
||||
/// A reference to the position in the string is also included so
|
||||
/// unbalanced brackets can be detected in the middle of an
|
||||
/// object.
|
||||
FootnoteReferenceDefinition(FootnoteReferenceDefinition<'s>),
|
||||
}
|
||||
|
||||
pub struct ExitMatcherNode<'r> {
|
||||
@@ -148,6 +160,12 @@ pub struct ExitMatcherNode<'r> {
|
||||
pub class: ExitClass,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FootnoteReferenceDefinition<'s> {
|
||||
pub position: &'s str,
|
||||
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");
|
||||
|
||||
Reference in New Issue
Block a user