Skip to content

Commit

Permalink
Minor fixes to mkdocs.
Browse files Browse the repository at this point in the history
  • Loading branch information
nealkruis committed May 29, 2024
1 parent 8584bfa commit 7d8787d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
11 changes: 7 additions & 4 deletions lattice/docs/mkdocs_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"))
Expand All @@ -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
Expand All @@ -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"&copy {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):
Expand Down Expand Up @@ -308,6 +309,7 @@ def make_main_menu_page(
):
front_matter = {
"title": title,
"build_date_utc": self.timestamp,
}

if content_type is not None:
Expand Down Expand Up @@ -350,6 +352,7 @@ def make_specification_page(
# Append front matter
front_matter = {
"title": title,
"build_date_utc": self.timestamp,
}

self.specification_counter += 1
Expand Down
14 changes: 7 additions & 7 deletions lattice/lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7d8787d

Please sign in to comment.