diff --git a/lattice/docs/mkdocs_web.py b/lattice/docs/mkdocs_web.py index ddef718..424387c 100644 --- a/lattice/docs/mkdocs_web.py +++ b/lattice/docs/mkdocs_web.py @@ -5,6 +5,7 @@ import shutil from urllib.parse import urlparse from typing import List +from datetime import datetime import pygit2 from jinja2 import Environment, FileSystemLoader @@ -74,6 +75,7 @@ def __init__(self, lattice): self.specification_counter = 1 self.specification_templates: List[DocumentFile] = [] self.navigation = [] + self.timestamp = datetime.now() def setup_build_directory_structure(self): # pylint: disable=missing-function-docstring self.content_directory_path = make_dir(Path(self.build_directory, "docs")) @@ -100,9 +102,7 @@ def get_git_info(self): # pylint: disable=missing-function-docstring self.git_ref_name = "main" else: self.git_ref_name = self.git_repo.head.name - self.git_remote_url = ( - rf"https://{self.git_repo_owner}.{self.git_repo_host}.com/{self.git_repo_owner}/{self.git_repo_name}" - ) + self.git_remote_url = rf"https://{self.git_repo_host}.com/{self.git_repo_owner}/{self.git_repo_name}" self.base_url = rf"https://{self.git_repo_owner}.{self.git_repo_host}.io/{self.git_repo_name}/" # pylint: disable-next=missing-function-docstring, too-many-branches, too-many-statements @@ -121,11 +121,12 @@ def make_config(self): # pylint: disable=missing-function-docstring "site_url": self.base_url, "site_author": self.author, "site_description": self.description, + "copyright": f"© {self.timestamp.year} {self.author} All rights reserved", "theme": {"name": "material", "favicon": favicon, "logo": logo, "palette": self.colors}, "repo_name": self.git_repo_name, "repo_url": self.git_remote_url, "nav": self.navigation, - "markdown_extensions": ["markdown_grid_tables"], + "markdown_extensions": ["markdown_grid_tables", "pymdownx.smartsymbols"], } def make_pages(self): @@ -308,6 +309,7 @@ def make_main_menu_page( ): front_matter = { "title": title, + "build_date_utc": self.timestamp, } if content_type is not None: @@ -350,6 +352,7 @@ def make_specification_page( # Append front matter front_matter = { "title": title, + "build_date_utc": self.timestamp, } self.specification_counter += 1 diff --git a/lattice/lattice.py b/lattice/lattice.py index f2820fd..a5c75a5 100644 --- a/lattice/lattice.py +++ b/lattice/lattice.py @@ -4,7 +4,7 @@ import warnings from fnmatch import fnmatch from pathlib import Path -from typing import List +from typing import List, Union from jsonschema.exceptions import RefResolutionError from lattice.docs.process_template import process_template @@ -20,7 +20,7 @@ class SchemaFile: # pylint:disable=R0902 """Parse the components of a schema file.""" - def __init__(self, path) -> None: + def __init__(self, path: Path) -> None: """Open and parse source schema""" self.path = Path(path).absolute() @@ -126,11 +126,11 @@ class Lattice: # pylint:disable=R0902 def __init__( self, - root_directory=Path.cwd(), - build_directory: Path = None, - build_output_directory_name=".lattice", - build_validation=True, - ): + root_directory: Path = Path.cwd(), + build_directory: Union[Path | None] = None, + build_output_directory_name: Path = Path(".lattice"), + build_validation: bool = True, + ) -> None: """Set up file structure""" # Check if directories exists