ahdinosaur / rimu

Template language for structured data: functional YAML 🌱
https://rimu.dev
Apache License 2.0
37 stars 0 forks source link

Multi-line values and strings #23

Open ahdinosaur opened 1 year ago

ahdinosaur commented 1 year ago

Describe the solution you'd like

A design similar to:

(Draft documentation)

Rimu supports multi-line values with > and >"

>

A multi-line expression.

Identation is removed, newlines are removed.

story: >
  """Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
  tempor incididunt ut labore et dolore magna aliqua. Eleifend donec pretium
  vulputate sapien nec sagittis aliquam malesuada."""

""" is the multi-line string character.

>"

A multi-line string.

Identation is removed. Newlines are preserved.

story: >"
  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
  tempor incididunt ut labore et dolore magna aliqua. Eleifend donec pretium
  vulputate sapien nec sagittis aliquam malesuada.

Describe alternatives you've considered or related projects

Additional context

ahdinosaur commented 1 year ago

NestedText has a different approach

key 4:
    key 4a: value 4a
    key 4b: value 4b
key 5:
    > first line of value 5
    > second line of value 5

->

{
    "key 4": {
        "key 4a": "value 4a",
        "key 4b": "value 4b"
    },
    "key 5": "first line of value 5\nsecond line of value 5"
}
ahdinosaur commented 1 year ago

my main consideration is i want the structure parser to be separate from the expression parser. so i don't want multi-line structure to be dependent on whether the expression is "done".