Skip to main content

static templating engine

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

j2static-0.2.3.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

j2static-0.2.3-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file j2static-0.2.3.tar.gz.

File metadata

  • Download URL: j2static-0.2.3.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for j2static-0.2.3.tar.gz
Algorithm Hash digest
SHA256 f306566adb17d24d5835644ecc8a15df48eef8dda794ccca18d159a5dfec685f
MD5 e116c084c5e2b0a5c6f8297b8768d186
BLAKE2b-256 d06337f1fda44550c0c5a5f64c0e770d47f9d6de1da29a2daf6443a112c1299a

See more details on using hashes here.

File details

Details for the file j2static-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: j2static-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for j2static-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e844cc19db7ac8ae94540e290dc01ae700e18d2812ae7f0e75537ea7e21f1af3
MD5 470f2ce88cc4a64cb9f3a443041a4439
BLAKE2b-256 7f42ca0cc8c36a4cecea67a63ead280315df5c17773bbac80e402568b1069c18

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page