Skip to main content

An extensible static site generator.

Project description

Pyndakaas

An extensible static site generator written in Python.

Features

  • Extensible Handler System: Register custom file handlers for different content types
  • Flexible Renderer System: Support for multiple rendering engines (Markdown, etc.)
  • Template Support: Jinja2-based templating with metadata support
  • File Metadata: JSON frontmatter parsing for rich content metadata
  • Glob Matching: Template functions for filtering and selecting files

Installation

pip install pyndakaas

For development:

git clone https://github.com/rubenvannieuwpoort/pyndakaas
cd pyndakaas
pip install -e .

Quick Start

from pathlib import Path
from pyndakaas import process_dir, Handler, handler

# Define a custom handler
@handler()
class MarkdownHandler(Handler):
    @staticmethod
    def should_handle(input_path: Path) -> bool:
        return input_path.suffix == '.md'
    
    def template(self) -> str | None:
        return 'post'
    
    def body(self) -> str:
        # Your markdown rendering logic here
        return f"<p>{self.source}</p>"

# Process directory
process_dir(Path('src'), Path('output'))

File Format

Source files use JSON frontmatter followed by content:

{
    "title": "My Post",
    "author": "John Doe",
    "template": "custom-layout"
}

# My Content

This is the actual content that will be processed.

The template field in frontmatter will override the handler's default template specified in the template method of the handler.

Handlers

Handlers define how different file types are processed:

  • should_handle(): Static method to identify files this handler should process
  • suffix(): Method returning output file extension (defaults to '.html')
  • body(): Method returning processed content
  • template(): Method returning template name to use (or None to don't use a template and instead output the processed content)

Templates

Templates are Jinja2 files in the templates/ directory. They receive:

  • front_matter: Parsed JSON frontmatter from the source file
  • body: Processed content from the handler's body() method
  • folder: Globber instance for filtering files relative to current file
  • root: Globber instance for filtering files relative to the root of the input directory

License

MIT License - see LICENSE file for details.

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

pyndakaas-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

pyndakaas-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file pyndakaas-0.1.0.tar.gz.

File metadata

  • Download URL: pyndakaas-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyndakaas-0.1.0.tar.gz
Algorithm Hash digest
SHA256 23a974c5b1c4141f1e0fcc91b4d6f787d998a96c2ad9267c3520a0cdd45bcc52
MD5 6c89e3fecdd62420bdad17a1d116c3c3
BLAKE2b-256 44276acc3eccd171b295caf10e21ade9fdce68fb046750ebda7363270149411f

See more details on using hashes here.

File details

Details for the file pyndakaas-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyndakaas-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyndakaas-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e0de73215c0d125991caedf00a3fe531b68a3abd1f569798bca4e3299fcf627
MD5 a4c2dd0305b7d84e7139cc070b6b561f
BLAKE2b-256 a6e7623f783ab0b86d0d57eefdc46acbcc8c41065bb12818f468ff4f49cbb06f

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