From 1f7c24545b812396e1dd61843ba3924432a275d4 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 15 Apr 2023 17:36:07 -0400 Subject: [PATCH 01/18] Initial structure for drawer. --- src/compare/diff.rs | 1 + src/parser/drawer.rs | 8 ++++++++ src/parser/element.rs | 12 ++++++++++++ src/parser/greater_element.rs | 7 +++++++ src/parser/mod.rs | 2 ++ 5 files changed, 30 insertions(+) create mode 100644 src/parser/drawer.rs diff --git a/src/compare/diff.rs b/src/compare/diff.rs index 89f600a5..9c32da98 100644 --- a/src/compare/diff.rs +++ b/src/compare/diff.rs @@ -218,6 +218,7 @@ fn compare_element<'s>( Element::GreaterBlock(obj) => compare_greater_block(source, emacs, obj), Element::FootnoteDefinition(obj) => compare_footnote_definition(source, emacs, obj), Element::Comment(obj) => compare_comment(source, emacs, obj), + Element::Drawer(obj) => todo!(), } } diff --git a/src/parser/drawer.rs b/src/parser/drawer.rs new file mode 100644 index 00000000..1443521d --- /dev/null +++ b/src/parser/drawer.rs @@ -0,0 +1,8 @@ +use super::Context; +use crate::parser::error::Res; +use crate::parser::Drawer; + +#[tracing::instrument(ret, level = "debug")] +pub fn drawer<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Drawer<'s>> { + todo!() +} diff --git a/src/parser/element.rs b/src/parser/element.rs index cb7cf19a..189d62d5 100644 --- a/src/parser/element.rs +++ b/src/parser/element.rs @@ -1,4 +1,5 @@ use super::comment::comment; +use super::drawer::drawer; use super::error::Res; use super::footnote_definition::footnote_definition; use super::greater_block::greater_block; @@ -11,6 +12,7 @@ use super::paragraph::paragraph; use super::plain_list::plain_list; use super::source::Source; use super::Context; +use super::Drawer; use super::PlainListItem; use crate::parser::parser_with_context::parser_with_context; use nom::branch::alt; @@ -23,6 +25,7 @@ pub enum Element<'s> { GreaterBlock(GreaterBlock<'s>), FootnoteDefinition(FootnoteDefinition<'s>), Comment(Comment<'s>), + Drawer(Drawer<'s>), } impl<'s> Source<'s> for Element<'s> { @@ -33,6 +36,7 @@ impl<'s> Source<'s> for Element<'s> { Element::GreaterBlock(obj) => obj.source, Element::FootnoteDefinition(obj) => obj.source, Element::Comment(obj) => obj.source, + Element::Drawer(obj) => obj.source, } } } @@ -73,6 +77,12 @@ impl<'s> Source<'s> for Comment<'s> { } } +impl<'s> Source<'s> for Drawer<'s> { + fn get_source(&'s self) -> &'s str { + self.source + } +} + #[tracing::instrument(ret, level = "debug")] pub fn element<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Element<'s>> { let non_paragraph_matcher = parser_with_context!(non_paragraph_element)(context); @@ -92,10 +102,12 @@ pub fn non_paragraph_element<'r, 's>( let greater_block_matcher = parser_with_context!(greater_block)(context); let footnote_definition_matcher = parser_with_context!(footnote_definition)(context); let comment_matcher = parser_with_context!(comment)(context); + let drawer_matcher = parser_with_context!(drawer)(context); alt(( map(plain_list_matcher, Element::PlainList), map(greater_block_matcher, Element::GreaterBlock), map(footnote_definition_matcher, Element::FootnoteDefinition), map(comment_matcher, Element::Comment), + map(drawer_matcher, Element::Drawer), ))(input) } diff --git a/src/parser/greater_element.rs b/src/parser/greater_element.rs index 119d03e7..2d1f92a0 100644 --- a/src/parser/greater_element.rs +++ b/src/parser/greater_element.rs @@ -28,3 +28,10 @@ pub struct FootnoteDefinition<'s> { pub label: &'s str, pub children: Vec>, } + +#[derive(Debug)] +pub struct Drawer<'s> { + pub source: &'s str, + pub label: &'s str, + pub children: Vec>, +} diff --git a/src/parser/mod.rs b/src/parser/mod.rs index c6dae3e6..7b32ed3f 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -1,5 +1,6 @@ mod comment; mod document; +mod drawer; mod element; mod error; mod footnote_definition; @@ -21,6 +22,7 @@ pub use document::DocumentElement; pub use document::Heading; pub use document::Section; pub use element::Element; +pub use greater_element::Drawer; pub use greater_element::FootnoteDefinition; pub use greater_element::GreaterBlock; pub use greater_element::PlainList; From 9e4bf553d3681a359e1d2f41eeaf8cefe6462fb1 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 15 Apr 2023 17:56:07 -0400 Subject: [PATCH 02/18] First attempt at implementing drawers. --- org_mode_samples/drawer/Makefile | 23 ++++++++++ org_mode_samples/drawer/simple.org | 9 ++++ src/parser/drawer.rs | 70 +++++++++++++++++++++++++++++- src/parser/greater_element.rs | 2 +- 4 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 org_mode_samples/drawer/Makefile create mode 100644 org_mode_samples/drawer/simple.org diff --git a/org_mode_samples/drawer/Makefile b/org_mode_samples/drawer/Makefile new file mode 100644 index 00000000..c47a86c1 --- /dev/null +++ b/org_mode_samples/drawer/Makefile @@ -0,0 +1,23 @@ +SHELL := bash +.ONESHELL: +.SHELLFLAGS := -eu -o pipefail -c +.DELETE_ON_ERROR: +MAKEFLAGS += --warn-undefined-variables +MAKEFLAGS += --no-builtin-rules +SRCFILES := $(wildcard *.org) +OUTFILES := $(patsubst %.org,%.tree.txt,$(SRCFILES)) + +ifeq ($(origin .RECIPEPREFIX), undefined) + $(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later) +endif +.RECIPEPREFIX = > + +.PHONY: all +all: $(OUTFILES) + +.PHONY: clean +clean: +> rm -rf $(OUTFILES) + +%.tree.txt: %.org ../common.el ../dump_org_ast.bash +> ../dump_org_ast.bash $< $@ diff --git a/org_mode_samples/drawer/simple.org b/org_mode_samples/drawer/simple.org new file mode 100644 index 00000000..50adaa33 --- /dev/null +++ b/org_mode_samples/drawer/simple.org @@ -0,0 +1,9 @@ +* Headline +before +:candle: +inside + +the drawer +:end: + +after diff --git a/src/parser/drawer.rs b/src/parser/drawer.rs index 1443521d..2c417e86 100644 --- a/src/parser/drawer.rs +++ b/src/parser/drawer.rs @@ -1,8 +1,76 @@ +use nom::branch::alt; +use nom::bytes::complete::tag; +use nom::bytes::complete::take_while; +use nom::character::complete::line_ending; +use nom::character::complete::space0; +use nom::combinator::eof; +use nom::combinator::recognize; +use nom::multi::many_till; +use nom::sequence::tuple; + use super::Context; +use crate::parser::element::element; use crate::parser::error::Res; +use crate::parser::parser_context::ChainBehavior; +use crate::parser::parser_context::ContextElement; +use crate::parser::parser_context::ExitMatcherNode; +use crate::parser::parser_with_context::parser_with_context; +use crate::parser::util::exit_matcher_parser; +use crate::parser::util::get_consumed; +use crate::parser::util::maybe_consume_trailing_whitespace_if_not_exiting; +use crate::parser::util::start_of_line; +use crate::parser::util::WORD_CONSTITUENT_CHARACTERS; use crate::parser::Drawer; #[tracing::instrument(ret, level = "debug")] pub fn drawer<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Drawer<'s>> { - todo!() + start_of_line(context, input)?; + let (remaining, _leading_whitespace) = space0(input)?; + let (remaining, (_open_colon, drawer_name, _close_colon, _new_line)) = tuple(( + tag(":"), + name, + tag(":"), + recognize(tuple((space0, line_ending))), + ))(remaining)?; + + let parser_context = context + .with_additional_node(ContextElement::ConsumeTrailingWhitespace(true)) + .with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { + exit_matcher: ChainBehavior::AndParent(Some(&drawer_end)), + })); + + let element_matcher = parser_with_context!(element)(&parser_context); + let exit_matcher = parser_with_context!(exit_matcher_parser)(&parser_context); + let (remaining, (children, _exit_contents)) = + many_till(element_matcher, exit_matcher)(remaining)?; + let (remaining, _end) = drawer_end(&parser_context, remaining)?; + + let (remaining, _trailing_ws) = + maybe_consume_trailing_whitespace_if_not_exiting(context, remaining)?; + let source = get_consumed(input, remaining); + + Ok(( + remaining, + Drawer { + source, + name: drawer_name, + children, + }, + )) +} + +#[tracing::instrument(ret, level = "debug")] +fn name<'s>(input: &'s str) -> Res<&'s str, &'s str> { + take_while(|c| WORD_CONSTITUENT_CHARACTERS.contains(c) || "-_".contains(c))(input) +} + +#[tracing::instrument(ret, level = "debug")] +fn drawer_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> { + start_of_line(context, input)?; + recognize(tuple(( + space0, + tag(":end:"), + space0, + alt((line_ending, eof)), + )))(input) } diff --git a/src/parser/greater_element.rs b/src/parser/greater_element.rs index 2d1f92a0..c9e5975f 100644 --- a/src/parser/greater_element.rs +++ b/src/parser/greater_element.rs @@ -32,6 +32,6 @@ pub struct FootnoteDefinition<'s> { #[derive(Debug)] pub struct Drawer<'s> { pub source: &'s str, - pub label: &'s str, + pub name: &'s str, pub children: Vec>, } From 31f69141947e7b59792c5da8fa6b5b6030f66a54 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 15 Apr 2023 18:00:34 -0400 Subject: [PATCH 03/18] Add code to compare drawers. --- src/compare/diff.rs | 48 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/src/compare/diff.rs b/src/compare/diff.rs index 9c32da98..0a0dd08c 100644 --- a/src/compare/diff.rs +++ b/src/compare/diff.rs @@ -11,6 +11,7 @@ use crate::parser::Paragraph; use crate::parser::PlainList; use crate::parser::PlainListItem; use crate::parser::Section; +use crate::parser::Drawer; #[derive(Debug)] pub struct DiffResult { @@ -218,7 +219,7 @@ fn compare_element<'s>( Element::GreaterBlock(obj) => compare_greater_block(source, emacs, obj), Element::FootnoteDefinition(obj) => compare_footnote_definition(source, emacs, obj), Element::Comment(obj) => compare_comment(source, emacs, obj), - Element::Drawer(obj) => todo!(), + Element::Drawer(obj) => compare_drawer(source, emacs, obj), } } @@ -497,3 +498,48 @@ fn compare_comment<'s>( children: child_status, }) } + +fn compare_drawer<'s>( + source: &'s str, + emacs: &'s Token<'s>, + rust: &'s Drawer<'s>, +) -> Result> { + let children = emacs.as_list()?; + let first_child = children + .first() + .ok_or("Should have at least one child.")? + .as_atom()?; + if first_child != "drawer" { + return Err("Drawer should correspond to a drawer cell.".into()); + } + let mut child_status = Vec::new(); + let mut this_status = DiffStatus::Good; + + let attributes_child = children + .iter() + .nth(1) + .ok_or("Should have an attributes child.")?; + let attributes_map = attributes_child.as_map()?; + let begin = attributes_map + .get(":begin") + .ok_or("Missing :begin attribute.")? + .as_atom()?; + let end = attributes_map + .get(":end") + .ok_or("Missing :end attribute.")? + .as_atom()?; + let (rust_begin, rust_end) = get_offsets(source, rust); + if (rust_begin + 1).to_string() != begin || (rust_end + 1).to_string() != end { + this_status = DiffStatus::Bad; + } + + for (emacs_child, rust_child) in children.iter().skip(2).zip(rust.children.iter()) { + child_status.push(compare_element(source, emacs_child, rust_child)?); + } + + Ok(DiffResult { + status: this_status, + name: "drawer".to_owned(), + children: child_status, + }) +} From 0be554bfb625632dac50bf97c80be9c1569818f6 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 16 Apr 2023 15:55:39 -0400 Subject: [PATCH 04/18] Add an example of headlines breaking a drawer. --- org_mode_samples/drawer/drawer_with_headline_inside.org | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 org_mode_samples/drawer/drawer_with_headline_inside.org diff --git a/org_mode_samples/drawer/drawer_with_headline_inside.org b/org_mode_samples/drawer/drawer_with_headline_inside.org new file mode 100644 index 00000000..7a743c69 --- /dev/null +++ b/org_mode_samples/drawer/drawer_with_headline_inside.org @@ -0,0 +1,9 @@ +* Headline +before +:candle: +inside +** Headline inside the drawer +the drawer +:end: + +after From d155ca1027bf7fe124817f275eaf309287e96e2f Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 16 Apr 2023 16:48:22 -0400 Subject: [PATCH 05/18] Set up an experiment for figuring out exit matcher priority. --- .../element_container_priority/Makefile | 23 +++++++ .../element_container_priority/README.org | 62 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 org_mode_samples/element_container_priority/Makefile create mode 100644 org_mode_samples/element_container_priority/README.org diff --git a/org_mode_samples/element_container_priority/Makefile b/org_mode_samples/element_container_priority/Makefile new file mode 100644 index 00000000..c47a86c1 --- /dev/null +++ b/org_mode_samples/element_container_priority/Makefile @@ -0,0 +1,23 @@ +SHELL := bash +.ONESHELL: +.SHELLFLAGS := -eu -o pipefail -c +.DELETE_ON_ERROR: +MAKEFLAGS += --warn-undefined-variables +MAKEFLAGS += --no-builtin-rules +SRCFILES := $(wildcard *.org) +OUTFILES := $(patsubst %.org,%.tree.txt,$(SRCFILES)) + +ifeq ($(origin .RECIPEPREFIX), undefined) + $(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later) +endif +.RECIPEPREFIX = > + +.PHONY: all +all: $(OUTFILES) + +.PHONY: clean +clean: +> rm -rf $(OUTFILES) + +%.tree.txt: %.org ../common.el ../dump_org_ast.bash +> ../dump_org_ast.bash $< $@ diff --git a/org_mode_samples/element_container_priority/README.org b/org_mode_samples/element_container_priority/README.org new file mode 100644 index 00000000..0b60ce31 --- /dev/null +++ b/org_mode_samples/element_container_priority/README.org @@ -0,0 +1,62 @@ +* What are the possible element containers +# Omitting tables because they only contain objects +# Omitting inline tasks because they are syntactically the same as heading+section just with a deep headline level. +# Omitting property drawers because they are syntactically the same as drawers. +** Sections +Sections are divided by headlines. + +#+begin_src org + Zeroth section + ,* First headline + First section + ,** Child headline + Child section + ,* Second top-level headline + Second top-level section +#+end_src +** Greater blocks +#+begin_src org + ,#+begin_center + elements + ,#+end_center +#+end_src +** Drawers +#+begin_src org + :drawername: + elements + :end: +#+end_src +** Dynamic blocks +#+begin_src org + ,* Headline + ,#+BEGIN: clocktable :scope subtree :maxlevel 2 + ,#+CAPTION: Clock summary at [2023-04-16 Sun 16:13] + | Headline | Time | + |--------------+--------| + | *Total time* | *0:00* | + ,#+END: +#+end_src +** Footnote definitions +#+begin_src org + [fn:1] A footnote definition. + + [fn:2] A multi-line + + footnote definition. +#+end_src +** Plain Lists +#+begin_src org + 1. foo + 1. bar + 2. baz +#+end_src +* Which container takes priority +This test interleaves the opening and closing of each element container to see which element becomes parsed vs gets broken up. The row determines the first opening element and the column determines the second opening element. +| | Section | Greater Block | Drawer | Dynamic Block | Footnote Definition | Plain List | +|---------------------+---------+---------------+--------+---------------+---------------------+------------| +| Section | - | | | | | | +| Greater Block | | | | | | | +| Drawer | | | | | | | +| Dynamic Block | | | | | | | +| Footnote Definition | | | | | | | +| Plain List | | | | | | | From f41197b0964e1ca3995c23987bc16064e22f5474 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 16 Apr 2023 16:55:53 -0400 Subject: [PATCH 06/18] Add the first test. --- org_mode_samples/element_container_priority/README.org | 2 +- .../element_container_priority/section_greater_block.org | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 org_mode_samples/element_container_priority/section_greater_block.org diff --git a/org_mode_samples/element_container_priority/README.org b/org_mode_samples/element_container_priority/README.org index 0b60ce31..5cfff0a6 100644 --- a/org_mode_samples/element_container_priority/README.org +++ b/org_mode_samples/element_container_priority/README.org @@ -54,7 +54,7 @@ Sections are divided by headlines. This test interleaves the opening and closing of each element container to see which element becomes parsed vs gets broken up. The row determines the first opening element and the column determines the second opening element. | | Section | Greater Block | Drawer | Dynamic Block | Footnote Definition | Plain List | |---------------------+---------+---------------+--------+---------------+---------------------+------------| -| Section | - | | | | | | +| Section | - | Section | | | | | | Greater Block | | | | | | | | Drawer | | | | | | | | Dynamic Block | | | | | | | diff --git a/org_mode_samples/element_container_priority/section_greater_block.org b/org_mode_samples/element_container_priority/section_greater_block.org new file mode 100644 index 00000000..558389f7 --- /dev/null +++ b/org_mode_samples/element_container_priority/section_greater_block.org @@ -0,0 +1,4 @@ +* Headline +#+begin_center +* Another headline +#+end_center From 70596dc27b55773cd8e44fdae2550f1cc7be4589 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 16 Apr 2023 17:06:08 -0400 Subject: [PATCH 07/18] Add all the section-first tests. --- .../element_container_priority/README.org | 16 ++++++++-------- .../section_drawer.org | 4 ++++ .../section_dynamic_block.org | 4 ++++ .../section_footnote_definition.org | 4 ++++ .../section_plain_list.org | 4 ++++ 5 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 org_mode_samples/element_container_priority/section_drawer.org create mode 100644 org_mode_samples/element_container_priority/section_dynamic_block.org create mode 100644 org_mode_samples/element_container_priority/section_footnote_definition.org create mode 100644 org_mode_samples/element_container_priority/section_plain_list.org diff --git a/org_mode_samples/element_container_priority/README.org b/org_mode_samples/element_container_priority/README.org index 5cfff0a6..b4af22b3 100644 --- a/org_mode_samples/element_container_priority/README.org +++ b/org_mode_samples/element_container_priority/README.org @@ -52,11 +52,11 @@ Sections are divided by headlines. #+end_src * Which container takes priority This test interleaves the opening and closing of each element container to see which element becomes parsed vs gets broken up. The row determines the first opening element and the column determines the second opening element. -| | Section | Greater Block | Drawer | Dynamic Block | Footnote Definition | Plain List | -|---------------------+---------+---------------+--------+---------------+---------------------+------------| -| Section | - | Section | | | | | -| Greater Block | | | | | | | -| Drawer | | | | | | | -| Dynamic Block | | | | | | | -| Footnote Definition | | | | | | | -| Plain List | | | | | | | +| | Section | Greater Block | Drawer | Dynamic Block | Footnote Definition | Plain List | +|---------------------+---------+---------------+---------+---------------+---------------------+------------| +| Section | - | Section | Section | Section | Section | Section | +| Greater Block | | | | | | | +| Drawer | | | | | | | +| Dynamic Block | | | | | | | +| Footnote Definition | | | | | | | +| Plain List | | | | | | | diff --git a/org_mode_samples/element_container_priority/section_drawer.org b/org_mode_samples/element_container_priority/section_drawer.org new file mode 100644 index 00000000..941b458f --- /dev/null +++ b/org_mode_samples/element_container_priority/section_drawer.org @@ -0,0 +1,4 @@ +* Headline +:drawername: +* Another headline +:end: diff --git a/org_mode_samples/element_container_priority/section_dynamic_block.org b/org_mode_samples/element_container_priority/section_dynamic_block.org new file mode 100644 index 00000000..e1629e5a --- /dev/null +++ b/org_mode_samples/element_container_priority/section_dynamic_block.org @@ -0,0 +1,4 @@ +* Headline +#+BEGIN: foo :hlines 1 :id global +* Another headline +#+END: diff --git a/org_mode_samples/element_container_priority/section_footnote_definition.org b/org_mode_samples/element_container_priority/section_footnote_definition.org new file mode 100644 index 00000000..51f8f85c --- /dev/null +++ b/org_mode_samples/element_container_priority/section_footnote_definition.org @@ -0,0 +1,4 @@ +* Headline +[fn:1] footnote. +* Another headline +is this still in the footnote? diff --git a/org_mode_samples/element_container_priority/section_plain_list.org b/org_mode_samples/element_container_priority/section_plain_list.org new file mode 100644 index 00000000..8274d9c8 --- /dev/null +++ b/org_mode_samples/element_container_priority/section_plain_list.org @@ -0,0 +1,4 @@ +* Headline +1. foo +* Another headline +2. bar From e20bd793beaa666d4ebb114e582805da234a1889 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 16 Apr 2023 17:08:56 -0400 Subject: [PATCH 08/18] Include comment about section-first and section-second tests. --- .../element_container_priority/README.org | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/org_mode_samples/element_container_priority/README.org b/org_mode_samples/element_container_priority/README.org index b4af22b3..14be2a81 100644 --- a/org_mode_samples/element_container_priority/README.org +++ b/org_mode_samples/element_container_priority/README.org @@ -52,11 +52,12 @@ Sections are divided by headlines. #+end_src * Which container takes priority This test interleaves the opening and closing of each element container to see which element becomes parsed vs gets broken up. The row determines the first opening element and the column determines the second opening element. +# Section first and section second tests are identical so I only included section first in the repo. | | Section | Greater Block | Drawer | Dynamic Block | Footnote Definition | Plain List | |---------------------+---------+---------------+---------+---------------+---------------------+------------| | Section | - | Section | Section | Section | Section | Section | -| Greater Block | | | | | | | -| Drawer | | | | | | | -| Dynamic Block | | | | | | | -| Footnote Definition | | | | | | | -| Plain List | | | | | | | +| Greater Block | Section | | | | | | +| Drawer | Section | | | | | | +| Dynamic Block | Section | | | | | | +| Footnote Definition | Section | | | | | | +| Plain List | Section | | | | | | From 6da7cb2c17f6faae07287db3c7e16aeee810e462 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 16 Apr 2023 17:18:41 -0400 Subject: [PATCH 09/18] Add greater block first tests. --- .../element_container_priority/README.org | 16 ++++++++-------- .../greater_block_drawer.org | 4 ++++ .../greater_block_dynamic_block.org | 4 ++++ .../greater_block_footnote_definition.org | 4 ++++ .../greater_block_greater_block.org | 5 +++++ .../greater_block_plain_list.org | 4 ++++ 6 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 org_mode_samples/element_container_priority/greater_block_drawer.org create mode 100644 org_mode_samples/element_container_priority/greater_block_dynamic_block.org create mode 100644 org_mode_samples/element_container_priority/greater_block_footnote_definition.org create mode 100644 org_mode_samples/element_container_priority/greater_block_greater_block.org create mode 100644 org_mode_samples/element_container_priority/greater_block_plain_list.org diff --git a/org_mode_samples/element_container_priority/README.org b/org_mode_samples/element_container_priority/README.org index 14be2a81..f6fc2227 100644 --- a/org_mode_samples/element_container_priority/README.org +++ b/org_mode_samples/element_container_priority/README.org @@ -53,11 +53,11 @@ Sections are divided by headlines. * Which container takes priority This test interleaves the opening and closing of each element container to see which element becomes parsed vs gets broken up. The row determines the first opening element and the column determines the second opening element. # Section first and section second tests are identical so I only included section first in the repo. -| | Section | Greater Block | Drawer | Dynamic Block | Footnote Definition | Plain List | -|---------------------+---------+---------------+---------+---------------+---------------------+------------| -| Section | - | Section | Section | Section | Section | Section | -| Greater Block | Section | | | | | | -| Drawer | Section | | | | | | -| Dynamic Block | Section | | | | | | -| Footnote Definition | Section | | | | | | -| Plain List | Section | | | | | | +| | Section | Greater Block | Drawer | Dynamic Block | Footnote Definition | Plain List | +|---------------------+---------+---------------+---------------+---------------+---------------------+---------------| +| Section | - | Section | Section | Section | Section | Section | +| Greater Block | Section | First | Greater Block | Greater Block | Greater Block | Greater Block | +| Drawer | Section | | | | | | +| Dynamic Block | Section | | | | | | +| Footnote Definition | Section | | | | | | +| Plain List | Section | | | | | | diff --git a/org_mode_samples/element_container_priority/greater_block_drawer.org b/org_mode_samples/element_container_priority/greater_block_drawer.org new file mode 100644 index 00000000..579d036d --- /dev/null +++ b/org_mode_samples/element_container_priority/greater_block_drawer.org @@ -0,0 +1,4 @@ +#+begin_center +:drawername: +#+end_center +:end: diff --git a/org_mode_samples/element_container_priority/greater_block_dynamic_block.org b/org_mode_samples/element_container_priority/greater_block_dynamic_block.org new file mode 100644 index 00000000..9eb627a6 --- /dev/null +++ b/org_mode_samples/element_container_priority/greater_block_dynamic_block.org @@ -0,0 +1,4 @@ +#+begin_center +#+BEGIN: foo :hlines 1 :id global +#+end_center +#+END: diff --git a/org_mode_samples/element_container_priority/greater_block_footnote_definition.org b/org_mode_samples/element_container_priority/greater_block_footnote_definition.org new file mode 100644 index 00000000..992c7d66 --- /dev/null +++ b/org_mode_samples/element_container_priority/greater_block_footnote_definition.org @@ -0,0 +1,4 @@ +#+begin_center +[fn:1] footenote. +#+end_center +Is this still in the footnote? diff --git a/org_mode_samples/element_container_priority/greater_block_greater_block.org b/org_mode_samples/element_container_priority/greater_block_greater_block.org new file mode 100644 index 00000000..258868e5 --- /dev/null +++ b/org_mode_samples/element_container_priority/greater_block_greater_block.org @@ -0,0 +1,5 @@ +#+begin_center +#+begin_quote +foo +#+end_center +#+end_quote diff --git a/org_mode_samples/element_container_priority/greater_block_plain_list.org b/org_mode_samples/element_container_priority/greater_block_plain_list.org new file mode 100644 index 00000000..4fafe9f3 --- /dev/null +++ b/org_mode_samples/element_container_priority/greater_block_plain_list.org @@ -0,0 +1,4 @@ +#+begin_center +1. foo +#+end_center +2. bar From ed6fda99186eb77d5d4120bef43b18db3ad6df61 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 16 Apr 2023 17:33:33 -0400 Subject: [PATCH 10/18] Add the greater block second tests. --- org_mode_samples/element_container_priority/README.org | 10 +++++----- .../drawer_greater_block.org | 4 ++++ .../dynamic_block_greater_block.org | 4 ++++ .../footnote_definition_greater_block.org | 7 +++++++ .../plain_list_greater_block.org | 6 ++++++ 5 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 org_mode_samples/element_container_priority/drawer_greater_block.org create mode 100644 org_mode_samples/element_container_priority/dynamic_block_greater_block.org create mode 100644 org_mode_samples/element_container_priority/footnote_definition_greater_block.org create mode 100644 org_mode_samples/element_container_priority/plain_list_greater_block.org diff --git a/org_mode_samples/element_container_priority/README.org b/org_mode_samples/element_container_priority/README.org index f6fc2227..0881c912 100644 --- a/org_mode_samples/element_container_priority/README.org +++ b/org_mode_samples/element_container_priority/README.org @@ -56,8 +56,8 @@ This test interleaves the opening and closing of each element container to see w | | Section | Greater Block | Drawer | Dynamic Block | Footnote Definition | Plain List | |---------------------+---------+---------------+---------------+---------------+---------------------+---------------| | Section | - | Section | Section | Section | Section | Section | -| Greater Block | Section | First | Greater Block | Greater Block | Greater Block | Greater Block | -| Drawer | Section | | | | | | -| Dynamic Block | Section | | | | | | -| Footnote Definition | Section | | | | | | -| Plain List | Section | | | | | | +| Greater Block | Section | First |First |First | First |First | +| Drawer | Section | First | | | | | +| Dynamic Block | Section | First | | | | | +| Footnote Definition | Section | First | | | | | +| Plain List | Section | Second | | | | | diff --git a/org_mode_samples/element_container_priority/drawer_greater_block.org b/org_mode_samples/element_container_priority/drawer_greater_block.org new file mode 100644 index 00000000..bcdf079c --- /dev/null +++ b/org_mode_samples/element_container_priority/drawer_greater_block.org @@ -0,0 +1,4 @@ +:drawername: +#+begin_center +:end: +#+end_center diff --git a/org_mode_samples/element_container_priority/dynamic_block_greater_block.org b/org_mode_samples/element_container_priority/dynamic_block_greater_block.org new file mode 100644 index 00000000..f1720a34 --- /dev/null +++ b/org_mode_samples/element_container_priority/dynamic_block_greater_block.org @@ -0,0 +1,4 @@ +#+BEGIN: foo :hlines 1 :id global +#+begin_center +#+END: +#+end_center diff --git a/org_mode_samples/element_container_priority/footnote_definition_greater_block.org b/org_mode_samples/element_container_priority/footnote_definition_greater_block.org new file mode 100644 index 00000000..277d777b --- /dev/null +++ b/org_mode_samples/element_container_priority/footnote_definition_greater_block.org @@ -0,0 +1,7 @@ +[fn:1] footenote. +#+begin_center + + +#+end_center + +Is this still in the footnote? diff --git a/org_mode_samples/element_container_priority/plain_list_greater_block.org b/org_mode_samples/element_container_priority/plain_list_greater_block.org new file mode 100644 index 00000000..cf2d6484 --- /dev/null +++ b/org_mode_samples/element_container_priority/plain_list_greater_block.org @@ -0,0 +1,6 @@ +1. foo + #+begin_center + + + #+end_center +2. bar From beff8f89990c12de2687c32f9e3d26255a84ae85 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 16 Apr 2023 17:41:14 -0400 Subject: [PATCH 11/18] Add the drawer first tests. --- .../element_container_priority/README.org | 16 ++++++++-------- .../element_container_priority/drawer_drawer.org | 5 +++++ .../drawer_dynamic_block.org | 4 ++++ .../drawer_footnote_definition.org | 4 ++++ .../drawer_plain_list.org | 4 ++++ 5 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 org_mode_samples/element_container_priority/drawer_drawer.org create mode 100644 org_mode_samples/element_container_priority/drawer_dynamic_block.org create mode 100644 org_mode_samples/element_container_priority/drawer_footnote_definition.org create mode 100644 org_mode_samples/element_container_priority/drawer_plain_list.org diff --git a/org_mode_samples/element_container_priority/README.org b/org_mode_samples/element_container_priority/README.org index 0881c912..4758af49 100644 --- a/org_mode_samples/element_container_priority/README.org +++ b/org_mode_samples/element_container_priority/README.org @@ -53,11 +53,11 @@ Sections are divided by headlines. * Which container takes priority This test interleaves the opening and closing of each element container to see which element becomes parsed vs gets broken up. The row determines the first opening element and the column determines the second opening element. # Section first and section second tests are identical so I only included section first in the repo. -| | Section | Greater Block | Drawer | Dynamic Block | Footnote Definition | Plain List | -|---------------------+---------+---------------+---------------+---------------+---------------------+---------------| -| Section | - | Section | Section | Section | Section | Section | -| Greater Block | Section | First |First |First | First |First | -| Drawer | Section | First | | | | | -| Dynamic Block | Section | First | | | | | -| Footnote Definition | Section | First | | | | | -| Plain List | Section | Second | | | | | +| | Section | Greater Block | Drawer | Dynamic Block | Footnote Definition | Plain List | +|---------------------+---------+---------------+---------+---------------+---------------------+------------| +| Section | - | Section | Section | Section | Section | Section | +| Greater Block | Section | First | First | First | First | First | +| Drawer | Section | First | First | First | First | First | +| Dynamic Block | Section | First | | | | | +| Footnote Definition | Section | First | | | | | +| Plain List | Section | Second | | | | | diff --git a/org_mode_samples/element_container_priority/drawer_drawer.org b/org_mode_samples/element_container_priority/drawer_drawer.org new file mode 100644 index 00000000..8b8048b6 --- /dev/null +++ b/org_mode_samples/element_container_priority/drawer_drawer.org @@ -0,0 +1,5 @@ +:firstdrawer: +:seconddrawer: +foo +:end: +:end: diff --git a/org_mode_samples/element_container_priority/drawer_dynamic_block.org b/org_mode_samples/element_container_priority/drawer_dynamic_block.org new file mode 100644 index 00000000..0d99d8ec --- /dev/null +++ b/org_mode_samples/element_container_priority/drawer_dynamic_block.org @@ -0,0 +1,4 @@ +:drawername: +#+BEGIN: foo :hlines 1 :id global +:end: +#+END: diff --git a/org_mode_samples/element_container_priority/drawer_footnote_definition.org b/org_mode_samples/element_container_priority/drawer_footnote_definition.org new file mode 100644 index 00000000..da03cf6f --- /dev/null +++ b/org_mode_samples/element_container_priority/drawer_footnote_definition.org @@ -0,0 +1,4 @@ +:drawername: +[fn:1] footnote. +:end: +Is this still in the footnote? diff --git a/org_mode_samples/element_container_priority/drawer_plain_list.org b/org_mode_samples/element_container_priority/drawer_plain_list.org new file mode 100644 index 00000000..6048d959 --- /dev/null +++ b/org_mode_samples/element_container_priority/drawer_plain_list.org @@ -0,0 +1,4 @@ +:drawername: +1. foo +:end: +2. bar From a6036e257ee6a64251e3828130fb8df728567554 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 16 Apr 2023 17:50:16 -0400 Subject: [PATCH 12/18] Add the drawer second tests. --- org_mode_samples/element_container_priority/README.org | 6 +++--- .../element_container_priority/dynamic_block_drawer.org | 4 ++++ .../footnote_definition_drawer.org | 6 ++++++ .../element_container_priority/plain_list_drawer.org | 6 ++++++ 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 org_mode_samples/element_container_priority/dynamic_block_drawer.org create mode 100644 org_mode_samples/element_container_priority/footnote_definition_drawer.org create mode 100644 org_mode_samples/element_container_priority/plain_list_drawer.org diff --git a/org_mode_samples/element_container_priority/README.org b/org_mode_samples/element_container_priority/README.org index 4758af49..6d457b1e 100644 --- a/org_mode_samples/element_container_priority/README.org +++ b/org_mode_samples/element_container_priority/README.org @@ -58,6 +58,6 @@ This test interleaves the opening and closing of each element container to see w | Section | - | Section | Section | Section | Section | Section | | Greater Block | Section | First | First | First | First | First | | Drawer | Section | First | First | First | First | First | -| Dynamic Block | Section | First | | | | | -| Footnote Definition | Section | First | | | | | -| Plain List | Section | Second | | | | | +| Dynamic Block | Section | First | First | | | | +| Footnote Definition | Section | First | First | | | | +| Plain List | Section | Second | First | | | | diff --git a/org_mode_samples/element_container_priority/dynamic_block_drawer.org b/org_mode_samples/element_container_priority/dynamic_block_drawer.org new file mode 100644 index 00000000..83d49f97 --- /dev/null +++ b/org_mode_samples/element_container_priority/dynamic_block_drawer.org @@ -0,0 +1,4 @@ +#+BEGIN: foo :hlines 1 :id global +:drawername: +#+END: +:end: diff --git a/org_mode_samples/element_container_priority/footnote_definition_drawer.org b/org_mode_samples/element_container_priority/footnote_definition_drawer.org new file mode 100644 index 00000000..ecf1b97e --- /dev/null +++ b/org_mode_samples/element_container_priority/footnote_definition_drawer.org @@ -0,0 +1,6 @@ +[fn:1] footnote. +:drawername: + + +:end: +Is this still in the footnote? diff --git a/org_mode_samples/element_container_priority/plain_list_drawer.org b/org_mode_samples/element_container_priority/plain_list_drawer.org new file mode 100644 index 00000000..5547ec30 --- /dev/null +++ b/org_mode_samples/element_container_priority/plain_list_drawer.org @@ -0,0 +1,6 @@ +1. foo +:drawername: + + +:end: +2. bar From 4c4d79a6658e2a3aea3ad2e4fd05f86bde8aa6db Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 16 Apr 2023 17:56:03 -0400 Subject: [PATCH 13/18] Add the dynamic block first tests. --- org_mode_samples/element_container_priority/README.org | 2 +- .../dynamic_block_dynamic_block.org | 5 +++++ .../dynamic_block_footnote_definition.org | 4 ++++ .../element_container_priority/dynamic_block_plain_list.org | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 org_mode_samples/element_container_priority/dynamic_block_dynamic_block.org create mode 100644 org_mode_samples/element_container_priority/dynamic_block_footnote_definition.org create mode 100644 org_mode_samples/element_container_priority/dynamic_block_plain_list.org diff --git a/org_mode_samples/element_container_priority/README.org b/org_mode_samples/element_container_priority/README.org index 6d457b1e..8bf57e05 100644 --- a/org_mode_samples/element_container_priority/README.org +++ b/org_mode_samples/element_container_priority/README.org @@ -58,6 +58,6 @@ This test interleaves the opening and closing of each element container to see w | Section | - | Section | Section | Section | Section | Section | | Greater Block | Section | First | First | First | First | First | | Drawer | Section | First | First | First | First | First | -| Dynamic Block | Section | First | First | | | | +| Dynamic Block | Section | First | First | First | First | First | | Footnote Definition | Section | First | First | | | | | Plain List | Section | Second | First | | | | diff --git a/org_mode_samples/element_container_priority/dynamic_block_dynamic_block.org b/org_mode_samples/element_container_priority/dynamic_block_dynamic_block.org new file mode 100644 index 00000000..84cb3fdb --- /dev/null +++ b/org_mode_samples/element_container_priority/dynamic_block_dynamic_block.org @@ -0,0 +1,5 @@ +#+BEGIN: foo :hlines 1 :id global +#+BEGIN: bar :hlines 1 :id global +foo +#+END: +#+END: diff --git a/org_mode_samples/element_container_priority/dynamic_block_footnote_definition.org b/org_mode_samples/element_container_priority/dynamic_block_footnote_definition.org new file mode 100644 index 00000000..fc7db9b6 --- /dev/null +++ b/org_mode_samples/element_container_priority/dynamic_block_footnote_definition.org @@ -0,0 +1,4 @@ +#+BEGIN: foo :hlines 1 :id global +[fn:1] footnote. +#+END: +Is this still in the footnote definition? diff --git a/org_mode_samples/element_container_priority/dynamic_block_plain_list.org b/org_mode_samples/element_container_priority/dynamic_block_plain_list.org new file mode 100644 index 00000000..9ab946ed --- /dev/null +++ b/org_mode_samples/element_container_priority/dynamic_block_plain_list.org @@ -0,0 +1,4 @@ +#+BEGIN: foo :hlines 1 :id global +1. foo +#+END: +2. bar From 16218ec04032d2fbc7778e8d650bd7fd91de1b96 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 16 Apr 2023 18:01:47 -0400 Subject: [PATCH 14/18] Add footnote definition first tests. --- org_mode_samples/element_container_priority/README.org | 6 ++++-- .../footnote_definition_dynamic_block.org | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 org_mode_samples/element_container_priority/footnote_definition_dynamic_block.org diff --git a/org_mode_samples/element_container_priority/README.org b/org_mode_samples/element_container_priority/README.org index 8bf57e05..78ca4b38 100644 --- a/org_mode_samples/element_container_priority/README.org +++ b/org_mode_samples/element_container_priority/README.org @@ -1,5 +1,6 @@ * What are the possible element containers # Omitting tables because they only contain objects +# Omitting paragraphs because they only contain objects # Omitting inline tasks because they are syntactically the same as heading+section just with a deep headline level. # Omitting property drawers because they are syntactically the same as drawers. ** Sections @@ -53,11 +54,12 @@ Sections are divided by headlines. * Which container takes priority This test interleaves the opening and closing of each element container to see which element becomes parsed vs gets broken up. The row determines the first opening element and the column determines the second opening element. # Section first and section second tests are identical so I only included section first in the repo. +# Footnote definition and plain list have the same end condition of two blank lines so they are untestable. | | Section | Greater Block | Drawer | Dynamic Block | Footnote Definition | Plain List | |---------------------+---------+---------------+---------+---------------+---------------------+------------| | Section | - | Section | Section | Section | Section | Section | | Greater Block | Section | First | First | First | First | First | | Drawer | Section | First | First | First | First | First | | Dynamic Block | Section | First | First | First | First | First | -| Footnote Definition | Section | First | First | | | | -| Plain List | Section | Second | First | | | | +| Footnote Definition | Section | First | First | First | - | - | +| Plain List | Section | Second | First | | - | | diff --git a/org_mode_samples/element_container_priority/footnote_definition_dynamic_block.org b/org_mode_samples/element_container_priority/footnote_definition_dynamic_block.org new file mode 100644 index 00000000..66a1812e --- /dev/null +++ b/org_mode_samples/element_container_priority/footnote_definition_dynamic_block.org @@ -0,0 +1,6 @@ +[fn:1] footnote. +#+BEGIN: foo :hlines 1 :id global + + +#+END: +Is this still in the footnote? From f1880fdb7daf91c5d50ca19063c58972ab7b7a0f Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 17 Apr 2023 16:41:58 -0400 Subject: [PATCH 15/18] Add plain list first tests. --- org_mode_samples/element_container_priority/README.org | 2 +- .../element_container_priority/plain_list_dynamic_block.org | 6 ++++++ .../element_container_priority/plain_list_plain_list.org | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 org_mode_samples/element_container_priority/plain_list_dynamic_block.org create mode 100644 org_mode_samples/element_container_priority/plain_list_plain_list.org diff --git a/org_mode_samples/element_container_priority/README.org b/org_mode_samples/element_container_priority/README.org index 78ca4b38..24c3f203 100644 --- a/org_mode_samples/element_container_priority/README.org +++ b/org_mode_samples/element_container_priority/README.org @@ -62,4 +62,4 @@ This test interleaves the opening and closing of each element container to see w | Drawer | Section | First | First | First | First | First | | Dynamic Block | Section | First | First | First | First | First | | Footnote Definition | Section | First | First | First | - | - | -| Plain List | Section | Second | First | | - | | +| Plain List | Section | Second | First | Second | - | First | diff --git a/org_mode_samples/element_container_priority/plain_list_dynamic_block.org b/org_mode_samples/element_container_priority/plain_list_dynamic_block.org new file mode 100644 index 00000000..c5d1daf4 --- /dev/null +++ b/org_mode_samples/element_container_priority/plain_list_dynamic_block.org @@ -0,0 +1,6 @@ +1. foo + #+BEGIN: foo :hlines 1 :id global + + + #+END: +2. bar diff --git a/org_mode_samples/element_container_priority/plain_list_plain_list.org b/org_mode_samples/element_container_priority/plain_list_plain_list.org new file mode 100644 index 00000000..cfe5d458 --- /dev/null +++ b/org_mode_samples/element_container_priority/plain_list_plain_list.org @@ -0,0 +1,5 @@ +1. foo + 1. bar + + + 2. baz From 49be5ae7b143ed499b3fefc084266699909b4bf6 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 17 Apr 2023 17:29:35 -0400 Subject: [PATCH 16/18] Identify a mistake in the plain list drawer test. --- .../element_container_priority/README.org | 25 ++++++++++++++++++- .../plain_list_drawer.org | 4 +-- .../test_case_1.org | 13 ++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 org_mode_samples/element_container_priority/test_case_1.org diff --git a/org_mode_samples/element_container_priority/README.org b/org_mode_samples/element_container_priority/README.org index 24c3f203..5bda0b1d 100644 --- a/org_mode_samples/element_container_priority/README.org +++ b/org_mode_samples/element_container_priority/README.org @@ -62,4 +62,27 @@ This test interleaves the opening and closing of each element container to see w | Drawer | Section | First | First | First | First | First | | Dynamic Block | Section | First | First | First | First | First | | Footnote Definition | Section | First | First | First | - | - | -| Plain List | Section | Second | First | Second | - | First | +| Plain List | Section | Second | Second | Second | - | First | +* Possible solutions +** Create tiers of exit matchers +- Document level (sections/headlines) +- Greater Block / Dynamic Block +- Remaining element containers +- Object containers +*** What if we ignore exit matchers of lower tiers +**** Test Case 1 +#+begin_src org + # A plain list containing a greater block that contains a drawer + 1. foo + ,#+begin_center + :drawername: + + + :end: + ,#+end_center + 2. bar + :drawername: + + + :end: +#+end_src diff --git a/org_mode_samples/element_container_priority/plain_list_drawer.org b/org_mode_samples/element_container_priority/plain_list_drawer.org index 5547ec30..43053898 100644 --- a/org_mode_samples/element_container_priority/plain_list_drawer.org +++ b/org_mode_samples/element_container_priority/plain_list_drawer.org @@ -1,6 +1,6 @@ 1. foo -:drawername: + :drawername: -:end: + :end: 2. bar diff --git a/org_mode_samples/element_container_priority/test_case_1.org b/org_mode_samples/element_container_priority/test_case_1.org new file mode 100644 index 00000000..03479601 --- /dev/null +++ b/org_mode_samples/element_container_priority/test_case_1.org @@ -0,0 +1,13 @@ +# A plain list containing a greater block that contains a drawer +1. foo + #+begin_center + :drawername: + + + :end: + #+end_center +2. bar + :drawername: + + + :end: From 89040c51a69dcbff6676cb7d2dfe34817be07a63 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 17 Apr 2023 19:45:50 -0400 Subject: [PATCH 17/18] Update test case 1. --- .../element_container_priority/README.org | 23 ++++++------------- .../test_case_1.org | 10 ++------ 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/org_mode_samples/element_container_priority/README.org b/org_mode_samples/element_container_priority/README.org index 5bda0b1d..ee016aaf 100644 --- a/org_mode_samples/element_container_priority/README.org +++ b/org_mode_samples/element_container_priority/README.org @@ -62,27 +62,18 @@ This test interleaves the opening and closing of each element container to see w | Drawer | Section | First | First | First | First | First | | Dynamic Block | Section | First | First | First | First | First | | Footnote Definition | Section | First | First | First | - | - | -| Plain List | Section | Second | Second | Second | - | First | +| Plain List | Section | Second | Second | Second | - | First | * Possible solutions -** Create tiers of exit matchers -- Document level (sections/headlines) -- Greater Block / Dynamic Block -- Remaining element containers -- Object containers -*** What if we ignore exit matchers of lower tiers -**** Test Case 1 +** Greater blocks, drawers, and dynamic blocks disable plain list exit matcher +*** Test Case 1 #+begin_src org - # A plain list containing a greater block that contains a drawer 1. foo ,#+begin_center - :drawername: + 2. bar - :end: + baz ,#+end_center - 2. bar - :drawername: - - - :end: #+end_src +** Parse out headlines first +Then go through elements parsing them in-order diff --git a/org_mode_samples/element_container_priority/test_case_1.org b/org_mode_samples/element_container_priority/test_case_1.org index 03479601..76c2a7eb 100644 --- a/org_mode_samples/element_container_priority/test_case_1.org +++ b/org_mode_samples/element_container_priority/test_case_1.org @@ -1,13 +1,7 @@ -# A plain list containing a greater block that contains a drawer 1. foo #+begin_center - :drawername: + 2. bar - :end: + baz #+end_center -2. bar - :drawername: - - - :end: From 8b811bec95e77080dc80b79fc5e7c677f595d570 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 17 Apr 2023 19:54:33 -0400 Subject: [PATCH 18/18] Count pass/fail stats for compare parse script. --- scripts/compare_parse_all.bash | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/compare_parse_all.bash b/scripts/compare_parse_all.bash index 2970b3e7..fc8a8416 100755 --- a/scripts/compare_parse_all.bash +++ b/scripts/compare_parse_all.bash @@ -13,15 +13,24 @@ test_files=$(find $org_dir -type f -name '*.org' | sort) cargo build --bin org_compare +pass=0 +fail=0 + while read test_file; do + print_path=$(realpath --relative-to="$org_dir" "$test_file") set +e diff_results=$("$compare_bin" "$test_file") diff_status=$? set -e if [ $diff_status -eq 0 ]; then - echo "GOOD $test_file" + echo "GOOD $print_path" + pass=$((pass + 1)) else - echo "BAD $test_file" + echo "BAD $print_path" + fail=$((fail + 1)) fi done<<<"$test_files" + +total=$((pass + fail)) +(>&2 echo "Tests passed: $pass/$total")