Port footnote definition.
This commit is contained in:
parent
9ccdcaac24
commit
1411aca7b5
@ -89,7 +89,15 @@ fn _element<'b, 'g, 'r, 's>(
|
|||||||
Element::DynamicBlock
|
Element::DynamicBlock
|
||||||
);
|
);
|
||||||
|
|
||||||
let footnote_definition_matcher = parser_with_context!(footnote_definition)(context);
|
ak_element!(
|
||||||
|
footnote_definition,
|
||||||
|
&mut affiliated_keywords,
|
||||||
|
post_affiliated_keywords_input,
|
||||||
|
context,
|
||||||
|
input,
|
||||||
|
Element::FootnoteDefinition
|
||||||
|
);
|
||||||
|
|
||||||
let comment_matcher = parser_with_context!(comment)(context);
|
let comment_matcher = parser_with_context!(comment)(context);
|
||||||
let drawer_matcher = parser_with_context!(drawer)(context);
|
let drawer_matcher = parser_with_context!(drawer)(context);
|
||||||
let table_matcher = parser_with_context!(org_mode_table)(context);
|
let table_matcher = parser_with_context!(org_mode_table)(context);
|
||||||
@ -113,7 +121,6 @@ fn _element<'b, 'g, 'r, 's>(
|
|||||||
let _enter = span.enter();
|
let _enter = span.enter();
|
||||||
|
|
||||||
opt(alt((
|
opt(alt((
|
||||||
map(footnote_definition_matcher, Element::FootnoteDefinition),
|
|
||||||
map(comment_matcher, Element::Comment),
|
map(comment_matcher, Element::Comment),
|
||||||
map(drawer_matcher, Element::Drawer),
|
map(drawer_matcher, Element::Drawer),
|
||||||
map(table_matcher, Element::Table),
|
map(table_matcher, Element::Table),
|
||||||
|
@ -33,21 +33,26 @@ use crate::parser::util::immediate_in_section;
|
|||||||
use crate::parser::util::maybe_consume_trailing_whitespace;
|
use crate::parser::util::maybe_consume_trailing_whitespace;
|
||||||
use crate::parser::util::start_of_line;
|
use crate::parser::util::start_of_line;
|
||||||
use crate::types::FootnoteDefinition;
|
use crate::types::FootnoteDefinition;
|
||||||
|
use crate::types::Keyword;
|
||||||
|
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "tracing",
|
feature = "tracing",
|
||||||
tracing::instrument(ret, level = "debug", skip(context))
|
tracing::instrument(ret, level = "debug", skip(context))
|
||||||
)]
|
)]
|
||||||
pub(crate) fn footnote_definition<'b, 'g, 'r, 's>(
|
pub(crate) fn footnote_definition<'b, 'g, 'r, 's, AK>(
|
||||||
|
affiliated_keywords: AK,
|
||||||
|
remaining: OrgSource<'s>,
|
||||||
context: RefContext<'b, 'g, 'r, 's>,
|
context: RefContext<'b, 'g, 'r, 's>,
|
||||||
input: OrgSource<'s>,
|
input: OrgSource<'s>,
|
||||||
) -> Res<OrgSource<'s>, FootnoteDefinition<'s>> {
|
) -> Res<OrgSource<'s>, FootnoteDefinition<'s>>
|
||||||
|
where
|
||||||
|
AK: IntoIterator<Item = Keyword<'s>>,
|
||||||
|
{
|
||||||
if immediate_in_section(context, "footnote definition") {
|
if immediate_in_section(context, "footnote definition") {
|
||||||
return Err(nom::Err::Error(CustomError::MyError(MyError(
|
return Err(nom::Err::Error(CustomError::MyError(MyError(
|
||||||
"Cannot nest objects of the same element".into(),
|
"Cannot nest objects of the same element".into(),
|
||||||
))));
|
))));
|
||||||
}
|
}
|
||||||
let (remaining, affiliated_keywords) = many0(affiliated_keyword)(input)?;
|
|
||||||
start_of_line(remaining)?;
|
start_of_line(remaining)?;
|
||||||
// Cannot be indented.
|
// Cannot be indented.
|
||||||
let (remaining, (_, lbl, _, _, _)) = tuple((
|
let (remaining, (_, lbl, _, _, _)) = tuple((
|
||||||
|
Loading…
Reference in New Issue
Block a user