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 committed Nov 24, 2024
1 parent d8a4c92 commit f01cc27
Show file tree
Hide file tree
Showing 16 changed files with 1,172 additions and 636 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
GIT_COMMITTER_EMAIL: [email protected]
GIT_COMMITTER_NAME: Tara
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
JUVIX_VERSION: v0.6.8
concurrency:
group: "${{ github.workflow }}-${{ github.head_ref || github.run_id }}"
cancel-in-progress: true
Expand All @@ -31,7 +32,7 @@ jobs:
uses: jaxxstorm/[email protected]
with:
repo: anoma/juvix
tag: v0.6.6
tag: ${{ env.JUVIX_VERSION }}
cache: enable
rename-to: juvix
chmod: 0755
Expand Down
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 f01cc27

Please sign in to comment.