Commit 594b4147 authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers 🍪

very basic documentation

parent 0d6f6fdf
Pipeline #1288 failed with stages
in 46 seconds
j2static is a static site generator based around jinja2.
Using the tool
j2static assumes that you have jinja templates stored in _template/ which should
be coverted into html documents. You can generate html documents by executing
$ j2static generate
Webserver Mode
j2static can also provide a (very basic) webserver operating on localhost, you
can use this to develop your templates. To activate webserver mode, use the
serve command::
$ j2static serve
When in webserver mode, files are not generated. Instead, the server rebuilds
the template on every request. This is slower than fetching the files from disk
but should mean it always reflects your changes.
j2merge is a command line utilty that ships with j2static. It is a system for
generating a set of documents from a template and a set of source data ('mail
Using the tool
j2merge needs to know two things in order to generate outputs, the source data
(in csv format) and the template (jinja2 template). The template name defaults
to `base.html` so you can omit it if you do this::
$ j2merge data.csv
j2merge assumes the csv file contains headers, which will be used as the
variable names in the template. j2merge also assumes that there is a column
named id, which will be used to generate the resulting filename.
Contextual data
Sometimes it is useful to be able to pass additional data into the template
system from another source. Presently, the only supported sources are json
To use this functionality, pass the name of the json file is as a parameter::
$ j2merge data.csv --context=extra.json
The data stored in the json file will be loaded into the template.
PDF mode
j2merge can generate PDFs using its LaTeX support, to do so you must tell it
that you want to generate pdfs as your artifacts::
$ j2merge data.csv --builder=pdf
in this mode, j2merge will assume that your template is named `base.tex`. You
will need a LaTeX distribution and latemk installed in order to use this
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment