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

Some external functions / classes don't resolve into links #113

Closed
adrn opened this issue Mar 26, 2016 · 6 comments
Closed

Some external functions / classes don't resolve into links #113

adrn opened this issue Mar 26, 2016 · 6 comments

Comments

@adrn
Copy link
Contributor

adrn commented Mar 26, 2016

For example, in this example in the sphinx-gallery gallery, np.linspace does not become a link, but all other numpy functions do.

@lesteve
Copy link
Member

lesteve commented Mar 29, 2016

Yeah this limitation is kind of known but I don't think anyone has had the bandwith to look into it in more details ... Insights or PR welcome :-) !

@dfroger
Copy link

dfroger commented May 14, 2016

I'm trying to fix this issue too. Here is where I am.

For the example, the code in docs_resolv.py behaves like this snippet:

import re

names = ['<span>np</span>', '<span>plt</span>', '<span>pd</span>']

expr = re.compile(r'(?<!\.)\b' +  '|'.join(re.escape(name) for name in names))

lines = ['<span>x</span> <span>np</span> <span>x</span>',
         '<span>x</span> <span>plt</span> <span>x</span>',
         '<span>x</span> <span>pd</span> <span>x</span>']

for line in lines:
    print(expr.search(line) is not None)

which prints:

False
True
True

In expr, word boundary \b apply only to first name of the names list. As \b does not matches < (first character in name), value name is not replaced to add <a href

The regular expression seems to want to work on something like np.linspace, where (?<!\.) prevent matching xxx.np.linspace, and \b to prevent matching xxxnp.linspace.

However, the regular expression is not used on something like np.linspace, but on:

<span class="n">np</span><span class="o">.</span><span class="n">linspace</span>

@lesteve
Copy link
Member

lesteve commented Nov 9, 2016

@dfroger this seems like a good lead, sorry not to have answered sooner. Have you had the chance to get to the bottom of this?

@lesteve
Copy link
Member

lesteve commented Mar 20, 2017

I think #214 fixed the regex problem mentioned by @dfroger in #113 (comment). The remaining problems I spotted were due to some information missing from searchindex.js. I don't know much about how searchindex.js is built and I am not sure whether our logic for making sense of searchindex.js is to blame.

@larsoner
Copy link
Contributor

larsoner commented Feb 9, 2018

This issue can be closed, this should have been fixed by the PR that switched to using intersphinx

@lesteve
Copy link
Member

lesteve commented Feb 12, 2018

Thanks!

@lesteve lesteve closed this as completed Feb 12, 2018
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

No branches or pull requests

4 participants