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 the edit this page link #4320

Merged
merged 1 commit into from
Apr 29, 2023
Merged

Fix the edit this page link #4320

merged 1 commit into from
Apr 29, 2023

Conversation

akaszynski
Copy link
Member

@akaszynski akaszynski commented Apr 23, 2023

Inspired by ansys/pymapdl#2012, this PR fixes the "Edit this page" button, which is currently overall because of the move from "doc/" to "doc/source".

Moreover, it also provides correct links for our:

  • Gallery examples
  • Autosummary examples

These were broken even before the documentation move.


@germa89 and @jorgepiloto, I suggest that we implement it this way, it's guarenteed to get to the right source file location rather than implementing a search in GitHub.

@github-actions github-actions bot added the documentation Anything related to the documentation/website label Apr 23, 2023
@codecov
Copy link

codecov bot commented Apr 23, 2023

Codecov Report

Merging #4320 (68f6999) into main (f7510a7) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #4320   +/-   ##
=======================================
  Coverage   95.78%   95.78%           
=======================================
  Files          97       97           
  Lines       20762    20774   +12     
=======================================
+ Hits        19886    19898   +12     
  Misses        876      876           

@jorgepiloto
Copy link
Contributor

Thanks for the ping, @akaszynski. This is something we need to stream up to our repositories.

@germa89
Copy link
Contributor

germa89 commented Apr 24, 2023

To avoid having the search option there are two possibilities:

  • Using GitHub API to get where the function is defined. Actually it cannot be done i believe. Github can only provides files, lines numbers and commits.
  • Using python libraries to retrieve where the object is defined. Problem of this, you need to instantiate the object in order to then use something like func.__module__ and func.__file__. That will probably made the whole documentation building very slow. Further more, the object definition you get when building the object (for instance ansys.mapdl.core.Mapdl.exit might not always match the real object. For instance ansys.mapdl.core.launch_mapdl defined in ansys.mapdl.core.launcher.launch_mapdl.

The whole thing needs careful thinking. It should be possible. But it needs more than what I did in ansys/pymapdl#2012

Temporary alternative, we could maybe link the search to provide directly the first result though. Github search API should provide information enough to directly link the first result of the search.

-- edit --
Realised it is not needed to instantiate each object. But we need to import them though.

@akaszynski
Copy link
Member Author

Temporary alternative, we could maybe link the search to provide directly the first result though. Github search API should provide information enough to directly link the first result of the search.

I think the "edit this page" button should always jump to a github edit page, regardless of if it jumps right to the function or not (which is not available within GitHub's API). Sending them to a search function means that we'll have different behavior depending on if it's an autosummary or not.

Fully agree that it's not a perfect solution, but "edit" seems like it should go to an "edit" page.

Copy link
Member

@banesullivan banesullivan left a comment

Choose a reason for hiding this comment

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

Generally, LGTM!

Haven't given this a thorough review but all looks right to me and agree with conclusions of previous discussions

@akaszynski akaszynski merged commit 6f29990 into main Apr 29, 2023
25 checks passed
@akaszynski akaszynski deleted the docs/fix-edit-this-page branch April 29, 2023 20:02
@akaszynski akaszynski mentioned this pull request Apr 30, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Anything related to the documentation/website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants