From 646ef049b46a9f61748d663edb40a47fe1fc08d4 Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Wed, 6 Apr 2016 12:14:30 -0700 Subject: [PATCH] [docs] Adds sphinx.ext.viewcode --- docs/conf.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 75ec3aff..39052913 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -31,6 +31,22 @@ extensions = [ 'githubsphinx', ] +LINKCODE_URL = 'https://github.com/{proj}/tree/{branch}/{filename}.py' +GITHUB_PROJECT = 'celery/kombu' +GITHUB_BRANCH = 'master' + + +def linkcode_resolve(domain, info): + if domain != 'py' or not info['module']: + return + filename = info['module'].replace('.', '/') + return LINKCODE_URL.format( + proj=GITHUB_PROJECT, + branch=GITHUB_BRANCH, + filename=filename, + ) + + # Add any paths that contain templates here, relative to this directory. templates_path = ['.templates'] @@ -89,7 +105,7 @@ html_sidebars = { # ## Issuetracker -github_project = 'celery/kombu' +github_project = GITHUB_PROJECT intersphinx_mapping = { 'python': ('http://docs.python.org/dev', None),