Skip to main content

Kamaji Static Website Generator

Copyright (C) 2021-2022 Frank Abelbeck kamaji@abelbeck.info

Version: 20220225

License: GLP 3

Overview

Kamaji is a static website generator. It generates HTML files from Markdown source files, processing their metadata and following all local file references.

Kamaji will only process source files that are newer than the output. It will build all dependencies and references as it goes along.

Metadata in a Markdown file defines the environment of that file. You configure your entire website only by defining metadata.

With metadata you can define environment variables for a file. You can access these variables in your markdown source or in HTML templates/snippets by prepending the variable name with a dollar sign.

Note: Kamaji confines its operations to the current working directory.

Name, Icon, and Development

This program is named after the boiler-grandpa in "Spirited Away" to honour Hayao Miyazaki and his œuvre.

The Icon represents the letter "K" in the Braille writing system.

The BBC recording of the Last Night of the Proms 2019 supplied the soundtrack while developing this software. You can't go wrong with a bit of a Cancan. And with the all-time great version of "Somewhere Over the Rainbow", sung so lushly by Jamie Barton.

Usage

General

usage: kamaji [-h] [-l {debug,info,warn,err,crit}] [--version] {demo,build,map,info,license} ...

Manage a static website.

positional arguments:
  {demo,build,map,info,license}
    demo                Initialise an example source directory
    build               Build a static website
    map                 Create a graph of the site structure
    info                show documentation on Kamaji
    license             show Kamaji's license text

optional arguments:
  -h, --help            show this help message and exit
  -l {debug,info,warn,err,crit}, --loglevel {debug,info,warn,err,crit}
                        Set the minimum log level (default: info)
  --version             show program's version number and exit

Build

usage: kamaji.py build [-h] [--no-prune] [--no-clean] [--force] [--exclude PATTEXC] [--include PATTINC] [--copy PATTCPY] [--output PATHOUT] [--db PATHDB]

Build a static website in the current directory.

optional arguments:
  -h, --help         show this help message and exit
  --no-prune         do not remove empty HTML tags from the final output
  --no-clean         do not remove stale files from the output directory
  --force            force rebuilding by ignoring any existing node DB
  --exclude PATTEXC  exclude any file matching PATTEXC
  --include PATTINC  include any file matching PATTINC
  --copy PATTCPY     instead of processing, just copy any file matching PATTCPY
  --output PATHOUT   define the path PATHOUT of the output directory
  --db PATHDB        define the path PATHDB of the node JSON database

Default values:
   PATHOUT = .kamaji/out
   PATHDB  = .kamaji/nodes.json

The options --exclude, --include, and --copy accept patterns with the following special characters:
  '*'      matches everything
  '**'     matches everything in the current and all subdirectories, recursively
  '?'      matches any single character
  '[seq]'  matches any character in seq
  '[!seq]' matches any character not in seq

Output directory PATHOUT and node database file PATHDB are ignored automatically.

The options --ignore and --copy may be specified multiple times.

Map

usage: kamaji.py map [-h] [--db PATHDB] [--format FMT] [--engine ENGINE] [--exclude PATTEXC] [--include PATTINC] [--class CLS] [--deps] [--refs] [--all] [--site] [--attribute CLS KEY VAL]
                     [--undirected] [--merge]
                     PATHOUT

Create a graph of the node structure in the current directory.

positional arguments:
  PATHOUT               define the path PATHOUT of the sitemap output file. Suffixes are appended as needed.

optional arguments:
  -h, --help            show this help message and exit
  --db PATHDB           define the path PATHDB of the node JSON database [default: .kamaji/nodes.json]
  --format FMT          define the output format FORMAT of the sitemap output file
  --engine ENGINE       define the layout engine ENGINGE used by GraphViz
  --exclude PATTEXC     exclude any file matching PATTEXC
  --include PATTINC     include any file matching PATTINC
  --class CLS           include all nodes of given class and its subclasses
  --deps                include all nodes that are dependencies of others
  --refs                include all nodes that are references to others
  --all                 include nodes of all classes and all relationships
  --site                include all website nodes, suitable for a sitemap
  --attribute CLS KEY VAL
                        define an additional attribute KEY=VAL for a given class CLS
  --undirected          create an undirected graph
  --merge               merge parallel edges (i.e. use edge concentrators)

Default values:
   PATHDB = .kamaji/nodes.json
   FORMAT = svg
   ENGINE = dot

Available node classes (option --class):
   Node
    +-- NodeQuery
    +-- NodeLocal
    |    +-- NodeLocalFile
    |    |    +-- NodeLocalFileMarkdown
    |    |    +-- NodeLocalFileHtml
    |    |    +-- NodeLocalFileSvg
    |    |    +-- NodeLocalFileCss
    |    |    +-- NodeLocalFileMisc
    |    |    `-- NodeLocalFileUnkown
    |    `-- NodeLocalDirectory
    `-- NodeRemote
         +-- NodeRemoteMailto
         +-- NodeRemoteHttp
         `-- NodeRemoteMisc

Any local link is made relative to the output file's directory.

Option --all equals "--class Node --deps --refs" and takes precedence over --site.

Option --site equals "--class NodeLocalFileMarkdown --class NodeLocalFileHtml --class NodeLocalDirectory --refs" and takes precedence over --class.

Option --attribute allows attribute definition for nodes and edges.
If CLS equals "graph", this defines a graph attribute.
If CLS equals "nodes", this defines a general node attribute.
If CLS equals "edges", "dep", or "ref", this defines a general, dependency, or reference edge attribute.
Otherwise CLS is interpreted as node class name (see above) and defines the attribute for that node class and all subclasses.

The options --exclude and --include accept a pattern with the following special characters:
  '*'      matches everything
  '**'     matches everything in the current and all subdirectories, recursively
  '?'      matches any single character
  '[seq]'  matches any character in seq
  '[!seq]' matches any character not in seq

If --undirected is passed, Kamaji will create an undirected graph. Otherwise dependency edges point from the dependency towards the dependent node, and reference edges point from the referrer to the referenced node.

The option --merge lets Kamaji merge parallel edges (i.e. pairwise reference/dependency).

Extra class "edgedep" and "edgeref" are added to dependency and reference edges, respectively. This is useful when styling SVG output over CSS.

The options --class, --attribute, --exclude, and --include may be specified multiple times.

Demo

usage: kamaji.py demo [-h]

Populate the current directory with some example files.

optional arguments:
  -h, --help  show this help message and exit

Info

usage: kamaji.py info [-h] [--raw]

Show documentation on Kamaji.

optional arguments:
  -h, --help  show this help message and exit
  --raw       show documentation in raw markdown format

License

usage: kamaji.py license [-h] [--raw]

Show Kamaji's license text.

optional arguments:
  -h, --help  show this help message and exit
  --raw       show license in raw markdown format

Changelog

  • 2022-02-25 copy argument now also copies unreferenced files
  • 2022-02-18 Kamaji mk4 is ready

Metadata

Release files for kamaji 20220225

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kamaji 20220225
File Size Uploaded Provenance Actions
kamaji-20220225.tar.gz 59.3 kB Without provenance Details for kamaji-20220225.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kamaji 20220225
File Interpreter ABI Platform Actions
kamaji-20220225-py3-none-any.whl Python 3 none any Details for kamaji-20220225-py3-none-any.whl

Total release size: 125.3 kB

Release files / kamaji-20220225.tar.gz

Download URL kamaji-20220225.tar.gz
Size 59.3 kB
Tags Source
SHA-256 checksum
How to use checksums
aca97521a26f99c6e4432ab63d545bc32c93ed06ae255d0cb04940d346c7561e
BLAKE2b-256 checksum
How to use checksums
933e6cf8a55269993697d0099b33153c6b064e893ff42ab7e51309bc85b256e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.0 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release files / kamaji-20220225-py3-none-any.whl

Download URL kamaji-20220225-py3-none-any.whl
Size 66.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ec14183ce6af3fa3996eae82534f1bb1ae400f4cfbd4ed62d7bd79fd51400fd
BLAKE2b-256 checksum
How to use checksums
7bb44c35957b78fa076dbf642c48d055bacde9d1071a188b88b0e1772e2824f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.0 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Security for kamaji 20220225

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

20220225 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page