Omnist logo Omnist Tutorial Step 4 of 15

OML — the native format

Omnist's own text syntax for the Document model.

OML (Omnist Markup Language) is the native, human-readable syntax for a Document — the same tree every other format reads into, written in Omnist's own grammar instead of borrowing JSON's, YAML's, or XML's.

from omnist import write_oml

node = [("name", "Ada"), ("tags", [("tag", "x"), ("tag", "y")])]
write_oml(node, indent=None)   # compact, single-line layout
write_oml(node)                # indented, multi-line layout (the default)
Output
compact:   name: "Ada"; tags: { tag: "x"; tag: "y" }
indented:
name: "Ada"
tags: {
  tag: "x"
  tag: "y"
}

Both layouts round-trip through the reader to the identical Document — indent only changes formatting, never meaning. The compact form is handy for log lines or diffless storage; the indented form is what you'd hand-author.

Learn more