Literate YAML with mustaches
- write YAML...
- or Markdown
- or JSON
- add mustache-style template tags...
- load multiple files as data sources...
- ...of many types...
- .json
- .jsonld
- .ipynb
- .ini/.cfg
- .yml
- .csv
- .json
- ...into optional aliases
- ...from a path in the files
- ...of many types...
- ...get out JSON
- ...or YAML
- ...or Markdown
- ...or HTML
- ...or a JS app
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.
- multiple input files...
- join?
- merge?
- split?
- stream?
- multiple output files...
- split into documents on YAML document streams?
- meta LMY
- .lmy.lmy?
- document vs data expansion?
- How to escape without being awful?
- .lmy.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
- different table representations
Some LMY can make a standalone JavaScript application
- salt uses Jinja and YAML to define states
- metadown uses Markdown and YAML to author CoffeeScript
- literate CoffeeScript
- JavaScript
- js-lmy: a LMY processor for node and the browser
- codemirror-lmy: a CodeMirror mode
- prosemiror-lmy: a ProseMirror mode
- ace-lmy: an Ace mode
- Python
- py-lmy: a LMY processor for python
- a pygments mode
- Editors
- atom-lmy: LMY syntax highlighting for atom
- atom-linter-lmy: LMY