Skip to main content

J2static

About this project

This project aims to unify a set of internally produced scripts for generating static content, choosing to standardise on the jinja2 templating engine.

Simply put, this project aims to provide utilities to do the following:

  • Static site generation (for gitlab)

  • Generate customised summary documents based on submissions

  • Generate PDFs from CSV files and templates (mail merges)

Development

The recommended way to develop the tools in the package is to use development mode of setup.py, this will create executables in your path which can be used to test changes.

./setup.py develop --user

We’re open to pull requests and feature requests, this should be done via our gitlab server.

Usage

The project consits of two executables, j2static, the static site generator and j2merge, the mail merge tool.

j2static executable

j2static builds files stored in a directory named _templates/ using jinja2, generating output documents in site/. The tool will ignore any file that starts with an underscore, allowing for the creation of templates.

j2static can also act as a webserver for local testing. In this mode the server will not generate output documents on disk, but will instead generate and send them to the browser ‘on the fly’. This is useful if you have javascript on your site and don’t want to fall foul of the browser’s security settings when testing with local files.

j2static build # use templates in the _templates/ directory to build the site
j2static serve # start a webserver on localhost (for development)

j2merge executable

j2merge is a ‘mail merge’ tool for combining csv files with a template document this is useful for producing reports or personalised documents. This can be optionally combined with a LaTeX distrubtion to generate PDFs.

j2merge assumes that the csv file provided has headers and contains a row named id which will be used for the resulting filenames. The data for each row will be available in the template as the variable row.

j2merge data.csv # combine data.csv and base.html to generate documents
j2merge data.csv -out pdf # combine data.csv and base.tex to generate pdfs

Release files for j2static 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for j2static 0.2.3
File Size Uploaded
j2static-0.2.3.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for j2static 0.2.3
File Interpreter ABI Platform
j2static-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 15.9 kB

Release files / j2static-0.2.3.tar.gz

Download URL j2static-0.2.3.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f306566adb17d24d5835644ecc8a15df48eef8dda794ccca18d159a5dfec685f
BLAKE2b-256 checksum
How to use checksums
d06337f1fda44550c0c5a5f64c0e770d47f9d6de1da29a2daf6443a112c1299a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.2 pkginfo/1.4.2 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

Release files / j2static-0.2.3-py3-none-any.whl

Download URL j2static-0.2.3-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e844cc19db7ac8ae94540e290dc01ae700e18d2812ae7f0e75537ea7e21f1af3
BLAKE2b-256 checksum
How to use checksums
7f42ca0cc8c36a4cecea67a63ead280315df5c17773bbac80e402568b1069c18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.2 pkginfo/1.4.2 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page