Skip to content

Commit

Permalink
Collapse single pages
Browse files Browse the repository at this point in the history
  • Loading branch information
minottic committed Jul 5, 2024
1 parent 4aa1efc commit 96b6f32
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 38 deletions.
37 changes: 0 additions & 37 deletions .github/make_relative_to.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,5 @@ def on_page_content(html, page, config, files):
resolved_path = Path(ospath.normpath(page_path / path))
if any(filter(lambda x: Path(x.src_uri.strip('README.md')) == resolved_path, docs)): # Exiting docs
continue
log.warning(f'env: {environ["BASE_URL"]}')
log.warning(f'page.url: {page.url}')
log.warning(f'href: {element["href"]}')
element['href'] = urljoin(f"{environ['BASE_URL']}/", ospath.normpath(page_path / element['href']))
return soup.prettify()


# pattern = r'href="((?!http)[^"]*(?<!\.md)[^"]*)'
# return sub(pattern, lambda m: f'href="{urljoin(os.environ['BASE_URL'], page.url, m.group(1))}', markdown)


# def on_env(env, config, files, **kwargs):
# log.warning('inside os_env')
# def url_with_redirect(func):
# @wraps(func)
# def inner(context, value):
# log.warning(f'before url_filter context: {context['page']}')
# log.warning(f'before url_filter: {value}')
# url = func(context, value)
# log.warning(f'os_env url: {url}')
# scheme, netloc, path, query, anchor = urlsplit(url)
# if scheme or netloc: # External link
# return url
# if not path: # Self-link containing only query or anchor.
# return url
# if files.get_file_from_path(path) or files.get_file_from_path: # MD document or folder with MD
# return url
# # if files.documentation_pages().any(lambda x: x):
# # return url
# return urljoin(os.environ['BASE_URL'], url)
# return inner

# env.filters['url'] = url_with_redirect(templates.url_filter)
# return env

# def on_nav(nav, *args, **kwargs):
# for page in nav.pages:
# page.url += 'index.html'
# return nav
3 changes: 2 additions & 1 deletion .github/mkdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ theme:

plugins:
- search
- awesome-pages
- awesome-pages:
collapse_single_pages: true

markdown_extensions:
- admonition
Expand Down

0 comments on commit 96b6f32

Please sign in to comment.