Skip to main content

A LaTeX bootstrapper

Project description

labo - LaTeX Bootstrapper

labo is a CLI-utility for bootstrapping LaTeX-projects based on templates. It uses Jinja2 for the templating.

Configuration

By default labo looks for the configuration file in $HOME/.config/labo/labo.toml and $HOME/.labo.toml, in that order. Currently the only configuration option is the location of the templates. This is specified by the template_dir key:

template_dir = /home/user/.labo

Templates

A template for a LaTeX project for labo is specified by a config.toml file in a folder in the template directory. See example_template/ for a simple example. The name of the template is determined by the name of this folder. In the config file the template files can be specified using the instantiate key. For the time being it supports rendering LaTeX and Makefile templates using Jinja2. Files that need to be copied or need to be linked to the new project can also be specified using the copy and link keys, respectively. Below is an example of these keys

instantiate = ["main.tex", "Makefile"]
copy = ["document.tex"]
link = ["myclass.cls", "mypackage.sty"]

Variables

The templates can contain variables. These variables can either be defined using hooks or by specifying them in the config.toml under the [variables] section. labo prompts automatically for the variables during the bootstrapping of the project. A variable can be defined as followed:

[variables]
var.prompt = "Foo"
var.default = 1

The prompt key defines the text used for prompting for the variable and is mandatory. The default key is used to infer the type of the variable and is mandatory.

The variable can be used in a LaTeX-template by \VAR{var} and in a Makefile template by {{var}}.

Hooks

Before the templates are rendered a pre_template_hook is ran. This hook can be defined in a hooks.py file in the template folder. This hook is passed four arguments: The current working directory, the project path, the options (see next section) and the variables. It is expected to return a dictionary of variables.

Since this hook allows for the execution of arbitrary Python code it is important to ensure that the hook does not contain any malicious code.

Options

A template can define extra options with the options key.

options = ["opt"]

Help

Using the help key a help message can be added to the template.

Usage

Using labo ls all templates can be listed. labo help <template> displays help information about the template <template>. To bootstrap a project use labo new <template> <project name> <template options>.

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

labo-0.1.4.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

labo-0.1.4-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file labo-0.1.4.tar.gz.

File metadata

  • Download URL: labo-0.1.4.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for labo-0.1.4.tar.gz
Algorithm Hash digest
SHA256 1c4842b32f5c8d58250246c6889b74c1d3b499968adc9e9984bcea9cc0746f29
MD5 a83594043e89129c637dc7788775d19a
BLAKE2b-256 69244a80d27a12057c9ce773399ebd65292c543a5d5d5592b06a1196fd95e084

See more details on using hashes here.

File details

Details for the file labo-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: labo-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for labo-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 540785b714028c14c749fb0729dfae31895354e326ec36c10977efcd317d7ba5
MD5 f37a1fe8d8646b64b7118b13bc85a807
BLAKE2b-256 7d2b214f1c9d3928bce520b85379b28cec10f1c82c404dd7392d4f0113187698

See more details on using hashes here.

Supported by

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