Skip to main content

A static site generator written in Python

Project description

ophinode

ophinode is a static site generator written in Python that focuses on being a simple and flexible library for creating websites.

This project is currently in the initial development stage, and the APIs may change at any time.

Example programs

You can also get these example programs by running python -m ophinode examples.

# Example program: render a page without defining a site.
#
# Running this program prints a HTML document to standard output.
#
from ophinode import *

class MainPage:
    def body(self):
        return Div(
            H1("Main Page"),
            P("Welcome to ophinode!")
        )

    def head(self):
        return [
            Meta(charset="utf-8"),
            Title("Main Page")
        ]

print(render_page(MainPage(), HTML5Layout()))
# Example program: create a page in a directory.
#
# Running this program creates "index.html" in "./out" directory.
#
from ophinode import *

class DefaultLayout(Layout):
    def build(self, page, context):
        return [
            HTML5Doctype(),
            Html(
                Head(
                    Meta(charset="utf-8"),
                    Title(page.title()),
                    page.head()
                ),
                Body(
                    page.body()
                ),
            )
        ]

class MainPage:
    @property
    def layout(self):
        return DefaultLayout()

    def body(self):
        return Div(
            H1("Main Page"),
            P("Welcome to ophinode!")
        )

    def head(self):
        return []

    def title(self):
        return "Main Page"

if __name__ == "__main__":
    site = Site({
        "default_layout": DefaultLayout(),
        "export_root_path": "./out",
        "default_page_output_filename": "index.html",
    }, [
        ("/", MainPage()),
    ])

    site.build_site()

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

ophinode-0.0.1a3.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

ophinode-0.0.1a3-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file ophinode-0.0.1a3.tar.gz.

File metadata

  • Download URL: ophinode-0.0.1a3.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for ophinode-0.0.1a3.tar.gz
Algorithm Hash digest
SHA256 0911e6d009080d485fcf1e0745b5dffda51b736365c1839110be6fadb7fe6051
MD5 9ee56e23450dbb84c53c81d56c27c2e2
BLAKE2b-256 9642851c5531bf52b19f977919d28fca70f8fc696fc78ac4eab783f5050ebf54

See more details on using hashes here.

File details

Details for the file ophinode-0.0.1a3-py3-none-any.whl.

File metadata

  • Download URL: ophinode-0.0.1a3-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for ophinode-0.0.1a3-py3-none-any.whl
Algorithm Hash digest
SHA256 89a492f32d1af8e113f6a008eda023ded7a4f0193749b2b46c04cf7cfb517f08
MD5 b3fe03b2526788d4355a9a823e4ffa71
BLAKE2b-256 29df7f67bab599ba72247f5d7d81a645f8a3cf06dd8c1a3a4b3d84fa9460795d

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