intersphinx - local reference

570 views
Skip to first unread message

Matt Rockwell

unread,
Mar 6, 2014, 8:32:09 AM3/6/14
to sphinx...@googlegroups.com
Hello. Thank you for this incredibly useful codeset.

I seek to reference intersphinx objects.inv via local filepath and I am experiencing anomalies which I am unable to figure out. Any assistance would be welcome.

Two distinct projects are subfolders of  the same location, tdoc/tdoc and tdoc/xlist. The build environment is Windows, and v1.2.2 is in use. Intersphinx is enabled in both environments.

Project tdoc/tdoc refers to project tdoc/xlist in tdoc/tdoc/conf.py as follows:
intersphinx_mapping = {'xlist': ('../xlist/_build/html/', None)

Project tdoc/xlist has a label above the root tag:
.. _xone: 

File tdoc/tdoc/index.txt refers to the xsdi
:ref:`xONE <xlist:xone>`

When compiling tdoc/tdoc. the objects.inv is found without issue. 
Running Sphinx v1.2.2
loading pickled environment... done
loading intersphinx inventory from ../xlist/_build/html/objects.inv...
 
Links, however, are not built as expected.  The .. is not interpreted proper in the browser. The HTML <a\> builds as follows:
href="../xlist/_build/html/index.html#xone"

Which from a browser source link of:
file:///C:/Users/Matt/Code/tdoc/tdoc/_build/html/index.html 

...yields in the browser as:
file:///C:/Users/Matt/Code/tdoc/tdoc/_build/xlist/_build/html/index.html#xone

This behavior carries across all tested browsers and is the same if the files are served via HTTP or file-based.

Please advise if there is a way to interlink by relative path over explicit path. 

Thanks for any time and help with this.

Luc Saffre

unread,
Mar 6, 2014, 9:59:59 AM3/6/14
to sphinx...@googlegroups.com
I'd also would be glad to see a working examples for "relative
intersphinx mappings". That is, when maintaining several projects, then
I'd like the local build of one project be able to refer to things in
another local build.

The intersphinx documentation says indeed that "Each target is the base
URI of a foreign Sphinx documentation set and can be a local path or an
HTTP URI". Unformtunately it does not speak about relative and absolute
paths.

I guess that this would require to put the build/html directories of all
projects under a common root directory, and that they have the same
relative position when being published on a web server.

Is there anybody here who does something like this?

Luc


On 06/03/14 15:32, Matt Rockwell wrote:
> Hello. Thank you for this incredibly useful codeset.
>
> I seek to reference intersphinx objects.inv via local filepath and I am
> experiencing anomalies which I am unable to figure out. Any assistance
> would be welcome.
>
> Two distinct projects are subfolders of the same location, /tdoc/tdoc/
> and /tdoc/xlist/. The build environment is Windows, and v1.2.2 is in
> use. Intersphinx is enabled in both environments.
>
> Project /tdoc///tdoc /refers to project /tdoc/xlist/ in
> /tdoc/tdoc/conf.py/ as follows:
>
> *intersphinx_mapping = {'xlist': ('../xlist/_build/html/', None)*
>
>
> Project/tdoc/xlist/ has a label above the root tag:
>
> *.. _xone: *
>
>
> File /tdoc/tdoc/index.txt/ refers to the xsdi
>
> *:ref:`xONE <xlist:xone>`*
>
>
> When compiling /tdoc/tdoc/. the *objects.inv* is found without issue.
>
> Running Sphinx v1.2.2
> loading pickled environment... done
> loading intersphinx inventory from *../xlist/_build/html/objects.inv...*
>
>
> Links, however, are not built as expected. The .. is not interpreted
> proper in the browser. The HTML <a\> builds as follows:
>
> href="../xlist/_build/html/index.html#xone"
>
>
> Which from a browser source link of:
>
> file:///C:/Users/Matt/Code/tdoc/tdoc/_build/html/index.html
>
>
> ...yields in the browser as:
>
> file:///C:/Users/Matt/Code/tdoc/tdoc/*__build/xlist/_build/html_*/index.html#xone
>
>
> This behavior carries across all tested browsers and is the same if the
> files are served via HTTP or file-based.
>
> Please advise if there is a way to interlink by relative path over
> explicit path.
>
> Thanks for any time and help with this.
>
> --
> You received this message because you are subscribed to the Google
> Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sphinx-users...@googlegroups.com
> <mailto:sphinx-users...@googlegroups.com>.
> To post to this group, send email to sphinx...@googlegroups.com
> <mailto:sphinx...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/sphinx-users.
> For more options, visit https://groups.google.com/groups/opt_out.

E. Kelly

unread,
Jan 18, 2017, 6:12:58 PM1/18/17
to sphinx-users
It looks like there were fixes submitted around using relative links, but I still can't figure out how to make it work.... 

I am running 1.4.8, and it looks like changes were merged for 1.4.7  (https://github.com/sphinx-doc/sphinx/pull/2056 and https://github.com/sphinx-doc/sphinx/issues/1060). I might have a syntax error. 

Can someone refer me to an example intersphinx_mapping configuration that uses relative links? 

Or is there better documentation about how to write them somewhere? 
Reply all
Reply to author
Forward
0 new messages