Skip to content

Commit

Permalink
Revisit caching strategy and pipeline structure (#11)
Browse files Browse the repository at this point in the history
- Found and fixed bug for snippets of Isabelle theories.
- Faster builds when serving the website due to smarter caching, error
handling,
  and flags for preprocessing.
- The CLI `juvix-mkdocs serve/build` has new flags: `-v` for verbose
mkdocs
mode, `--debug` for activating extra debugging messages, and
`--remove-cache`
  for deleting the `.cache-juvix-mkdocs` folder.
  • Loading branch information
jonaprieto authored Nov 24, 2024
1 parent d8a4c92 commit 02bab81
Show file tree
Hide file tree
Showing 15 changed files with 1,168 additions and 631 deletions.
4 changes: 0 additions & 4 deletions mkdocs_juvix/common/models/wikilink.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
from typing import Optional

from mkdocs.plugins import get_plugin_logger

from .loc import FileLoc

log = get_plugin_logger("\033[94m[wikilinks]\033[0m")


class WikiLink:
html_path: Optional[str]
Expand Down
10 changes: 1 addition & 9 deletions mkdocs_juvix/common/preprocesors/links.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import os
import re
import time
from pathlib import Path
from typing import Any, List, Optional, Tuple
from urllib.parse import urljoin

import numpy as np # type: ignore
from colorama import Fore, Style # type: ignore
from fuzzywuzzy import fuzz # type: ignore
from markdown.preprocessors import Preprocessor # type: ignore
from mkdocs.plugins import get_plugin_logger
from mkdocs.structure.pages import Page
from ncls import NCLS # type: ignore

from mkdocs_juvix.common.models import FileLoc, WikiLink
from mkdocs_juvix.env import ENV
from mkdocs_juvix.logger import log
from mkdocs_juvix.utils import time_spent as time_spent_decorator

WIKILINK_PATTERN = re.compile(
Expand All @@ -29,10 +26,6 @@
re.VERBOSE,
)

log = get_plugin_logger(
f"{Fore.BLUE}[juvix_mkdocs] (preprocessor: wikilinks){Style.RESET_ALL}"
)


def time_spent(message: Optional[Any] = None, print_result: bool = False):
return time_spent_decorator(log=log, message=message, print_result=print_result)
Expand Down Expand Up @@ -189,7 +182,6 @@ def run(self, lines: List[str]) -> List[str]:
return self._run("\n".join(lines)).split("\n")

def _run(self, content: str) -> str:
log.info(f"{Fore.MAGENTA}Running wikilinks preprocessor{Style.RESET_ALL}")
if (
self.absolute_path is None
and self.relative_path is None
Expand Down
Loading

0 comments on commit 02bab81

Please sign in to comment.