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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify Target of reference_url
#947
Comments
I think the resolution happens somewhere in this class: sphinx-gallery/sphinx_gallery/docs_resolv.py Line 127 in afde49f
Debugging is not easy, and the code is not so easy to follow, but please do give it a shot! |
Thank you @larsoner. After playing around a little I figured that somehow this line causes the problem: first, second = cobj['module_short'], cobj['name'] If I change it to first, second = cobj['module'], cobj['name'] it solves my problem and does not lead to an error. Do you happen to know why it is |
Not offhand, I have to work to re-understand what that code does every time I need to change it :( |
I thought so. 馃槃 That is how I usually feel if I have to re-examine my code The question is if multiple user have the same problem or if it is just me... I could think of an option which you can set in |
It's likely that other users have this problem, too. But it's tough to know if changing it will break things for them... What are |
E.g. it is: {..., 'module': 'osaft.solutions.yosioka1955.arf', 'module_short': 'osaft.solutions.yosioka1955',...} instead of |
I think Does the problem go away if you move the We can start thinking about workarounds, though. One option would be to have a |
I put all our base classes one folder deeper as you suggested to check if that would solve the problem. However it does not. 馃槥 I changed the links in all python as well as all rst files and checked with our unittests that the change of namespace was done properly. I built then the documentation by running Regarding you workarounds, I will need some more time to understand what you mean 馃槃 I happy to help then with possible implementations. |
It feels like that somehow SG is looking for the superclasses instead of the current one. I tried the following: I removed all Regarding your suggestions for a workaround. I think it should then also support wildecards such that you can do Would it not just work to have |
This is very strange. Before we continue, does the page of the super class in the API docs actually have the method? If not, you might just need
We usually support regex (or list of regex that we internally concatenate to a single regex)
It might. But I suspect this will lead to problems with other classes then not getting their methods documented properly. |
That was a bad explanation from my side. I tested it again it is like that: In this example I create a class in line 71 with yosioka = osaft.yosioka1955.ARF(
frequency=f,
radius=R_0,
rho_s=rho_s, c_s=c_s,
rho_f=rho_f, c_f=c_f,
p_0=p_0,
wave_type=wave_type,
position=position,
) If I click on But, clicking on Sorry the incomplete explanation! I created a pullrequest where I implemented it with this in mind
and it works for our specific example. At least for our documentation I have not found a place yet where the documentation leads to wrong pages. |
If it simplifies things a lot then we can just stick with a bool. But generally it's only an extra line or two to add list-of-regex support, and easy enough for people to do |
Mhm. I am happy to adapt to your changes. In the end, you have more experience what is the style of SG. As said, I started an implementation in #950 and if could point me please to the portion I would need to change/add, I am happy to do so. |
@larsoner I wanted to ask if and how we could progress with this issue here. |
To make it easy I would make it just be a single regex to use like |
Thanks for your fast reply. If we do a binary options then I could just do ...
'prefer_full_module': False,
... and the user can set it to At the moment I implemented it in #950 as for pattern in self.config['prefer_full_module']:
if re.search(pattern, full_name):
use_full_module = True
break If we the binary option then I would change it to ...
use_full_module = self.config['prefer_full_module']
... Did I understand your suggestions in the right way? |
This seems fine to me! |
All right then. I'll add some documentation about it and inform you when all is ready. I appreciate all your time and the suggestions 馃憤馃徑 |
I added now some documentation text. However, it is not easy to explain what it actually does, so I added a link to this issue giving (hopefully) more context. |
Hi @larsoner, I just wanted to check in if my edits are fine, If there are any suggestions you have for me I happy to work in it. Thanks in advance. |
Hi there,
we are using sphinx-gallery for our OSAFT project and are very happy 馃樃
I wanted now to add the option of
reference_url
and did so by addingFor some reasons the inheritance diagram for the classes of interest look like this:
The common feature is that all
ARF
classes inherit fromBaseARF
. The issue that I have is visible here. In the code block where it readsDoes a "click" on
osaft.yosioka1955.ARF
,osaft.gorkov1962.ARF
, orosaft.settnes2012.ARF
transfer you to the documentation page ofosaft.solutions.BaseARF
instead of the anticipatedosaft.solutions.yosioka1955.ARF
.I hope that I expressed the issue well enough! Is there a possibility to set the depth of the reference or similar.
Otherwise, I am also happy to add a patch enabling it if you could point me to the lines of code where this would need to be implemented.
Than you very much in advance,
Christoph
The text was updated successfully, but these errors were encountered: