Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix front page links and change check_links #318

Merged
merged 4 commits into from
May 6, 2022

Conversation

noursaidi
Copy link
Collaborator

@noursaidi noursaidi commented Apr 29, 2022

  • change check_links to work on hosted (GitHub pages or GitHub) links
  • fix check_links so it works when there are two links on the same line
  • change front page links to rendered version

bin/check_links Outdated
# Rewrite hosted links (e.g. github pages) to local
rewritten_link = blank_regex_substitutions(link, HOSTED_GITHUB, HOSTED_GITHUB_PAGES)

if not re.match('https?://', rewritten_link):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Optional: My personal preference is re.search and ^ in front of the regex because it's more clear, and also consistent with other re functions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed all re.match to re.search and added ^ to start of regex

bin/check_links Outdated
@@ -8,6 +8,8 @@ import glob
import re
import os

HOSTED_GITHUB_PAGES = r"https?:\/\/faucetsdn.github.io\/udmi\/"
Copy link
Collaborator

Choose a reason for hiding this comment

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

For consistency I think it should be r'' ? (single quote)

I think both patterns should have a ^ in front and . for periods in the hostname?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changes made

@@ -60,12 +80,24 @@ def check_links(file_path):

if not os.path.exists(resolved_path):
failing_links.append((file_path, 'link', link))

else:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please add to the function docstring what we are accomplishing with this change. i.e. when do we need this to occur?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Extended function docstring to describe new behaviour and added to incline comments

Copy link
Collaborator

@johnrandolph johnrandolph left a comment

Choose a reason for hiding this comment

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

Did you submit your changes?

@noursaidi
Copy link
Collaborator Author

@johnrandolph yes, there's a "changes from all commits" button on the files changed page which shows all changes, it seems to default to original commit for some reason. Let me know if I've missed something

@noursaidi noursaidi merged commit 6777342 into faucetsdn:master May 6, 2022
@noursaidi noursaidi deleted the docs4fix branch September 20, 2022 13:55
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.

None yet

2 participants