organic/org_mode_samples/element_container_priority/README.org

85 lines
3.3 KiB
Org Mode
Raw Normal View History

* What are the possible element containers
# Omitting tables because they only contain objects
2023-04-16 22:01:47 +00:00
# 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
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 first and section second tests are identical so I only included section first in the repo.
2023-04-16 22:01:47 +00:00
# Footnote definition and plain list have the same end condition of two blank lines so they are untestable.
2023-04-18 00:13:07 +00:00
| | Section | Greater Block | Drawer | Dynamic Block | Footnote Definition | Plain List | Paragraph |
|---------------------+---------+---------------+---------+---------------+---------------------+------------+-----------|
2023-04-18 00:33:51 +00:00
| Section | - | Section | Section | Section | Section | Section | Section |
2023-04-18 00:40:23 +00:00
| Greater Block | Section | First | First | First | First | First | First |
| Drawer | Section | First | First | First | First | First | First |
| Dynamic Block | Section | First | First | First | First | First | First |
| Footnote Definition | Section | First | First | First | - | - | - |
| Plain List | Section | Second | Second | Second | - | - | - |
2023-04-18 00:33:51 +00:00
| Paragraph | Section | Second | Second | Second | - | - | - |
* Possible solutions
2023-04-17 23:45:50 +00:00
** Greater blocks, drawers, and dynamic blocks disable plain list exit matcher
*** Test Case 1
#+begin_src org
1. foo
,#+begin_center
2023-04-17 23:45:50 +00:00
2. bar
2023-04-17 23:45:50 +00:00
baz
,#+end_center
#+end_src
2023-04-17 23:45:50 +00:00
** Parse out headlines first
Then go through elements parsing them in-order
2023-04-18 00:13:07 +00:00
** Should paragraph exit matcher apply to the element matcher in the exit matcher
No. But paragraph exit matcher needs to apply to the object matcher.
2023-04-18 00:53:51 +00:00
** Maybe two groups of elements: alpha and beta
When entering an alpha element, ignore beta exit matchers above this in the context.