Skip to main content

Module template

Module template 

Source
Expand description

Template preprocessor — renders Jinja2-style templates via MiniJinja through burgertocow’s Tracker.

Matches files with configurable extensions (default: .tmpl, .template), renders them against a variable context with three namespaces:

  • dodot.* — built-in values (os, arch, hostname, username, home, dotfiles_root), computed once at preprocessor construction.
  • env.* — dynamic lookup of process environment variables.
  • bare names — user-defined variables from [preprocessor.template.vars] in .dodot.toml.

Uses MiniJinja strict undefined-behaviour: references to missing vars raise a render error rather than silently producing empty strings.

§Tracked render

Rendering goes through burgertocow::Tracker rather than a raw minijinja::Environment. The tracker installs a custom formatter that wraps every variable emission in marker bytes, producing a [TrackedRender] alongside the visible output. The visible output is identical to the plain-MiniJinja path (modulo the keep_trailing_newline setting that Tracker also applies). The marker-annotated string is persisted in the baseline cache so the reverse-merge pipeline (dodot transform check, the clean filter) can compute template-space diffs without re-rendering — re-rendering at clean-filter time would re-trigger any secret-provider auth prompts on every git status.

Structs§

TemplatePreprocessor
Template rendering preprocessor. Generative (one-way) transform.