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, register, renderer

# Define a custom handler
@register()
class MarkdownHandler(Handler):
    suffix = '.html'
    template = 'post'
    renderer = 'markdown'
    
    @staticmethod
    def detect(source_path: Path) -> bool:
        return source_path.suffix == '.md'

# Define a custom renderer
@renderer("markdown")
def render_markdown(source: str) -> str:
    # Your markdown rendering logic here
    return f"<p>{source}</p>"

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

File Format

Source files use JSON frontmatter followed by content:

{
    "title": "My Post",
    "template": "post",
    "renderer": "markdown"
}

# My Content

This is the actual content that will be processed.

Handlers

Handlers define how different file types are processed:

  • suffix: Output file extension
  • template: Default template to use
  • renderer: Default renderer for content
  • detect(): Method to identify files this handler should process

Templates

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

  • All metadata from the source file
  • body: Rendered content
  • path: Source file path
  • source: Raw source content
  • glob(): Function to filter files by pattern

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.0.1.tar.gz (4.5 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.0.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyndakaas-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a0e16926977fb11e675e68a8997b9965a9b58d0e1b125ec537b2ff257e2e34d3
MD5 13adec6c060a167c628daefe72444ac4
BLAKE2b-256 844d0f8a99c9d622b393ae157660b5a18c47b7de5cdccc57ebb95e1aa221a360

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyndakaas-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 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.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7a1a61e9f817d08137e79f3de5dd373eb46fdff873f38956de52bd0dc5e037b5
MD5 7318288fbeb256e3fcba8a0af5c6e892
BLAKE2b-256 86127bedf29ffc87a17dd6dd27b3d8a3e9d8cee3bd3d7d1cd45ae61b9daab12f

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