From d155ca1027bf7fe124817f275eaf309287e96e2f Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 16 Apr 2023 16:48:22 -0400 Subject: [PATCH] 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 | | | | | | |