Add initial implementation of footnote definition.

This commit is contained in:
Tom Alexander
2023-04-07 17:14:44 -04:00
parent d249e7c93e
commit 716f80b0ec
6 changed files with 103 additions and 5 deletions

View File

@@ -1,5 +1,11 @@
use super::error::CustomError;
use super::error::MyError;
use super::error::Res;
use super::parser_context::ContextElement;
use super::Context;
use nom::branch::alt;
use nom::character::complete::line_ending;
use nom::character::complete::multispace0;
use nom::character::complete::none_of;
use nom::character::complete::space0;
use nom::combinator::eof;
@@ -9,11 +15,8 @@ use nom::combinator::recognize;
use nom::multi::many0;
use nom::sequence::tuple;
use super::error::CustomError;
use super::error::MyError;
use super::error::Res;
use super::parser_context::ContextElement;
use super::Context;
pub const WORD_CONSTITUENT_CHARACTERS: &str =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
/// Check if we are below a section of the given section type regardless of depth
pub fn in_section<'r, 's, 'x>(context: Context<'r, 's>, section_name: &'x str) -> bool {
@@ -162,6 +165,11 @@ pub fn regurgitate<'s>(input: &'s str, remaining: &'s str) -> &'s str {
}
}
#[tracing::instrument(ret, level = "debug")]
pub fn whitespace_eof(input: &str) -> Res<&str, &str> {
recognize(tuple((multispace0, eof)))(input)
}
#[cfg(test)]
mod tests {
use super::*;