Altan Haan

Static Site Compiler

Regex Matching

Graph representing poset of regexes

The regexes are ordered by regular language inclusion,1 and are used for dispatching different parts of the compiler based on the input path.

Dependencies and Caching Compilation

Dependency graph

  "public_html\\articles\\static-site-compiler.html": {
    "last_compiled": "2020-12-06T19:13:46.742461"
  "content\\articles\\index.yaml": {
    "last_compiled": "2020-12-06T17:15:13.406615"
  "data\\records.csv": {
    "last_compiled": "2020-12-06T19:00:57.702252"

Every .yaml and .md file gets compiled to a pickled Python dict representing its content (each .md is assumed to have a YAML frontmatter). Each .bin (i.e., pickled Python dictionary) maps directly to an output HTML file via Jinja2 templating.


  1. How do I build/specify the dependencies that the final HTML files have on Jinja2 templates? Every file depends on the header and footer templates (currently), but not every file depends on every body template (in fact none do, they only depend on one each). For now I am just detecting whenever a template is modified, and forcing a complete recompilation.
  1. This is currently done manually by specifying pairs (r1, r2) denoting r1 <= r2, but I could in theory convert each regex to a DFA and do DFA intersection etc.

This page was generated on Mon Jan 25 21:06:26 2021.