Only allow a single export type for export blocks.
This commit is contained in:
parent
58ca9569a6
commit
ac7125d9b6
@ -208,10 +208,12 @@ 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, export_type) = opt(map(
|
||||
tuple((space1, switch_word, peek(tuple((space0, line_ending))))),
|
||||
|(_, export_type, _)| export_type,
|
||||
))(remaining)?;
|
||||
let (remaining, parameters) =
|
||||
opt(map(tuple((space1, data)), |(_, parameters)| parameters))(remaining)?;
|
||||
let (remaining, _nl) = recognize(tuple((space0, line_ending)))(remaining)?;
|
||||
let lesser_block_end_specialized = lesser_block_end("export");
|
||||
let contexts = [
|
||||
@ -225,10 +227,6 @@ pub(crate) fn export_block<'b, 'g, 'r, 's>(
|
||||
let parser_context = context.with_additional_node(&contexts[0]);
|
||||
let parser_context = parser_context.with_additional_node(&contexts[1]);
|
||||
let parser_context = parser_context.with_additional_node(&contexts[2]);
|
||||
let parameters = match parameters {
|
||||
Some((_ws, parameters)) => Some(parameters),
|
||||
None => None,
|
||||
};
|
||||
|
||||
let (remaining, contents) = content(&parser_context, remaining)?;
|
||||
let (remaining, _end) = lesser_block_end_specialized(&parser_context, remaining)?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user