Overview
Commands that read lists and tables written as Markdown and Org write them.
@read-list{
- this parses things
- a list with nested lists
- this is another post
and this continues the list item above.
}
@read-table{
#+CAPTION: What they drink
| Name | Cups | Of |
|-------+------+----------|
| Alice | 3 | @em{tea} |
| Bob | 12 | coffee |
}
The body is still samizdat: a command in it works as in any other body.
Both commands are in standard-commands of
(samizdat commands).
See also: read-list, read-table
Reference
Functions
read-list
function ↑ Functions
(: read-list (-> Ctx Call (Vec Piece)))
(read-list cx c)
A command that reads a list written as Markdown and Org write one.
cx- The state of the document.
c- The call.
- returns
- An
ItemListblock, or nothing when the body is blank.
@read-list{
1. First
2. Second, with a list in it:
- a
- b
}
The rules are the rules of Markdown, with fewer cases:
- An item starts with
-,+or*, or with a number and.or), and then a space. - The marker of the first item sets whether the list is numbered. Numbering always starts at 1.
- An item that is indented more than the marker of the item before it is in a list inside that item.
- A line of text continues the item above it, at any indentation.
- After a blank line, text that is indented more than the marker of an item is a new paragraph of that item.
These are rejected with refuse: arguments, a call with no body, a
body whose first line is not an item, and a line after a blank line
that is in no item.
See also: read-table
read-table
function ↑ Functions
(: read-table (-> Ctx Call (Vec Piece)))
(read-table cx c)
A command that reads a table written as Org or Markdown write one.
cx- The state of the document.
c- The call.
- returns
- A
TableBlock, or nothing when the body has no rows.
@read-table[#:caption "Prices"]{
| Item | Price |
|:-------|------:|
| Tea | 2.50 |
| Coffee | 3.00 |
}
- A row is a line that starts with
|. The|characters divide its cells.\|is a|in a cell. A command in a cell stays whole. - A line of
-,+and|is a rule. The rows above the first rule are the head. More rules divide the other rows into groups. A rule before the first row or after the last row has no effect. - A delimiter row of Markdown,
|:---|:---:|---:|, is a rule. Its colons set the alignment of the columns. - A row of Org cookies,
| <l> | <c> | <r10> |, sets the alignment of the columns. It is not a row of the table. Widths are ignored. - A column with no alignment whose body cells are mostly numbers is aligned to the right.
#+CAPTION:gives the caption.#:caption "..."gives the caption too, and replaces it. Other lines that start with#+are ignored.- The table has as many columns as its longest row. A shorter row gets empty cells.
These are rejected with refuse: positional arguments, a keyword
other than #:caption, a call with no body, and a line that is not
a row, a rule or a #+ line.
See also: read-list