Skip to content

Commit

Permalink
Bump up to v0.4.3 (#12)
Browse files Browse the repository at this point in the history
- Needed refactors due to caching conflicts and data races (still some
work to be done)
  • Loading branch information
jonaprieto authored Nov 25, 2024
1 parent 6252e0b commit 4023aec
Show file tree
Hide file tree
Showing 9 changed files with 387 additions and 340 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ jobs:
run: poetry run pytest
- name: Create MkDocs Project
run: |
juvix-mkdocs new -f -n --no-run-server --no-open --project-name my-juvix-project --anoma-setup
juvix-mkdocs new -f -n --no-run-server --no-open --project-name
my-juvix-project --anoma-setup
- name: Build MkDocs Project
run: juvix-mkdocs build -p my-juvix-project
env:
SITE_URL: https://anoma.github.io/juvix-mkdocs
SITE_NAME: Juvix MkDocs
- if: success()
uses: JamesIves/[email protected]
with:
Expand Down
39 changes: 21 additions & 18 deletions mkdocs_juvix/common/preprocesors/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,31 +204,34 @@ def _run(self, content: str) -> str:
log.error(f"Error occurred while processing ignore patterns: {str(e)}")
return content

intervals_where_not_to_look = None
if intervals:
starts, ends, ids = map(np.array, zip(*intervals))
intervals_where_not_to_look = NCLS(starts, ends, ids)
# intervals_where_not_to_look = None
# if intervals:
# starts, ends, ids = map(np.array, zip(*intervals))
# intervals_where_not_to_look = NCLS(starts, ends, ids)

# Find all wikilinks
str_wikilinks = list(WIKILINK_PATTERN.finditer(content))

log.debug(f"Found {len(str_wikilinks)} wikilinks")
replacements = []
for m in str_wikilinks:
start, end = m.start(), m.end()
if intervals_where_not_to_look and not list(
intervals_where_not_to_look.find_overlap(start, end)
):
link: Optional[WikiLink] = process_wikilink(
self.config, content, m, self.absolute_path
)
if link is not None:
replacements.append(
(
start,
end,
link.markdown(),
)

# TODO: review this
# if intervals_where_not_to_look and not list(
# intervals_where_not_to_look.find_overlap(start, end)
# ):
link: Optional[WikiLink] = process_wikilink(
self.config, content, m, self.absolute_path
)
log.debug(f"Processing wikilink: {link}")
if link is not None:
replacements.append(
(
start,
end,
link.markdown(),
)
)
for start, end, new_text in reversed(replacements):
content = content[:start] + new_text + content[end:]
return content
Expand Down
12 changes: 3 additions & 9 deletions mkdocs_juvix/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@

import mkdocs_juvix.utils as utils
from mkdocs_juvix.juvix_version import MIN_JUVIX_VERSION
from mkdocs_juvix.utils import (
compute_sha_over_folder,
fix_site_url,
hash_content_of,
is_juvix_markdown_file,
)
from mkdocs_juvix.utils import is_juvix_markdown_file

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

Expand All @@ -43,7 +38,7 @@ class ENV:
DIFF_AVAILABLE: bool
DIFF_DIR: Path
DIFF_OPTIONS: List[str]
SITE_URL: str
SITE_URL: str = getenv("SITE_URL", "/")
SITE_DIR: Optional[str]
JUVIX_VERSION: str = ""
USE_DOT: bool
Expand All @@ -52,6 +47,7 @@ class ENV:
IMAGES_ENABLED: bool
CLEAN_DEPS: bool = bool(getenv("CLEAN_DEPS", False))
UPDATE_DEPS: bool = bool(getenv("UPDATE_DEPS", False))
TIMELIMIT: int = int(getenv("TIMELIMIT", 10))

REMOVE_CACHE: bool = bool(getenv("REMOVE_CACHE", False))

Expand Down Expand Up @@ -119,10 +115,8 @@ def __init__(self, config: Optional[MkDocsConfig] = None):
exit(1)

self.ROOT_PATH = Path(config_file).parent
self.SITE_URL = config.get("site_url", "")
else:
self.ROOT_PATH = Path(".").resolve()
self.SITE_URL = ""

self.ROOT_ABSPATH = self.ROOT_PATH.absolute()
self.CACHE_ABSPATH = self.ROOT_ABSPATH / self.CACHE_DIRNAME
Expand Down
Loading

0 comments on commit 4023aec

Please sign in to comment.