diff --git a/papyri/render.py b/papyri/render.py index 66955c59..f0bd8c47 100644 --- a/papyri/render.py +++ b/papyri/render.py @@ -1,7 +1,7 @@ import builtins -import math import json import logging +import math import operator import os import random @@ -11,12 +11,12 @@ from dataclasses import dataclass from functools import lru_cache from pathlib import Path -from typing import Optional, Set, Any, Dict, List, Callable, Tuple, Iterable +from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Tuple from flatlatex import converter from jinja2 import Environment, FileSystemLoader, StrictUndefined, select_autoescape from pygments.formatters import HtmlFormatter -from quart import send_from_directory, Response, redirect +from quart import Response, redirect, send_from_directory from quart_trio import QuartTrio from rich.logging import RichHandler @@ -31,10 +31,9 @@ from .crosslink import IngestedBlobs, find_all_refs from .graphstore import GraphStore, Key from .myst_ast import MLink, MText -from .take2 import RefInfo, encoder, Section +from .take2 import RefInfo, Section, encoder from .tree import TreeReplacer, TreeVisitor -from .utils import progress, dummy_progress - +from .utils import dummy_progress, progress FORMAT = "%(message)s" logging.basicConfig( @@ -212,7 +211,7 @@ def __init__(self, store: GraphStore, *, sidebar, prefix, trailing_html): self.progress = progress self.store = store self.env = Environment( - loader=FileSystemLoader(os.path.dirname(__file__)), + loader=FileSystemLoader(Path(os.path.dirname(__file__)) / "templates"), autoescape=select_autoescape(["html", "tpl.j2"]), undefined=StrictUndefined, ) diff --git a/papyri/404.tpl.j2 b/papyri/templates/404.tpl.j2 similarity index 100% rename from papyri/404.tpl.j2 rename to papyri/templates/404.tpl.j2 diff --git a/papyri/ascii.tpl.j2 b/papyri/templates/ascii.tpl.j2 similarity index 100% rename from papyri/ascii.tpl.j2 rename to papyri/templates/ascii.tpl.j2 diff --git a/papyri/examples.tpl.j2 b/papyri/templates/examples.tpl.j2 similarity index 100% rename from papyri/examples.tpl.j2 rename to papyri/templates/examples.tpl.j2 diff --git a/papyri/gallery.tpl.j2 b/papyri/templates/gallery.tpl.j2 similarity index 100% rename from papyri/gallery.tpl.j2 rename to papyri/templates/gallery.tpl.j2 diff --git a/papyri/graph.tpl.j2 b/papyri/templates/graph.tpl.j2 similarity index 100% rename from papyri/graph.tpl.j2 rename to papyri/templates/graph.tpl.j2 diff --git a/papyri/head.tpl.j2 b/papyri/templates/head.tpl.j2 similarity index 100% rename from papyri/head.tpl.j2 rename to papyri/templates/head.tpl.j2 diff --git a/papyri/html.tpl.j2 b/papyri/templates/html.tpl.j2 similarity index 100% rename from papyri/html.tpl.j2 rename to papyri/templates/html.tpl.j2 diff --git a/papyri/index.tpl.j2 b/papyri/templates/index.tpl.j2 similarity index 100% rename from papyri/index.tpl.j2 rename to papyri/templates/index.tpl.j2 diff --git a/papyri/macros.tpl.j2 b/papyri/templates/macros.tpl.j2 similarity index 100% rename from papyri/macros.tpl.j2 rename to papyri/templates/macros.tpl.j2 diff --git a/papyri/root.tpl.j2 b/papyri/templates/root.tpl.j2 similarity index 100% rename from papyri/root.tpl.j2 rename to papyri/templates/root.tpl.j2 diff --git a/papyri/skeleton.tpl.j2 b/papyri/templates/skeleton.tpl.j2 similarity index 100% rename from papyri/skeleton.tpl.j2 rename to papyri/templates/skeleton.tpl.j2 diff --git a/papyri/toctree.tpl.j2 b/papyri/templates/toctree.tpl.j2 similarity index 100% rename from papyri/toctree.tpl.j2 rename to papyri/templates/toctree.tpl.j2 diff --git a/papyri/virtual.j2 b/papyri/templates/virtual.j2 similarity index 100% rename from papyri/virtual.j2 rename to papyri/templates/virtual.j2