Initial commit
Initial structure with little functionality
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
/venv
|
||||
__pycache__
|
||||
*.egg-info
|
||||
*.pyc
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2026 omicron <omicron.me@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,20 @@
|
||||
import logging
|
||||
import sys
|
||||
from omicron.ssg.site import Site
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def setup_logging(verbose: bool = False, log_file: str | None = None) -> None:
|
||||
logger = logging.getLogger("omicron.ssg")
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
console = logging.StreamHandler(sys.stderr)
|
||||
console.setLevel(logging.DEBUG if verbose else logging.INFO)
|
||||
console.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
|
||||
logger.addHandler(console)
|
||||
|
||||
|
||||
def main():
|
||||
setup_logging(verbose=True)
|
||||
site = Site(Path("."))
|
||||
site.build()
|
||||
@@ -0,0 +1,8 @@
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Content:
|
||||
def __init__(self, path):
|
||||
pass
|
||||
@@ -0,0 +1,35 @@
|
||||
import logging
|
||||
|
||||
from omicron.ssg.content import Content
|
||||
from pathlib import Path
|
||||
import yaml
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Site:
|
||||
def __init__(self, site: Path):
|
||||
self.site_path = site.absolute()
|
||||
self.content: list[Content] = []
|
||||
self.config: dict = {}
|
||||
self.by_tag: dict[str, list[Content]]
|
||||
self.by_uri: dict[str, Content]
|
||||
self.read_config()
|
||||
|
||||
def read_config(self) -> None:
|
||||
config_path = self.site_path / "config.yml"
|
||||
log.debug("Reading config file %s", config_path)
|
||||
with open(config_path, "r") as f:
|
||||
self.config = yaml.safe_load(f)
|
||||
|
||||
def discover(self) -> None:
|
||||
log.info("Discovering content...")
|
||||
content_path = self.site_path / "content"
|
||||
for file in content_path.rglob("*"):
|
||||
if file.is_file():
|
||||
self.content.append(Content(file))
|
||||
log.info("Discovered %d content items", len(self.content))
|
||||
|
||||
def build(self):
|
||||
self.discover()
|
||||
pass
|
||||
@@ -0,0 +1,21 @@
|
||||
[build-system]
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "omicron-ssg"
|
||||
version = "0.1.0"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
"Jinja2",
|
||||
"markdown-it-py",
|
||||
"Pygments",
|
||||
"PyYAML",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
ossg = "omicron.ssg.cli:main"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["."]
|
||||
include = ["omicron.ssg*"]
|
||||
Reference in New Issue
Block a user