Skip to main content

A static website generator

Project description

Kamaji Static Website Generator

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

Version: 20220218

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-18 Kamaji mk4 is ready

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

kamaji-20220218.tar.gz (58.8 kB view details)

Uploaded Source

Built Distribution

kamaji-20220218-py3-none-any.whl (65.5 kB view details)

Uploaded Python 3

File details

Details for the file kamaji-20220218.tar.gz.

File metadata

  • Download URL: kamaji-20220218.tar.gz
  • Upload date:
  • Size: 58.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for kamaji-20220218.tar.gz
Algorithm Hash digest
SHA256 3044df99ed1f19585f1a780c0871288af1e9a2586a7f9b1bdc8f994e1297559e
MD5 9dd2a7111291afbea81d82435993ffea
BLAKE2b-256 84de1b7328b16ab1d9da0ce687953d22ca4afd141dfc6733150ff399606a0189

See more details on using hashes here.

File details

Details for the file kamaji-20220218-py3-none-any.whl.

File metadata

  • Download URL: kamaji-20220218-py3-none-any.whl
  • Upload date:
  • Size: 65.5 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for kamaji-20220218-py3-none-any.whl
Algorithm Hash digest
SHA256 9272fa8dc1d4c742363a1ab0a23ce5df45609c7213d1d51c89e7ffdf9a54222c
MD5 7dacf2cc80bc4d14f679d5ef0b4fd0e0
BLAKE2b-256 2febc16de2558c115626e68d5b8b85e29bfd915fa9f9def2dcc8e945869d548e

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