dati

dati [OPTIONS]

A tool for parsing data files, template files and executing them against eachother.

DATA

Data is a file written in any data language (e.g. JSON or YAML), a list of supported languages can be seen in the README for the dati library. These files provide key=value data.

dati generates a single data structure of all data contained within parsed data files. This super-structure is passed to each "root" template, where value data is accessed using the key strings.

The data structure generated by dati will only have 1 absolute key: "data" (can be renamed using the -dk/-data-key option). This key will overwrite any other root key of the same name. Its value will be an array, where each element is the key=value data parsed one of the "data" files.

Parsed "global data" will be written to the root of the data structure and into the root for each element of the "data" array. If a key within one of these objects conflicts with one of the keys in the "global data", then the "global data" key is ignored.

TEMPLATES

All "root" template files passed to dati that have a file extension matching one of the supported templating languages will be parsed and executed against the generated data structure.

All "parital" templates will be parsed into any "root" templates that have a file extension that match the same templating language.

OPTIONS

CONFIG

You might want to use the same options if you run dati multiple times for the same project. This can be done by creating a data file and passing the filepath to the -cfg argument.

The key names for the options set in the config file must match the name of the argument option to set (long or short). For example (a config file in toml):

root="~/templates/blog.mst"
partial="~/templates/blog/"
gd="/softwares/libdati/dati/blog.json"
data="./posts/"
dk="posts"

EXAMPLES

dati -cfg /softwares/libdati/dati/dati.cfg -r templates/textfile.mst

dati -r homepage.hmpl -p head.hmpl -p body.hmpl -gd meta.json -d posts/*

see the examples/ directory in the dati repository for a cool example.

External Links