Skip to content

Instantly share code, notes, and snippets.

@shimizukawa shimizukawa/conf.py
Created Oct 30, 2012

Embed
What would you like to do?
Sphinx: Link to outer non-sphinx document by using intersphinx. https://groups.google.com/d/topic/sphinx-users/P_FolrZVoNg/discussion
extensions = ['sphinx.ext.intersphinx']
intersphinx_mapping = {
'javaapi': ('http://api.example.com/', 'javaapi.inv'),
}
# -*- coding: utf-8 -*-
import zlib
inventory_header = u'''\
# Sphinx inventory version 2
# Project: javaapi
# Version: 2.0
# The remainder of this file is compressed with zlib.
'''.encode('utf-8')
inventory_payload = u'''\
api1 std:label -1 api.html#api1 API 1
'''.encode('utf-8')
# inventory_payload lines spec:
# name domainname:type priority uri dispname
#
# * `name` -- fully qualified name
# * `dispname` -- name to display when searching/linking
# * `type` -- object type, a key in ``self.object_types``
# * `docname` -- the document where it is to be found
# * `anchor` -- the anchor name for the object
# * `priority` -- how "important" the object is (determines placement in search results)
#
# - 1: default priority (placed before full-text matches)
# - 0: object is important (placed before default-priority objects)
# - 2: object is unimportant (placed after full-text matches)
# - -1: object should not show up in search at all
#
inventory = inventory_header + zlib.compress(inventory_payload)
open('javaapi.inv','wb').write(inventory)
<div class="section" id="example-link-to-outer-non-sphinx-by-using-intersphinx">
<h1>Example: Link to outer non-sphinx by using intersphinx<a class="headerlink" href="#example-link-to-outer-non-sphinx-by-using-intersphinx" title="Permalink to this headline">ツカ</a></h1>
<p><a class="reference external" href="http://api.example.com/api.html#api1" title="(in javaapi v2.0)"><em class="xref std std-ref">Java API 1</em></a></p>
</div>
Example: Link to outer non-sphinx by using intersphinx
==========================================================================
:ref:`Java API 1 <javaapi:api1>`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.