Implement parser for the simplest form of footnote reference.

This commit is contained in:
Tom Alexander 2023-07-19 21:32:08 -04:00
parent 6822069c2f
commit a36a820e84
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -9,6 +9,7 @@ use super::Context;
use crate::error::CustomError;
use crate::error::MyError;
use crate::error::Res;
use crate::parser::footnote_definition::label;
use crate::parser::object_parser::standard_set_object;
use crate::parser::parser_context::FootnoteReferenceDefinition;
use crate::parser::parser_with_context::parser_with_context;
@ -27,7 +28,7 @@ pub fn footnote_reference<'r, 's>(
}
#[tracing::instrument(ret, level = "debug")]
pub fn anonymous_footnote<'r, 's>(
fn anonymous_footnote<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, FootnoteReference<'s>> {
@ -57,6 +58,34 @@ pub fn anonymous_footnote<'r, 's>(
))
}
#[tracing::instrument(ret, level = "debug")]
fn inline_footnote<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, FootnoteReference<'s>> {
not_yet_implemented()?;
todo!()
}
#[tracing::instrument(ret, level = "debug")]
fn footnote_reference_only<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, FootnoteReference<'s>> {
let (remaining, _) = tag_no_case("[fn:")(input)?;
let (remaining, label_contents) = label(remaining)?;
let (remaining, _) = tag("]")(remaining)?;
let source = get_consumed(input, remaining);
Ok((
remaining,
FootnoteReference {
source,
label: Some(label_contents),
definition: Vec::with_capacity(0),
},
))
}
#[tracing::instrument(ret, level = "debug")]
fn definition<'s>(input: &'s str) -> Res<&'s str, Vec<Object<'s>>> {
Ok((input, vec![]))