-
-
Notifications
You must be signed in to change notification settings - Fork 213
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: value3Since 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: PastaTrailing colons that precede nested dictionaries are not mandatory and can be omitted:
- English
- greeting: Hello
- food: Fish and chips
- Italian
- greeting: Ciao
- food: PastaA 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 formulae
- Table caption
- Code caption
- Decorative headings
- Alerts (quote types)
- Quotation source
- Cross-references
- Page breaks
- Text symbols (text replacement)
- Emojis
- Document metadata
- Theme
- CSS
- Fonts
- Page format
- Page margin content
- Page counter
- Persistent headings
- Automatic page break
- Numbering
- Paragraph style
- Caption position
- Table of contents
- Bibliography
- Footnotes
- Stacks (row, column, grid)
- Container
- Align
- Float
- Figure
- Clip
- Box
- Collapsible
- Landscape
- Whitespace
- Variables
- Optionality
- Math
- Conditional statements
- Loops
- Let
- Destructuring
- String manipulation
- Table manipulation: sorting, computing, and more
- Table generation
- String
- Number
- Markdown content
- Boolean
- None
- Enumeration entry
- Iterable
- Dictionary
- Range
- Lambda
- Size(s)
- Color
- Dynamic
- Paper: abstract, definitions, theorems, and more