Implement get_contents for footnote references.
This commit is contained in:
@@ -2,6 +2,7 @@ use nom::branch::alt;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::bytes::complete::tag_no_case;
|
||||
use nom::combinator::all_consuming;
|
||||
use nom::combinator::consumed;
|
||||
use nom::combinator::map_parser;
|
||||
use nom::combinator::verify;
|
||||
use nom::multi::many1;
|
||||
@@ -59,7 +60,7 @@ fn anonymous_footnote<'b, 'g, 'r, 's>(
|
||||
let initial_context = ContextElement::document_context();
|
||||
let initial_context = Context::new(context.get_global_settings(), List::new(&initial_context));
|
||||
|
||||
let (remaining, children) = map_parser(
|
||||
let (remaining, (contents, children)) = consumed(map_parser(
|
||||
verify(
|
||||
parser_with_context!(text_until_exit)(&parser_context),
|
||||
|text| text.len() > 0,
|
||||
@@ -69,7 +70,7 @@ fn anonymous_footnote<'b, 'g, 'r, 's>(
|
||||
&initial_context,
|
||||
)))(i)
|
||||
}),
|
||||
)(remaining)?;
|
||||
))(remaining)?;
|
||||
|
||||
let (remaining, _) = tag("]")(remaining)?;
|
||||
|
||||
@@ -80,6 +81,7 @@ fn anonymous_footnote<'b, 'g, 'r, 's>(
|
||||
remaining,
|
||||
FootnoteReference {
|
||||
source: source.into(),
|
||||
contents: Some(contents.into()),
|
||||
label: None,
|
||||
definition: children,
|
||||
},
|
||||
@@ -106,7 +108,7 @@ fn inline_footnote<'b, 'g, 'r, 's>(
|
||||
let initial_context = ContextElement::document_context();
|
||||
let initial_context = Context::new(context.get_global_settings(), List::new(&initial_context));
|
||||
|
||||
let (remaining, children) = map_parser(
|
||||
let (remaining, (contents, children)) = consumed(map_parser(
|
||||
verify(
|
||||
parser_with_context!(text_until_exit)(&parser_context),
|
||||
|text| text.len() > 0,
|
||||
@@ -116,7 +118,7 @@ fn inline_footnote<'b, 'g, 'r, 's>(
|
||||
&initial_context,
|
||||
)))(i)
|
||||
}),
|
||||
)(remaining)?;
|
||||
))(remaining)?;
|
||||
|
||||
let (remaining, _) = tag("]")(remaining)?;
|
||||
|
||||
@@ -127,6 +129,7 @@ fn inline_footnote<'b, 'g, 'r, 's>(
|
||||
remaining,
|
||||
FootnoteReference {
|
||||
source: source.into(),
|
||||
contents: Some(contents.into()),
|
||||
label: Some(label_contents.into()),
|
||||
definition: children,
|
||||
},
|
||||
@@ -151,6 +154,7 @@ fn footnote_reference_only<'b, 'g, 'r, 's>(
|
||||
remaining,
|
||||
FootnoteReference {
|
||||
source: source.into(),
|
||||
contents: None,
|
||||
label: Some(label_contents.into()),
|
||||
definition: Vec::with_capacity(0),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user