Skip to content

Conversation

@ramonbroox
Copy link

If a subrepo has a URL in a nav item:

nav:
    - Home: index.md
    - External link: 'https://foo.bar/quux'

support.py:resolve_nav_paths() rewrites the link making it unusable.

@github-actions
Copy link

Version Number Check

Update the version in pyproject.toml if you want this PR to generate a new release (main is 0.6.3 >= 0.6.3). In addition, please update the CHANGELOG.md.

for index, entry in enumerate(nav):
if isinstance(entry, str):
nav[index] = str(section_name / Path(entry)).replace("\\", "/")
if entry.startswith("http"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And ftp or other schemas? What about using urlparse?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, you can make this one line.

nav[index] = str(section_name / Path(entry)).replace("\\", "/") if not urlparse.some_method(entry) else entry

if type(value) is list:
resolve_nav_paths(value, section_name)
else:
elif type(value) is str and value.startswith("http"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dito.

Copy link
Owner

@jdoiro3 jdoiro3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing. You can also ignore the PR comment. I'm going to merge this once you use urlparse as @Spacetown suggested.

for index, entry in enumerate(nav):
if isinstance(entry, str):
nav[index] = str(section_name / Path(entry)).replace("\\", "/")
if entry.startswith("http"):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, you can make this one line.

nav[index] = str(section_name / Path(entry)).replace("\\", "/") if not urlparse.some_method(entry) else entry

@greenflowers
Copy link

Hey, I ran into this issue as well. What would be needed to get this fixed. I am happy to provide a PR, with the changes above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants