Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danielrolls/specup
Generate markup from yaml from a simple comand line tool
https://github.com/danielrolls/specup
markup mustache templating yaml
Last synced: about 1 month ago
JSON representation
Generate markup from yaml from a simple comand line tool
- Host: GitHub
- URL: https://github.com/danielrolls/specup
- Owner: danielrolls
- License: gpl-2.0
- Created: 2024-01-20T14:38:41.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-10-26T18:39:23.000Z (2 months ago)
- Last Synced: 2024-10-26T20:39:45.447Z (2 months ago)
- Topics: markup, mustache, templating, yaml
- Language: Haskell
- Homepage:
- Size: 26.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.adoc
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
:source-highlighter: highlight.js
= SpecUpThis tool can be used to generate a markup file from your own arbitrary yaml file. Just provide the yaml and a template (in mustache format) and the tool outputs the result of applying the template to yaml. This can be quicker and easier than starting a project in your favourite language and easier to maintain.
Expect the interface to move around a bit.
To try the tool out, install https://nixos.org/download[Nix] and run
```
nix run nixpkgs#specup -- --help
```== An example
Imagine you need to publish a list of animals. Rather than pick a format and muck about reformatting just put them into yaml and then write a template. For example, put this into `animal.yaml`:
[,yaml]
----
- animal: Dog
class: mammal
- animal: Crocodile
class: reptile
----and this into `template.m` to list them in, say, markdown:
```
{{# . }}
# {{{ animal }}}Animal class: {{{ class }}}
{{/ . }}
```To apply the template to the yaml file run
```
specup -s animal.yaml -t template.m
```Now you can add to the yaml and modify or add templates independently. If you want to modify the yaml just use https://github.com/mikefarah/yq[yq].
As said above, you can do the same by writing all this in code but usually we don't because it's not worth the time to set up. Also, for small projects it's better not to have to maintain a codebase with library dependencies.