Skip to content

Latest commit

 

History

History
1728 lines (1278 loc) · 36.1 KB

File metadata and controls

1728 lines (1278 loc) · 36.1 KB

This is a summary of https://orgmode.org/worg/exporters/org-element-docstrings.html and https://orgmode.org/worg/dev/org-syntax.html.

Shared behavior

Each greater element, element and object has a fixed set of properties attached to it. The following are shared by all types:

begin and end
refer to the beginning and ending position of the element or object
post-blank
number of blank lines or whitespaces at the end
parent
refers to the element or object containing it

Greater elements, elements and objects containing objects also have:

content-begin and content-end
used to delimit content
content
list of elements, objects and raw strings contained in the element or object

Greater elements and elements accepting affiliated keywords have:

post-affiliated
refers to the position after all such keywords

Syntax

Except where mentioned capitalization of the syntax is ignored.

Elements

Elements describe the structure of an org file.

Most elements can contain objects and/or plain text.

Except the following all elements start and end at the beginning of a line:

  • Clock
  • Headline
  • Inlinetask
  • Item
  • Planning
  • Node property
  • Section Table row

Elements accept a fixed set of keywords as attributes. These are called affiliated keywords (not to be confused with regular keywords which are actual elements).

Some elements have special properties whose value can hold objects themselves. These values are called secondary strings.

The following items are obsolete and won’t be parsed:

  • Quote section

Blocks

  • Center block (CENTER)
  • Comment block (COMMENT)
  • Dynamic block
  • Example block (EXAMPLE)
  • Export block (EXPORT)
  • Quote block (QUOTE)
  • Special block
  • Src block (SRC)
  • Verse block (VERSE)

Syntax

Except for dynamic blocks they follow this syntax:

CONTENTS

NAME can contain any non-whitespace character. Name determines the type of the block. If name is none of the above mentioned it is a special block.

PARAMETER can contain any character other than new line and can be omitted.

CONTENTS can contain anything except a line #+END_NAME on its own. Lines beginning with stars must be quoted by a comma. CONTENTS will not be parsed except for verse block.

Babel call :affiliated-keywords:

Syntax

This is a guess of the syntax and meaning based on the parse code.

#+CALL: FUNCTION[INSIDE-HEADER](ARGUMENTS) END-HEADER

FUNCTION is the name of a source block to execute.

INSIDE-HEADER can contain everything but ] and a newline.

ARGUMENTS can contain everything but ) and a newline.

END-HEADER can contain everything but a newline.

Properties

  • call: the function/code block to call
  • inside-header
  • arguments: arguments to the function/code block
  • end-header
  • begin
  • end
  • value: everything after the : as a string
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Center block :greater-element:affiliated-keywords:

Syntax

See syntax for blocks.

Properties

  • begin
  • end
  • hiddenp
  • contents-begin
  • contents-end
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Clock

Syntax

CLOCK: TIMESTAMP DURATION

TIMESTAMP and DURATION are optional.

TIMESTAMP is a timestamp object.

DURATION follows the pattern: => HH:MM. HH is a number containing any number of digits. MM is a two digit number.

Properties

  • status: either closed (if duration is set) or running (if duration is not set)
  • value: a timestamp
  • duration: a duration
  • begin
  • end
  • post-blank
  • post-affiliated = begin

Comment :affiliated-keywords:

Syntax

# CONTENTS

A line starting with a # and space (or end of line). Optionally preceded with whitespace.

CONTENTS can be any string (except newline). If multiple comments are accumulated the newline will be stored a well.

Consecutive comment lines are accumulated into one comment (without leading #).

Properties

  • begin
  • end
  • value
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Comment block :affiliated-keywords:

Syntax

See blocks.

Properties

  • begin
  • end
  • value
  • post-blank
  • post-affiliated
  • and any affiliated keywords

Diary sexp :affiliated-keywords:

Syntax

%%(VALUE

VALUE can contain any character except a newline. The expression has to start at column 0.

Properties

  • begin
  • end
  • value: the entire value (with %%()
  • post-blank
  • post-affiliated
  • and any affiliated keywords

Drawer :greater-element:affiliated-keywords:

Syntax

:NAME:
CONTENTS
:END:

NAME can contain word-constituent characters, hyphens and underscores.

CONTENTS can contain any element but another drawer.

Properties

  • drawer-name
  • begin
  • end
  • hiddenp
  • contents-begin
  • contents-end
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Dynamic block :greater-element:affiliated-keywords:

Syntax

#+BEGIN: NAME PARAMETERS
CONTENTS
#+END:

NAME cannot contain any whitespace characters.

PARAMETERS can contain any character and can be omitted.

The : after END should be present but it is still parsed if it is missing.

Properties

  • block-name
  • begin
  • end
  • hiddenp
  • contents-begin
  • contents-end
  • arguments
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Example block :affiliated-keywords:

Syntax

See blocks.

PARAMETERS can contain the following flags:

continued number-lines
+n AMOUNT
new number-lines
-n AMOUNT
preserve-indent
-i>
retain-labels
-r>
not use-labels
-k>
label-fmt
-l "FMT" where FMT is anything but " and newline.

Properties

  • begin
  • end
  • value
  • switches: the PARAMETERS string of the block
  • number-lines: tuple (kind, number) where kind is either new or continued
  • preserve-indent
  • retain-labels
  • use-labels: flag, if code-references should use labels or line-numbers
  • label-fmt
  • post-blank
  • post-affiliated
  • and any affiliated keywords

Export block :affiliated-keywords:

Syntax

See blocks.

Where the PARAMETERS string is the backend (case is ignored).

Properties

  • type: the PARAMETERS string of the block
  • begin
  • end
  • value
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Fixed width :affiliated-keywords:

Syntax

A line beginning with : followed by a whitespace or end of line. Consecutive fixed width lines are accumulated. The : can be preceded by optional whitespace.

Properties

  • begin
  • end
  • value
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Footnote definition :greater-element:affiliated-keywords:

Syntax

[LABEL] CONTENTS

LABEL is either a number or follows the pattern fn:WORD, where WORD can contain any word-constituent character, hyphens and underscore characters.

CONTENTS can contain any element except another footnote definition. It ends at the next footnote definition, headline, two consecutive empty lines or the end of buffer.

Properties

  • label
  • begin
  • end
  • contents-begin
  • contents-end
  • pre-blank: blank lines after [LABEL]
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Headline :greater-element:affiliated-keywords:

Can contain the standard set of objects without line breaks in its title.

Syntax

STARS KEYWORD PRIORITY TITLE TAGS

STARS is a string starting at column 0, containing at least one asterisk. This is used to define the level of the headline. This is the only required part of a headline. If other syntax follows there has to be a single space (or tab) after the stars.

KEYWORD is a todo keyword. Case is significant. If other syntax follows there has to be a single space (or tab) after keyword.

PRIORITY is a priority cookie of the form: [#A] where A can be any letter. Capital letters are recommended.

TITLE can be made of any character but a new line. If the first word in TITLE is COMMENT, the headline will be considered as commented. Case is significant. If TITLE is org-footnote-section, it will be considered as a footnote section. Case is significant.

TAGS is made of words containing any alpha-numeric character, underscore, at sign, hash sign or percent sign. Tags are separated and surrounded by :~s. If ~TAGS contains the ARCHIVE tag, it will be considered archived. Case is significant. There can be an arbitrary amount of whitespace (except newlines) between title and tags. But tags are usually right aligned at a specified column.

Properties

  • raw-value
  • title
  • alt-title
  • begin
  • end
  • pre-blank: blank lines before the content starts
  • post-blank
  • hiddenp
  • contents-begin
  • contents-end
  • level
  • priority
  • tags
  • todo-keyword
  • todo-type
  • scheduled
  • deadline
  • closed
  • quotedp
  • archivedp
  • commentedp
  • footnote-section-p
  • and all properties (names in upper case) of the property drawer
  • post-affiliated

Horizontal rule :affiliated-keywords:

Syntax

A line of at least 5 consecutive hyphens (-----). Can be indented.

Properties

  • begin
  • end
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Inlinetask :greater-element:

Can contain the standard set of objects without line breaks in its title.

Syntax

Same syntax as headline but starts with at least org-inlinetask-min-level asterisks.

Inline tasks can be ended with a line of org-inlinetask-min-levek asterisk characters (should be starting at column 0 but this is not strictly required), followed by a sapce and the END string.

Properties

  • raw-value
  • title
  • begin
  • end
  • pre-blank: blank lines before the content starts
  • post-blank
  • hiddenp
  • contents-begin
  • contents-end
  • level
  • priority
  • tags
  • todo-keyword
  • todo-type
  • scheduled
  • deadline
  • closed
  • post-blank
  • and all properties (names in upper case) of the property drawer
  • post-affiliated = begin

Item :greater-element:

Can contain the standard set of objects without line breaks in its tag.

Syntax

BULLET COUNTER-SET CHECKBOX TAG

Only BULLET is required. BULLET is either an asterisk, a hyphen, a plus sign (for unordered lists) or follows the pattern COUNTER. or COUNTER) (for ordered lists). BULLET is always followed by a whitespace character (or line ending).

COUNTER is a number or a single letter.

COUNTER-SET follows the pattern [@COUNTER].

CHECKBOX is either a single whitespace character, a X or a hyphen. It is enclosed in squeare brackets.

TAG follows the pattern TAG-TEXT :: where TAG-TEXT can contain any character except a new line.

An item ends before the next item, the first line that is less or equally indented than its starting line, or two consecutive empty lines. Indentation of lines within other greater elements including inlinetask boundaries are ignored.

A plain list is a set of consecutive items of the same indentation. It can only directly contain items.

If the first item in a plain list has a COUNTER in its BULLET the plain list will be an ordered plain list. If it contains a tag, it will be a descriptive list. Otherwise it will be an unordered list.

Properties

  • bullet
  • begin
  • end
  • contents-begin
  • contents-end
  • checkbox: either off (space), on (X) or trans (-)
  • counter
  • tag
  • structure
  • hiddenp
  • post-blank
  • post-affiliated = begin

Keyword :affiliated-keywords:

Can contain the standard set of objects in its value.

Syntax

Similar to affiliated keywords. Orphaned affiliated keywords are considered a regular keyword.

#+KEY: VALUE

KEY can contain any non-whitespace character. But it cannot be equal to CALL or any affilaited keyword.

VALUE can contain any character except a newline.

If KEY is a document property, VALUE can contain objects.

Properties

  • key
  • value
  • begin
  • end
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Latex environment :affiliated-keywords:

Syntax

\begin{ENVIRONMENT}
CONTENT
\end{ENVIRONMENT}

ENVIRONMENT is a string consisting of alpha-numeric and asterisk characters. Usually the asterisk is only at the end.

CONTENT can be anything except \end{ENVIRONMENT}.

Properties

  • begin
  • end
  • value: everything including the \begin and \end
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Node property

Syntax

Follows one of the following patterns:

:NAME: VALUE
:NAME+: VALUE
:NAME:
:NAME+:

NAME can contain any non-whitespace character but cannot end with a plus sign. It cannot be an empty string.

VALUE can contain anything but a newline character.

Properties

  • key
  • value
  • begin
  • end
  • post-blank = 0
  • post-affiliated = begin

Paragraph :affiliated-keywords:

Can contain the standard set of objects.

Syntax

Anything that is not another element is a paragraph. Paragraphs can contain all other elements and objects. Empty lines and other elements end paragraphs but all inner elements must be closed first.

Properties

  • begin
  • end
  • contents-begin
  • contents-end
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Plain list :greater-element:affiliated-keywords:

Syntax

See item.

Properties

  • type
  • begin
  • end
  • contents-begin
  • contents-end
  • structure
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Planning

Syntax

Planning can immediately follow a headline. No blank line is allowed.

KEYWORD: TIMESTAMP

KEYWORD is one of DEADLINE, SCHEDULED or CLOSED. Planning can be repeated but one keyword can only be used once.

TIMESTAMP is a timestamp.

Properties

  • closed
  • deadline
  • scheduled
  • begin
  • end
  • post-blank
  • post-affiliated = begin

Property drawer :greater-element:

Syntax

Property drawers can be directly below headlines (after planning if existent). Its syntax is similar to drawers.

:PROPERTIES:
CONTENTS
:END:

CONTENTS consists of zero or more node properties.

Properties

  • begin
  • end
  • hiddenp
  • contents-begin
  • contents-end
  • post-blank
  • post-affiliated = begin

Quote block :greater-element:affiliated-keywords:

Syntax

See blocks.

Properties

  • begin
  • end
  • hiddenp
  • contents-begin
  • contents-end
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Section :greater-element:

Syntax

A section contains directly any (greater) element. Only a headline can contain a section. Also text before the first headline in the document belongs to a section.

A section ends at the beginning of the next headline or the end of the file.

Properties

  • begin
  • end
  • contents-begin
  • contents-end
  • post-blank
  • post-affiliated = begin

Special block :greater-element:affiliated-keywords:

Syntax

See blocks.

Properties

  • type
  • begin
  • end
  • hiddenp
  • contents-begin
  • contents-end
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Src block :affiliated-keywords:

Syntax

See blocks.

PARAMETERS follow the following pattern: LANGUAGE SWITCHES ARGUMENTS.

LANGUAGE cannot contain any whitespace character.

SWITCHES can be the following:

continued number-lines
+n AMOUNT space is optional, AMOUNT is a number
new number-lines
-n AMOUNT
preserve-indent
-i>
retain-labels
-r>
not use-labels
-k>
label-fmt
-l "FMT" where FMT is anything but " and newline.

ARGUMENTS can contain any character but a newline.

Properties

  • language
  • switches
  • parameters
  • begin
  • end
  • number-lines
  • retain-labels
  • use-labels
  • label-fmt
  • preserve-indent
  • value
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Table :greater-element:affiliated-keywords:

Only org tables can only contain table rows. table.el tables don’t have vontent but use the value property to store raw table as a string.

Syntax

Tables start with a line starting with a vertical bar or the string +- followed by plus or minus signs only. Tables can be indented.

Org tables start with a line starting with | (vertical bar) and end at the first line not starting with a vertical bar.

Org tables can be immediately followed by #+TBLFM: FORMULAS lines, where FORMULAS can contain any character.

Example table:

| col1 | col2 | col3 |
|------+------+------|
|  200 |  300 |  500 |
#+TBLFM: $3=$1+$2

Table.el tables start with the string +- followed by plus or minus signs only and end at the first line not starting with either a vertical line or a plus sign.

Example table:

+------+------+------+
| col1 | col2 | col3 |
+------+------+------+
|  200 |  300 |  500 |
+------+------+------+

For more see: http://table.sourceforge.net/.

Properties

  • begin
  • end
  • tblfm
  • type
  • contents-begin
  • contents-end
  • value
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Table row

Can contain table cells.

Syntax

There are two types of table rows:

standard type
vertical bar and any number of table cells.
| cell1 | cell2 |
    
rule type
vertical bar followed by hyphens.
|---------------|
    

A table rule has no content (content-begin = content-end).

Properties

  • begin
  • end
  • contents-begin
  • contents-end
  • type: either rule or standard
  • post-blank = 0
  • post-affiliated = begin

Verse block :affiliated-keywords:

Can contain the standard set of objects.

Syntax

See blocks.

CONTENTS will be parsed as objects.

Properties

  • begin
  • end
  • contents-begin
  • contents-end
  • post-blank
  • post-affiliated
  • and all affiliated keywords

Greater elements

Elements containing other elements are called greater elements. These are:

  • Center block
  • Drawer
  • Dynamic block
  • Footnote definition
  • Headline
  • Inlinetask
  • Item
  • Plain list
  • Property drawer
  • Quote block
  • Section
  • Special block
  • Table

With the exception of headline and item greater elements can not contain greater elements of the same type.

Objects

Objects are related to the org file content. Objects belong to either an element or a secondary string.

Some objects can recursively contain other objects. For later reference the following standard set of objects is defined here:

  • Export snippet
  • Footnote reference
  • Inline babel call
  • Inline src block
  • Latex or entity
  • Line break
  • Link
  • Macro
  • Radio target
  • Statistics cookie
  • Sub/Superscript
  • Target
  • Text markup (bold, italic, underline, strike through, code, verbatim)
  • Timestamp

Entity

Syntax

\NAME POST

NAME has a valid association in either org-entities or org-entities-user. It has to conform to the following regular expression: (_ +)|(there4|frac[13][24]|[a-zA-Z]+)

POST is the end of line, the string {} or a non-alphabetical character. It isn’t separated from NAME by a whitespace.

There is a huge list of accepted entities. See https://orgmode.org/worg/org-symbols.org

There can also be user defined entities which are configured in emacs.

Properties

  • name
  • latex
  • latex-math-p
  • html
  • ascii
  • latin1
  • utf-8
  • begin
  • end
  • use-brackets-p: true if POST is {}
  • post-blank

latex, latex-math-p, html, ascii, latin1 and utf-8 is defined in org-entities or org-entities-user.

Export snippet

Syntax

@@BACKEND:VALUE@@

BACKEND can contain any alpha-numeric character and hyphens.

VALUE can contain anything but the @@ string.

Properties

  • backend
  • value
  • begin
  • end
  • post-blank

Footnote reference

Can contain the standard set in its inline definition.

Syntax

[fn:LABEL]
[fn:LABEL:DEFINITION]
[fn::DEFINITION]

LABEL can contain any word constituent character, hyphens and underscores.

DEFINITION can contain any character. Opening and closing square brackets must be balanced in it. It can contain the standard set of objects, even other footnote references.

If the reference follows the second pattern it is called an inline footnote. If it follows the third one (LABEL omitted) it is an anonymous footnote.

Properties

  • label
  • type: standard if it follows the first pattern, inline otherwise
  • begin
  • end
  • contents-begin
  • contents-end
  • post-blank

Inline babel call

Syntax

call_NAME(ARGUMENTS)
call_NAME[HEADER](ARGUMENTS)[HEADER]

NAME can contain any character besides (, [, whitespace and newline.

HEADER can contain any character besides ] and newline.

ARGUMENTS can contain any character besides ) and newline.

Both ~HEADER~s are optional.

Properties

  • call
  • inside-header
  • arguments
  • end-header
  • begin
  • end
  • value
  • post-blank

Inline src block

Syntax

src_LANG{BODY}
src_LANG[OPTIONS]{BODY}

LANG can contain any non-whitespace character.

OPTIONS and BODY can contain any character but a newline.

Properties

  • language
  • value
  • parameters
  • begin
  • end
  • post-blank

Latex fragment

Syntax

\NAME BRACKETS
\(CONTENTS\)
\[CONTENTS\]
$$CONTENTS$$
PRE$CHAR$POST
PRE$BORDER1 BODY BORDER2$POST

NAME contains alphabetical characters only (can end with an asterisk) and must not have an association in either org-entities or org-entities-user. Otherwise it will be parsed as an entity.

BRACKETS is optional and is not separated from NAME with white spaces. It may contain any number of the following patterns:

[CONTENTS1]
{CONTENTS2}

CONTENTS1 can contain any character except {, }, [, ] and newline.

CONTENTS2 can contain any character except {, } and newline.

CONTENTS can contain any character but cannot contain \) in the second template or \] in the third one.

PRE is either the beginning of line or a character different from $.

CHAR is a non-whitespace character different from ., ,, ?, ;, ' or ".

POST is any punctuation (including parantheses and quotes) or space character or the end of line.

BORDER1 is a non-whitespace character different from ., ,, ; and $.

BODY can contain any character except $ and may not span over more than 3 lines.

BORDER2 is a non-whitespace character idfferent from ., , and $.

Properties

  • value
  • begin
  • end
  • post-blank

Line break

Syntax

\\SPACE

SPACE is zero or more whitespace characters followed by the end of line.

Properties

  • begin
  • end
  • post-blank = 0

Link

Recursive, can contain: export snippet, inline babel call, inline src block, latex fragment, entity, macro, plain link, statistics cookie, sub/superscript, text markup

Syntax

radio link
PRE1 RADIO POST1
angle link
<PROTOCOL:PATH>
plain link
PRE2 PROTOCOL:PATH2 POST2
bracket link
[[PATH3]DESCRIPTION]

PRE1 and POST1 when they exist are non alphanumeric characters.

RADIO is a string matched by some radio target.

PROTOCOL is a string among org-link-types.

PATH can contain any character but ], <, > and newline.

PRE2 and POST2 when they exist are non word constituent characters.

PATH2 can contain any non-whitespace character except (, ), < and >. It must end with a word-constituent character or any non-whitespace non-punctuation character followed by /.

DESCRIPTION must be enclosed within suqare brachets. It can contain any character but square brackets. It can contain any object found in a paragraph except a footnote reference, a radio target and a line break. It cannot contain another link unless it is a plain or angle link.

DESCRIPTION is optional.

PATH3 is built according to the following patterns:

file type
FILENAME
protocol type
PROTOCOL:PATH4
protocol type
PROTOCOL://PATH4
id type
id:ID
custom-id type
#CUSTOM-ID
coderef type
(CODEREF)
fuzzy type
FUZZY

FILENAME is a file name (absolute or relative).

ID is constituted of hexadecimal numbers separated with hyphens.

PATH4, CUSTOM-ID, CODEREF and FUZZY can contain any character besides square brackets.

Spaces, tabs and newlines (also indentation) in the link are replace with a single space.

Properties

  • type: one of radio, file, coderef, custom-id, fuzzy
  • path
  • format: one of plain, bracket, angle, radio
  • raw-link
  • application
  • search-option
  • begin
  • end
  • contents-begin
  • contents-end
  • post-blank

Macro

Syntax

{{{NAME(ARGUMENTS)}}}

NAME must start with a letter and can be followed by any number of alpha-numeric characters, hyphens and underscores.

ARGUMENTS can contain anything but the string }}}. Values within ARGUMENTS are separated by commas. Non-separating commas have to be escaped with a backslash character.

Multiple whitespace and newline characters in ARGUMENTS are replaced by a single space.

Properties

  • key
  • value
  • args
  • begin
  • end
  • post-blank

Radio target

Recursive, can contain: latex fragment, entity, sub/superscript

Syntax

<TARGET>

TARGET follows the same syntax as a target but it can also contain objects.

Properties

  • begin
  • end
  • contents-begin
  • contents-end
  • post-blank
  • value

Statistics cookie

Syntax

[PERCENT%]
[NUM1/NUM2]

PERCENT, NUM1 and NUM2 are numbers or the empty string.

Properties

  • begin
  • end
  • value
  • post-blank

Sub/Superscript

Recursive, can contain the standard set.

Syntax

subscript
CHAR_SCRIPT
superscript
CHAR^SCRIPT

CHAR is any non-whitespace character.

SCRIPT can be * or any expression enclosed in parenthesis or curly brackets. It can contain balanced paranthesis and curly brackets.

SCRIPT can also follow the pattern:

SIGN CHARS FINAL

SIGN is either a plus sign, a minus sign or an empty string.

CHARS is any number of alpha-numeric characters, commas, backslashes and dots or an empty string.

FINAL is an alpha-numeric character.

There is no whitespace between SIGN, CHARS and FINAL.

Properties

  • begin
  • end
  • use-brackets-p
  • contents-begin
  • contents-end
  • post-blank

Table cell

Recursive, can contain: export snippet, footnote reference, latex fragment, entity, link, macro, radio target, sub/superscript, target, text markup, timestamp

Syntax

CONTENTS SPACES |

CONTENTS can contain any character except a vertical bar.

SPACES contains any number of space and tab characters (including zero). Usually used to align the table properly.

The final bar may be replaced with a newline character for the last cell in row (but doesn’t have to).

Properties

  • begin
  • end
  • contents-begin
  • contents-end
  • post-blank = 0

Target

Syntax

<<CONTENTS>>

CONTENTS can contain any character except <, > and newline. It cannot start or end with a whitespace character. It cannot contain any objects.

Properties

  • begin
  • end
  • value
  • post-blank

Text markup

Is one of bold, italic, underline, strike through, code or verbatim.

Recursive, can contain the standard set

Syntax

PRE MARKER BORDER BODY BORDER MARKER POST

Nothing is separated by whitespace.

PRE is one of -, whitespace, (, ', ", { and beginning of line.

BORDER is anything but whitespace, ,, ' and ".

MARKER is one of * (bold), = (verbatim), / (italic), + (strike through), _ (underline) and “~~~” (code).

BODY can contain any character but may not span over more than 3 lines.

POST is one of -, whitespace, ., ,, :, !, ?, ;, ', ", ), }, [ and end of line.

BORDER BODY BORDER can contain the standard set of objects when the markup is bold, italic, strike through or underline, only the content of verbatim and code is not parsed.

Properties

  • begin
  • end
  • contents-begin
  • contents-end
  • post-blank

Verbatim and code don’t have contents-begin and contents-end because they don’t contain parsed content.

Timestamp

Syntax

diary type
<%%(SEXP)>
active type
<DATE TIME REPEATER-OR-DELAY>
inactive type
[DATE TIME REPEATER-OR-DELAY]
active range type
<DATE TIME REPEATER-OR-DELAY>--<DATE TIME REPEATER-OR-DELAY>
active range type
<DATE TIME-TIME REPEATER-OR-DELAY>
inactive range type
[DATE TIME REPEATER-OR-DELAY]--[DATE TIME REPEATER-OR-DELAY]
inactive range type
[DATE TIME-TIME REPEATER-OR-DELAY]

SEXP can contain any character except > and newline.

DATE follows the pattern: YYYY-MM-DD DAYNAME. Y, M and D are digits. DAYNAME is optional and can contain any non whitespace character besides +, -, ], >, a digit and newline.

TIME follows the pattern H:MM. H can be one or two digit long and can start with 0.

REPEATER-OR-DELAY follows the pattern:

MARK VALUE UNIT

MARK is + (cumulate type), ++ (catch-up type) or .+ (restart type) for a repeater and - (all type) or -- (first type) for warning delays.

VALUE is a number.

UNIT is a character among h (hour), d (day), w (week), m (month) and y (year).

MARK, VALUE and UNIT are not separated by whitespace characters.

There can be two REPEATER-OR-DELAY in the timestamp. One as a repeater and one as a warning delay.

Properties

  • type: one of diary, active-range, active, inactive-range, inactive
  • raw-value
  • timestamp-start
    • year-start
    • month-start
    • day-start
    • hour-start
    • minute-start
  • timestamp-end
    • year-end
    • month-end
    • day-end
    • hour-end
    • minute-end
  • repeater
    • repeater-type: one of catch-up, restart, cumulate
    • repeater-value
    • repeater-unit
  • warning
    • warning-type: one of first, all
    • warning-value
    • warning-unit
  • begin
  • end
  • post-blank

repeater-unit and warning-unit are one of the following: hour, day, week, month, year.

Affiliated keywords

Affiliated keywords (not to be confused with actual keywords) are no actual elements or objects. But they are attributes of the element or object they precede.

They follow the following patterns:

  • #+KEY: VALUE
  • #+KEY[OPTIONAL]: VALUE
  • #+ATTR_BACKEND: VALUE

The following affiliated keywords are recognized:

  • CAPTION
  • HEADER
  • NAME
  • PLOT
  • RESULTS
  • and ATTR_ followed by any string consisting of alpha-numeric characters, hyphens and underscores

Some keywords have been deprecated. They will be recognized but they will be renamed as follows:

  • HEADERS = HEADER
  • LABEL = NAME
  • SRCNAME = NAME
  • TBLNAME = NAME
  • DATA = NAME
  • RESNAME = NAME
  • SOURCE = NAME
  • RESULT = RESULTS

Only CAPTION and RESULTS can have a secondary value.

Only CAPTION, HEADER and ATTR_something keywords can occur more than once in an element. Their value will then be a list of strings.

Only CAPTION~s (secondary) value can have objects in it. The value of ~CAPTION will be stored in a secondary string.

Document properties

The syntax is the same as affiliated keywords but they apply to the whole document. Their values can contain objects and are stored as secondary strings.

Document properties are:

  • AUTHOR
  • DATE
  • TITLE

Secondary string

This is simply a list of strings and objects. It is used where properties or attributes can contain actual objects instead of just text.

Parsing

Parsing complete files or smaller chunks can be done with different granularities:

headline
only parse headlines
greater-element
no recursion into greater elements except headlines and section
element
parse everything except objects and plain text
objects (default)
parse everything

When parsing smaller chunks (secondary strings) restrictions can be used to only parse elements of a specific type.

When parsing there are different modes:

first-section
the beginning of a document
section
a section
planning
planning
item
item (with a structure)
node-property
node property
table-row
table row

How parsing is done:

  1. Find current elements type and parse it
  2. Parse elements content (if applicable)
    • When no content don’t do anything
    • For greater elements: parse recursively between content-begin and content-end (Jump to 1. with next mode, current structure and granularity). Also make sure that granularity allows recursion (or the element is a headline).
    • For elements: parse objects inside (if granularity allows it).
  3. Insert the content into the parent element
  4. Update the mode
  5. Return result