Compare export type.

This commit is contained in:
Tom Alexander
2023-10-05 02:15:32 -04:00
parent 1da521b08a
commit 58ca9569a6
3 changed files with 22 additions and 1 deletions

View File

@@ -208,6 +208,9 @@ pub(crate) fn export_block<'b, 'g, 'r, 's>(
let (input, affiliated_keywords) = many0(affiliated_keyword)(input)?;
let (remaining, _) = lesser_block_begin("export")(context, input)?;
// https://orgmode.org/worg/org-syntax.html#Blocks claims that export blocks must have a single word for data but testing shows no data and multi-word data still parses as an export block.
let (remaining, export_type) = opt(map(tuple((space1, switch_word)), |(_, export_type)| {
export_type
}))(remaining)?;
let (remaining, parameters) = opt(tuple((space1, data)))(remaining)?;
let (remaining, _nl) = recognize(tuple((space0, line_ending)))(remaining)?;
let lesser_block_end_specialized = lesser_block_end("export");
@@ -236,6 +239,7 @@ pub(crate) fn export_block<'b, 'g, 'r, 's>(
ExportBlock {
source: source.into(),
name: get_name(&affiliated_keywords),
export_type: export_type.map(Into::<&str>::into),
data: parameters.map(|parameters| Into::<&str>::into(parameters)),
contents,
},