Advanced Features

Complementary to the introduction, this page describes the remaining, more advanced features of eno. You should get to know them if you ...

Copying (<)

eno works very well for authoring content in multiple languages, imagine the following document layout for a blog post:

# English

title: FAQ
permalink: faq

-- text
Here you find answers to frequently asked questions:
-- text

If we just wanted to duplicate that page for another language, we can write the following line to do just that:

# German < English

This creates a section with the name "German" and copies everything that exists in the section "English" over to that new section.

As in this case "FAQ" is the same in german and english we only would need to replace the text, which we can do like this:

# German < English

-- text
Hier findest du Antworten auf oft gestellte Fragen:
-- text

By copying we get all fields from the english section, and by specifying a new text we are overwriting only that specific element, leaving the copied title and permalink intact.

Fieldsets (=)

color ratings:
green = 3
red = 4
blue = 1

Fieldsets allow us to group fields without the need to specify an entire section. They start like a field or list (with a name and a colon), and go on as long as fieldset entries follow, which are differentiated from regular fields by their operator, an equals sign (=). Note that unlike in sections, no name can appear twice in a fieldset, every one of them needs to be unique.

Fieldsets can be copied (like everything else in eno), in which case you can actually redeclare an existing fieldset entry name, which allows you to override its value in the copied fieldset:

src = glass.jpg
title = A glass, half full.

image_2 < image
title = A glass, half empty.

Line Continuations (\) and Newline Continuations (|)

When a value gets overly long, or you would like to supply multiple lines for a field (without using a block) you can use line continuations:

A long sentence: I was riding my bike out in the woods, then a girl with a red cape came along and
\                asked me what my destination was, and I honestly couldn't remember at that point.

With a backslash (\) you declare a line continuation, whatever you write on that line is appended to the end of the field before it (separated by a single space). Note that like everywhere else in eno, whitespace plays no role, so this is equivalent of the above example:

A long sentence: I was riding my bike out in the woods, then a girl with a red cape came along and

    \ asked me what my destination was, and I honestly couldn't remember at that point.

With a vertical slash/pipe character (|) you declare a newline continuation, whatever you write on that line is also appened to the previous field, but on a new line:

A poem: Roses are red.
|       Violets are blue.

            | Whitespace does not matter. ;)

Final remark: Line continuations and newline continuations can be mixed in any fashion, as for instance here in this classical programmer use case for line continuations:

| ffmpeg -i
\        -vf deinterlace
\        output.mp4
| cp output.mp4 /external/deployed.mp4
| rm output.mp4

Documentation coming up in the next days!

Deep copying (<<)

Deep copying works like copying, except you use two angle brackets (<<) instead of one, which in turn allows you to overwrite and/or add fields inside deeply nested section hierarchies.

# default
## settings
hyperservice: disabled

# production << default
id: prod
## settings
ultraservice: enabled

In this example the resulting # production section will contain both hyperservice and ultraservice inside its ## settings subsection, whereas if you used only a regular copy operation (single <), the ## settings from # default would have been completely overwritten, deleting hyperservice and leaving only ultraservice. A classical usecase for this feature are complex server configurations.

Escaping (``)

Let's assume someone wrote an eno document describing which clothing to wear at different temperatures:

30 degrees celsius: Swimming trunks
10 degrees celsius: Warm pullover and windjacket
`-10 degrees celsius`: A very warm coat

You'll notice that something is different in the third line: The -10 degrees celsius has been put between two backticks ( ` ).

Here's why:
-10 degrees celsius starts with a -, and in eno every line starting with a - is interpreted as a list item as we learned before, therefore we need some way to say that we really mean "minus 10 degrees celsius" and not "10 degrees celsius" as an item in a list.

This is a universal concept in computing called "escaping", and lets us write down things that would otherwise be interpreted differently, a bit like telling a friend you're not being ironic when you just said something that sounded awfully ironic.

Here are some more examples of escaping in eno:

``: The eno website

Every field in eno follows the pattern name: value, but in this case our name contains a : already, therefore we need to escape it.

`` `hypothetical` ``: The word "hypothetical" inside backticks

You might have wondered how an escape can be escaped, this is achieved by using two backticks around the name that is itself wrapped in (single) backticks, and leaving spaces so it does not look like three backticks. (these spaces on the outside are not included in the name though)