-
Notifications
You must be signed in to change notification settings - Fork 76
better GitHub links in documentation #156
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6e00a4f
tentative fix
kandersolar d188b7d
fix slash
kandersolar 721c968
include branch logic based on RTD version
kandersolar 197d31c
small improvement
kandersolar c289600
omit GH link element if not building development or master
kandersolar 5320c62
change github link text to reflect the destination branch
kandersolar 5d28604
link changelog page to changelog GH folder instead of the template rs…
kandersolar 7d907ba
bugfix
kandersolar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| {# | ||
|
|
||
| Modify the "Edit on Github" links to handle auto-generated pages in the | ||
| API reference listings. The GH links that sphinx generates by default make | ||
| the assumption that an HTML file comes from an RST file with the same | ||
| filepath, which isn't the case for autogenerated files. | ||
|
|
||
| We need to generate the target URL differently based on the type | ||
| of page. We use the built-in `pagename` variable to determine what | ||
| kind of page this is. `pagename` is the path at the end of the | ||
| URL, without the extension. For instance, | ||
| https://rdtools.rtfd.io/en/latest/generated/rdtools.soiling.soiling_srr.html | ||
| will have pagename = "generated/rdtools.soiling.soiling_srr". | ||
|
|
||
| Note: make_github_url is defined in conf.py | ||
| #} | ||
|
|
||
| {% extends "!breadcrumbs.html" %} | ||
| {% block breadcrumbs_aside %} | ||
| <li class="wy-breadcrumbs-aside"> | ||
| {# Get the appropriate GH link based on this page's name: #} | ||
| {% set target_url = make_github_url(pagename) %} | ||
| {# Create the HTML element with our custom GH link: #} | ||
| <a href="{{ target_url }}" class="fa fa-github">View on Github</a> | ||
| </li> | ||
| {% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's be explicit about all the cases here. Otherwise, if we change the readthedocs configuration, we could end up with links pointing to development when they shouldn't. Not sure what the correct behavior should be for PR and local builds though. I'd almost rather it be broken than point to the wrong branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handling PR build correctly seems like a huge headache for not much benefit, and I'm not even sure what a local build should point to. What do you think about only generating the link if it's stable/master or latest/development? For other builds it would just omit that HTML element.