Docs update
This commit is contained in:
parent
5ec6eaf7d0
commit
a5faa851e8
11 changed files with 420 additions and 19 deletions
|
@ -17,16 +17,19 @@
|
|||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#
|
||||
# import os
|
||||
# import sys
|
||||
# sys.path.insert(0, os.path.abspath('.'))
|
||||
import sys, os
|
||||
from os.path import relpath, dirname
|
||||
import inspect
|
||||
|
||||
sys.path.insert(0, os.path.abspath('_ext'))
|
||||
sys.path.insert(0, os.path.abspath('../homeassistant'))
|
||||
|
||||
from homeassistant.const import (__version__, __short_version__, PROJECT_NAME,
|
||||
PROJECT_LONG_DESCRIPTION, PROJECT_URL,
|
||||
PROJECT_COPYRIGHT, PROJECT_AUTHOR,
|
||||
PROJECT_GITHUB_USERNAME,
|
||||
PROJECT_GITHUB_REPOSITORY, PYPI_URL,
|
||||
GITHUB_URL)
|
||||
GITHUB_PATH, GITHUB_URL)
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
|
@ -39,8 +42,9 @@ from homeassistant.const import (__version__, __short_version__, PROJECT_NAME,
|
|||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.viewcode',
|
||||
'sphinx_autodoc_typehints',
|
||||
'sphinx.ext.linkcode',
|
||||
'sphinx_autodoc_annotation',
|
||||
'edit_on_github'
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
|
@ -73,6 +77,48 @@ version = __short_version__
|
|||
# The full version, including alpha/beta/rc tags.
|
||||
release = __version__
|
||||
|
||||
code_branch = 'dev' if 'dev' in __version__ else 'master'
|
||||
|
||||
# Edit on Github config
|
||||
edit_on_github_project = GITHUB_PATH
|
||||
edit_on_github_branch = code_branch
|
||||
edit_on_github_src_path = 'docs/source/'
|
||||
|
||||
def linkcode_resolve(domain, info):
|
||||
"""
|
||||
Determine the URL corresponding to Python object
|
||||
"""
|
||||
if domain != 'py':
|
||||
return None
|
||||
modname = info['module']
|
||||
fullname = info['fullname']
|
||||
submod = sys.modules.get(modname)
|
||||
if submod is None:
|
||||
return None
|
||||
obj = submod
|
||||
for part in fullname.split('.'):
|
||||
try:
|
||||
obj = getattr(obj, part)
|
||||
except:
|
||||
return None
|
||||
try:
|
||||
fn = inspect.getsourcefile(obj)
|
||||
except:
|
||||
fn = None
|
||||
if not fn:
|
||||
return None
|
||||
try:
|
||||
source, lineno = inspect.findsource(obj)
|
||||
except:
|
||||
lineno = None
|
||||
if lineno:
|
||||
linespec = "#L%d" % (lineno + 1)
|
||||
else:
|
||||
linespec = ""
|
||||
fn = relpath(fn, start='../')
|
||||
|
||||
return '{}/blob/{}/{}{}'.format(GITHUB_URL, code_branch, fn, linespec)
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#
|
||||
|
@ -148,13 +194,6 @@ html_theme_options = {
|
|||
'travis_button': True,
|
||||
'touch_icon': 'logo-apple.png',
|
||||
# 'fixed_sidebar': True, # Re-enable when we have more content
|
||||
'extra_nav_links': {
|
||||
'🏡 Homepage': PROJECT_URL,
|
||||
'📌 Community Forums': 'https://community.home-assistant.io',
|
||||
'💬 Gitter': 'https://gitter.im/home-assistant/home-assistant',
|
||||
'🚀 GitHub': GITHUB_URL,
|
||||
'💾 Download Releases': PYPI_URL,
|
||||
}
|
||||
}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
|
@ -208,9 +247,11 @@ html_use_smartypants = True
|
|||
html_sidebars = {
|
||||
'**': [
|
||||
'about.html',
|
||||
'navigation.html',
|
||||
'relations.html',
|
||||
'links.html',
|
||||
'searchbox.html',
|
||||
'sourcelink.html',
|
||||
'navigation.html',
|
||||
'relations.html'
|
||||
]
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue