-
-
Notifications
You must be signed in to change notification settings - Fork 22
Dictionary
In Quarkdown, a dictionary is a collection of key-value pairs, without duplicate keys. A key is always a string value, while a value can be of any type.
The syntax for dictionaries recalls the YAML one, as it uses Markdown lists:
- key1: value1
- key2: value2
- key3: value3
Since its syntax clashes with Iterable's, wrapping the dictionary declaration in a .dictionary
function ensures no ambiguity is present, in cases where both dictionaries and iterables are accepted.
In the following example, .foreach
is suitable for both, so we enforce to run it on a dictionary to iterate over key-value pairs:
.var {mydictionary}
.dictionary
- key1: value1
- key2: value2
- key3: value3
.foreach {.mydictionary}
...
Dictionaries can be nested if accepted by the called function (.localization
for instance).
- English:
- greeting: Hello
- food: Fish and chips
- Italian:
- greeting: Ciao
- food: Pasta
Trailing colons that precede nested dictionaries are not mandatory and can be omitted:
- English
- greeting: Hello
- food: Fish and chips
- Italian
- greeting: Ciao
- food: Pasta
A dictionary can be passed to any function that accepts an iterable (it is treated as an iterable of pairs).
For a complete list of dictionary operations, please refer to the stdlib's Dictionary
documentation.
- Figures
- Image size
- TeX formulas
- Table caption
- Decorative headings
- Alerts (quote types)
- Quotation source
- Page breaks
- Text symbols (text replacement)
- Syntax of a function call
- Declaring functions
- Dynamic typing
- Including other Quarkdown files
- Importing external libraries
- Localization
- Document metadata
- Theme
- Page format
- Page margin content
- Page counter
- Automatic page break
- Numbering
- Caption position
- Table of contents
- Stacks (row, column, grid)
- Container
- Align
- Float
- Figure
- Clip
- Box
- Collapsible
- Whitespace
- Variables
- Optionality
- Math
- Conditional statements
- Loops
- Let
- Destructuring
- String manipulation
- Table manipulation: sorting, computing, and more
- Generators
- String
- Number
- Markdown content
- Boolean
- None
- Enumeration entry
- Iterable
- Dictionary
- Range
- Lambda
- Size(s)
- Color
- Dynamic
- Paper: abstract, definitions, theorems, and more