Skip to main content

A small static site generator powered by KDL and Jinja2.

Project description

kdlj2-web

An example of using Jinja2 and KDL as building blocks to build robust, possibly dynamic website markup and interpolation pipelines with a friendly syntax.

This example is very small. It has a simple file browser (only when using the debug HTTP server), and an example invoices table.

Quick Guide

After installing through pipx or uv or anything else,

  • Put your static assets in static/.

  • Write your page templates in the top level of templates/.

    • Snippets to be used inside pages should go on templates/partials/.
    • Layouts a page should inherit should go on templates/layouts/.
  • Run kdlj2-web to render your pages!

    • As a debug server: python kdlj2-web serve --port=1234
    • To a static file folder: python kdlj2-web build --outdir=my-path/
    • Add custom options: python kdlj2-web --opts theme=dark serve
  • If you want your static and template directories in a different location, you can use the -s argument, like so: python kdlj2-web -s my_webroot/ ...

Other Tools

A few auxiliary tools ship with this package, kd-to-html and html-to-kdl. Notice that the latter uses lxml.html's parsing semantics, which automatically wraps a sequence of top-level elements in div or span, and gets cranky if you try to use non-standard HTML elements.

$ echo 'p "hello"; p { - "world,"; b "o mighty"; }; br; - "that I so much"; i "crave!"' | kdl-to-html
<div<<p>hello</p><p>world,<b>o mighty</b></p><br></br>that I so much<i>crave!</i></div>

$ echo '<p>hello</p><p>world,<b>o mighty</b></p><br></br>that I so much<i>crave!</i>' | html-to-kdl
div {
  p "hello"
  p {
  	- "world,"
  	b "o mighty"
  }
  br
  - "that I so much"
  i "crave!
}
"```

## Copyright

(c)2026 Gustavo Ramos Rehermann (wallabra) <gr.wallabra@proton.me>.

All code and assets in this project are made available under the Cooperative
Non-Violent Public License: [about](https://thufie.lain.haus/NPL.html),
[raw](https://git.pixie.town/thufie/thufie-site/raw/branch/main/files/CNPLv7.md),
[ScanCode LicenseDB](https://scancode-licensedb.aboutcode.org/cooperative-non-violent-7.0.html).

Please see [LICENSE.md](./LICENSE.md).

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

kdlj2_web-0.1.4.tar.gz (67.8 kB view details)

Uploaded Source

Built Distribution

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

kdlj2_web-0.1.4-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kdlj2_web-0.1.4.tar.gz
  • Upload date:
  • Size: 67.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for kdlj2_web-0.1.4.tar.gz
Algorithm Hash digest
SHA256 9acd23025e7f23f071c13c582545b896013392d2dfe922c601aa4cf595f8d325
MD5 607483efcd9fbc3d0cbadd219fd263ce
BLAKE2b-256 308eec7b5f7e1f933cb26ad781b03eb1928b1ada972b87cdc53415c3604cdbac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kdlj2_web-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for kdlj2_web-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f0af8627687232829beaf31449a3235036acec1c9b8ef7bb7f7140ab14b060b2
MD5 f9fda2f51ceb0212bbdedb4a4b9c78a4
BLAKE2b-256 cfd91b2555a67043b8c579131e7418da6bb9860cdfc8a0bd7e638284a9552ca0

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