block by bollwyvl 7c1501003b1080aa6a14

LMY: is Metä(l) YAML :-{}

LMY: is Metä(l) YAML :-{}

Literate YAML with mustaches

RIP 2015

Goals

Show me the LMY: Command Line

Any valid YML (and by extension JSON) is valid LMY:

# data.lmy
{% for lang in ["py", "js"]%}
{{ lang }}:
  name: {{ data[lang].name }}
  version: {{ data[lang].version }}
{% endfor %}

…and any number of data files can be loaded into the available data context.

lmy data.lmy py:setup.cfg#/metadata js:package.json

By default, lmy will make JSON…

{"py": {"name": "py-lmy", "version": "0.1.0"}, "js": {"name": "js-lmy", "version": "0.1.0"}}

Make it pretty:

lmy data.lmy --pretty py:setup.cfg#/metadata js:package.json
{
  "py": {
    "name": "py-lmy",
    "version": "0.1.0"
  },
  "js": {
    "name": "js-lmy",
    "version": "0.1.0"
  }
}

…or, get the intermediate YAML, which is already pretty…

lmy data.lmy --yaml py:setup.cfg#/metadata js:package.json
py:
  name: py-lmy
  version: 0.1.0
js:
  name: js-lmy
  version: 0.1.0

Add -o or --output to any of the above to write files.

Think More About CLI

Literate LMY

If the intent of a document is more important than the data, # comments are unnecessarily verbose. In the style of literate CoffeeScript, an .lmy.md file will be processed as a templated markdown file, and

# The LMYsphere

    {% for lang in ["py", "js"]%}
    {{ lang }}:
      name: {{ get[lang].name }}
      version: {{ data[lang].version }}
    {% endfor %}

LMY is about data, so the default will generate JSON…

lmy README.lmy.md py:setup.cfg#/metadata js:package.json

same as above :{)

…or can be expanded to template-free Markdown with embedded YAML…

lmy README.lmy.md --markdown py:setup.cfg#/metadata js:package.json
# The LMYsphere

    py:
      name: py-lmy
      version: 0.1.0
    js:
      name: js-lmy
      version: 0.1.0

…or go all the way to HTML, leaving the data as expanded, indented YAML…

lmy README.lmy.md --html py:setup.cfg#/metadata js:package.json

too long

…with the added option of generating nested tables, a la console.table

lmy README.lmy.md --html --pretty=tables py:setup.cfg#/metadata js:package.json

too long to show

Think more about HTML

LMY apps

Some LMY can make a standalone JavaScript application

Prior Art

The LMYsphere