Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
drammock committed May 21, 2024
1 parent 25e1549 commit b5bcb67
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/pydata_sphinx_theme/toctree.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def unique_html_id(base_id: str):
return next(get_or_create_id_generator(base_id))

@cache
def _generate_nav_info(self) -> List[LinkInfo]:
def _generate_nav_info() -> List[LinkInfo]:

This comment has been minimized.

Copy link
@Carreau

Carreau May 22, 2024

Collaborator

Hum that is weird...

"""Generate informations necessary to generate nav.
Instead of messing with html later, having this as a util function
Expand Down Expand Up @@ -216,19 +216,25 @@ def _generate_header_nav_before_dropdown(
raise ValueError(
f"n_links_before_dropdown is not an int: {n_links_before_dropdown}"
)
links_data = _generate_nav_info(n_links_before_dropdown)
links_data = _generate_nav_info()

This comment has been minimized.

Copy link
@Carreau

Carreau May 22, 2024

Collaborator

Oh, it's because the self. is missing here.

This comment has been minimized.

Copy link
@Carreau

Carreau May 22, 2024

Collaborator

ah no it's not a class nevermind.


links_html = []
boilerplate = """
<li class="nav-item pst-header-nav-item{active}">
<a class="nav-link nav-{ext_int}" href="{href}">
{title}
</a>
</li>
"""
for link in links_data:
links_html.append(
dedent(
f"""
<li class="nav-item pst-header-nav-item {"current active" if link.is_current else ""}">
<a class="nav-link {"nav-external" if link.is_external else "nav-internal"}" href="{ link.href}">
{ link.title }
</a>
</li>
"""
boilerplate.format(
active=" current active" if link.is_current else "",
ext_int="external" if link.is_external else "internal",
href=link.href,
title=link.title,
)
)
)

Expand Down

0 comments on commit b5bcb67

Please sign in to comment.