#template #mustache #publisher #command-line-utilities #cli #data-file

app pbl

A simple command line application for rendering templates from structured data and a template

5 releases

0.2.1 Jan 17, 2022
0.1.3 Mar 13, 2021
0.1.2 Mar 13, 2021
0.1.1 Mar 13, 2021
0.1.0 Mar 13, 2021

#114 in Rendering

Custom license

7KB

Publisher (pbl)

Publisher is a simple command line application for rendering templates from structured data and a template.

Usage

A simple command line application for rendering templates from structured data and a template.

USAGE:
    pbl --data <DATA> --template <TEMPLATE>

OPTIONS:
    -d, --data <DATA>            Path to the data file
    -h, --help                   Print help information
    -t, --template <TEMPLATE>    Path to the template file
    -V, --version                Print version information

Examples

Given a data file, data.json:

{
  "title": "My Blog",
  "body": "blah"
}

and a template, template.mustache:

<html lang="en">
  <head>
    <title>{{title}}</title>
  </head>
  <body>
    {{body}}
  </body>
</html>

the following command will render the template:

pbl render --data data.json --template template.mustache

By default, the result is written to stdout and will look like:

<html lang="en">
<head>
  <title>My Blog</title>
</head>
<body>
blah
</body>
</html>

Why was pbl created?

The first use case for pbl was to create a templated CONTRIBUTING.md document for a project given a data file describing the project.

Roadmap

  • Add support for transformations.
  • Add support for json-e.
  • Ability to specify output path(s).
  • Add support for multiple template engines.
  • Add support for multiple data formats.
  • Given a template, parse the data it requires and return an empty serialized data file or prompt for values.

Dependencies

~2.3–3.5MB
~62K SLoC