Set is_footnote_section during parsing.

This commit is contained in:
Tom Alexander 2023-10-02 11:20:43 -04:00
parent de5788d8f3
commit 270ba53150
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 11 additions and 1 deletions

View File

@ -93,7 +93,7 @@ fn _heading<'b, 'g, 'r, 's>(
children,
is_comment: pre_headline.comment.is_some(),
is_archived,
is_footnote_section: false, // TODO
is_footnote_section: pre_headline.is_footnote_section,
},
))
}
@ -115,6 +115,7 @@ struct PreHeadline<'s> {
comment: Option<OrgSource<'s>>,
title: Vec<Object<'s>>,
tags: Vec<&'s str>,
is_footnote_section: bool,
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
@ -163,6 +164,14 @@ fn headline<'b, 'g, 'r, 's>(
let (remaining, _) = tuple((space0, org_line_ending))(remaining)?;
let is_footnote_section = maybe_title
.as_ref()
.map(|(_, (raw_title, _))| raw_title)
.map(|raw_title| {
Into::<&str>::into(raw_title) == context.get_global_settings().footnote_section
})
.unwrap_or(false);
Ok((
remaining,
PreHeadline {
@ -181,6 +190,7 @@ fn headline<'b, 'g, 'r, 's>(
.collect()
})
.unwrap_or(Vec::new()),
is_footnote_section,
},
))
}