Commit 74eba3e7 authored by Tiago Peixoto's avatar Tiago Peixoto

Documentation updates

parent 8a8bb41c
......@@ -32,7 +32,8 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest',
'sphinx.ext.intersphinx', 'mathjax', 'sphinx.ext.autosummary',
'numpydoc',
'sphinx.ext.extlinks',
'sphinx.ext.viewcode'
'sphinx.ext.viewcode',
'extlinks_fancy',
#'sphinx.ext.linkcode'
#'matplotlib.sphinxext.plot_directive'
]
......@@ -180,10 +181,13 @@ intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
'ipython': ('http://ipython.org/ipython-doc/stable/', None),
'panda': ('http://pandas.pydata.org/pandas-docs/stable/', None)}
extlinks = {'ticket': ('http://graph-tool.skewed.de/tickets/ticket/%s',
'ticket '),
'doi': ('http://dx.doi.org/%s', 'DOI: '),
'arxiv': ('http://arxiv.org/abs/%s', 'arXiv: ')}
extlinks_fancy = {'ticket': (['https://graph-tool.skewed.de/tickets/ticket/{0}'],
['ticket {0}']),
'doi': (['https://dx.doi.org/{0}',
'https://sci-hub.cc/{0}',
'https://scihub22266oqcxt.onion.link/{0}'],
['DOI: {0}', "sci-hub", "@tor"]),
'arxiv': (['https://arxiv.org/abs/{0}'], ['arXiv: {0}'])}
# def process_docstring(app, what, name, obj, options, lines):
......@@ -202,6 +206,7 @@ plot_rcparams = pyenv.rcParams
#plot_pre_code = open("pyenv.py").read()
autodoc_default_flags = ['members', 'undoc-members']
autosummary_gerenerate = True
numpydoc_show_class_members = False
autodoc_docstring_signature = False
autodoc_member_order = 'bysource'
......
This diff is collapsed.
# -*- coding: utf-8 -*-
"""
Extension to save typing and prevent hard-coding of base URLs in the reST
files.
This adds a new config value called ``extlinks_fancy`` that is created like this::
extlinks_fancy = {'exmpl': ('http://example.com/{0}.html', "Example {0}"), ...}
You can also give an explicit caption, e.g. :exmpl:`Foo <foo>`.
:copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from six import iteritems
from docutils import nodes, utils
import sphinx
from sphinx.util.nodes import split_explicit_title
def make_link_role(base_urls, prefixes):
def role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
text = utils.unescape(text)
has_explicit_title, title, part = split_explicit_title(text)
pnodes = []
for base_url, prefix in zip(base_urls, prefixes):
full_url = base_url.format(part)
if not has_explicit_title:
if prefix is None:
title = full_url
else:
title = prefix.format(part)
ref = nodes.reference(title, title, internal=False, refuri=full_url)
if len(pnodes) == 1:
pnodes.append(nodes.Text(" ["))
if len(pnodes) > 2:
pnodes.append(nodes.Text(", "))
pnodes.append(ref)
if len(base_urls) > 1:
pnodes.append(nodes.Text("]"))
return pnodes, []
return role
def setup_link_roles(app):
for name, (base_urls, prefixes) in iteritems(app.config.extlinks_fancy):
app.add_role(name, make_link_role(base_urls, prefixes))
def setup(app):
app.add_config_value('extlinks_fancy', {}, 'env')
app.connect('builder-inited', setup_link_roles)
return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
@import url("flasky.css");
table.docutils {
margin-left:1em;
margin-right:1em;
/* margin-left:1em; */
/* margin-right:1em; */
margin: auto;
border: 0px;
}
......@@ -160,4 +161,15 @@ pre {
.xref.docutils.literal
{
background-color: inherit;
}
div.sphinxsidebar
{
position: sticky;
top: 0px;
min-width: 310px;
}
div.bodywrapper {
margin: 0 0 0 310px;
}
\ No newline at end of file
......@@ -260,7 +260,7 @@ Examples
Contents
++++++++
========
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment