Literal Blocks

# Multiple-line strings can be written either as a 'literal block' (using |),
literal_block: |
'This entire block of text will be the value of the 'literal_block' key,
with line breaks being preserved.
The literal continues until de-dented, and the leading indentation is
stripped.
Any lines that are 'more-indented' keep the rest of their indentation -
these lines will be indented by 4 spaces.'

LRM parsing for Literal Block

The key/value pairs created by LRM are:

Key

Value

literal_block

'This entire block of text will be the value of the 'literal_block' key,with line breaks being preserved.

The literal continues until de-dented, and the leading indentation isstripped.

Any lines that are 'more-indented' keep the rest of their indentation -

Nested keys have a separator of _^o^_. Sequences have a separator of _^a^_

The key/value pairs created by LRM are:

Key

Value

json_map_^o^_key

"value"

json_seq_^a1^_

3

json_seq_^a2^_

2

json_seq_^a3^_

1

json_seq_^a4^_

'takeoff'

and quotes are optional_^o^_key_^a1^_

3

and quotes are optional_^o^_key_^a2^_

2

and quotes are optional_^o^_key_^a3^_

1

and quotes are optional_^o^_key_^a4^_

takeoff

Topmost List

A topmost list is a list that does not have a parent key. If a file contains a topmost list, then no other syntax type can be included.

- key: login
msg: "Log In"
- key: logout
msg: 'Log Out'

LRM parsing for Topmost list

Nested keys have a separator of _^o^_. Sequences have a separator of _^a^_

The key/value pairs created by LRM are:

Key

Value

_^a1^__^o^_key

login

_^a1^__^o^_msg

"Log In"

_^a2^__^o^_key

logout

_^a2^__^o^_msg

'Log Out'

Anchors

# YAML also has a handy feature called 'anchors', which let you easily duplicate
# content across your document. Both of these keys will have the same value:
anchored_content: &anchor_name This string will appear as the value of two keys.
other_anchor: *anchor_name
# Anchors can be used to duplicate/inherit properties
base: &base
name: Everyone has same name
foo: &foo
<<: *base
age: foo age
bar: &bar
<<: *base
age: bar age
# foo and bar would also have name: Everyone has same name

LRM parsing for Anchors

Nested keys have a separator of _^o^_.

The key/value pairs created by LRM are:

Key

Value

anchored_content

This string will appear as the value of two keys.

base_^o^_name

Everyone has same name

foo_^o^_age

foo age

bar_^o^_age

bar age

Language Tags

A language tag is the language only tag that is at the top of the file.

If a YAML file contains nested keys or arrays, then LRM flattens out the structure so that a unique key can be created. For example, each field name within a nested object has a separator of _^o^_. The language tag is not included in the creation of the unique key. The following is an example of the unique LRM resource keys created from the above YAML file.

The key/value pairs created by LRM are:

Key

Value

Block style_^o^_login

Log In

Block style_^o^_logout

"Log Out"

Block style_^o^_name

'Name'

Flow style_^o^_login

'Log In'

Flow style_^o^_logout

Log Out

Flow style_^o^_name

"Name"

Unsupported YAML syntax

The following syntax is not supported by LRM. If a file contains unsupported syntax then an error will occur when reading the file.

Set format

A set is an unordered collection of nodes such that no two nodes are equal.

Sequence format

Multiple Documents

A file that contains multiple documents, indicated by '---' and '...' is not supported.

---
doc1: value1
...
---
doc2: value2
...

Blank Values

An empty string, such as is allowed but a blank value is not.

this_is_valid: ""
this_is_invalid:
this_is_valid2:

Multi-lines that are not literal strings

key1: 'this\n'
is \n
a test'

Folded Style (>)

folded_style: >
This entire block of text will be the value of 'folded_style', but this
time, all newlines will be replaced with a single space.
Blank lines, like above, are converted to a newline character.
'More-indented' lines keep their newlines, too -
this text will appear over two lines.