Support blank lines before content in footnote definitions.

This commit is contained in:
Tom Alexander 2023-09-08 21:11:47 -04:00
parent 5d20d3e99b
commit 6a1bdd5fee
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 11 additions and 3 deletions

View File

@ -6,4 +6,3 @@
baz baz
#+END_EXAMPLE #+END_EXAMPLE

View File

@ -4,8 +4,10 @@ use nom::bytes::complete::tag_no_case;
use nom::bytes::complete::take_while; use nom::bytes::complete::take_while;
use nom::character::complete::digit1; use nom::character::complete::digit1;
use nom::character::complete::space0; use nom::character::complete::space0;
use nom::combinator::opt;
use nom::combinator::recognize; use nom::combinator::recognize;
use nom::combinator::verify; use nom::combinator::verify;
use nom::multi::many0;
use nom::multi::many1; use nom::multi::many1;
use nom::multi::many_till; use nom::multi::many_till;
use nom::sequence::tuple; use nom::sequence::tuple;
@ -41,8 +43,15 @@ pub fn footnote_definition<'b, 'g, 'r, 's>(
} }
start_of_line(input)?; start_of_line(input)?;
// Cannot be indented. // Cannot be indented.
let (remaining, (_lead_in, lbl, _lead_out, _ws)) = let (remaining, (_, lbl, _, _, _)) = tuple((
tuple((tag_no_case("[fn:"), label, tag("]"), space0))(input)?; tag_no_case("[fn:"),
label,
tag("]"),
space0,
opt(verify(many0(blank_line), |lines: &Vec<OrgSource<'_>>| {
lines.len() <= 2
})),
))(input)?;
let contexts = [ let contexts = [
ContextElement::ConsumeTrailingWhitespace(true), ContextElement::ConsumeTrailingWhitespace(true),
ContextElement::Context("footnote definition"), ContextElement::Context("footnote definition"),