2013-08-07 16:40:18 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
2013-09-01 17:56:17 +02:00
|
|
|
# TRIQS documentation build configuration file
|
2013-08-07 16:40:18 +02:00
|
|
|
|
2016-02-12 10:58:11 +01:00
|
|
|
import sys
|
2020-06-08 20:49:06 +02:00
|
|
|
sys.path.insert(0, "@CMAKE_CURRENT_SOURCE_DIR@/sphinxext")
|
2020-06-10 17:45:53 +02:00
|
|
|
sys.path.insert(0, "@CMAKE_CURRENT_SOURCE_DIR@/sphinxext/numpydoc")
|
2018-09-10 10:56:37 +02:00
|
|
|
sys.path.insert(0, "@CMAKE_BINARY_DIR@/python")
|
2016-02-12 10:58:11 +01:00
|
|
|
|
2022-02-16 15:16:49 +01:00
|
|
|
# exclude these folders from scanning by sphinx
|
|
|
|
exclude_patterns = ['_templates']
|
|
|
|
|
2013-09-01 17:56:17 +02:00
|
|
|
extensions = ['sphinx.ext.autodoc',
|
|
|
|
'sphinx.ext.mathjax',
|
|
|
|
'sphinx.ext.intersphinx',
|
2015-03-12 00:01:12 +01:00
|
|
|
'sphinx.ext.doctest',
|
|
|
|
'sphinx.ext.todo',
|
|
|
|
'sphinx.ext.viewcode',
|
|
|
|
'sphinx.ext.autosummary',
|
2019-12-04 01:29:09 +01:00
|
|
|
'sphinx.ext.githubpages',
|
2020-06-08 20:49:06 +02:00
|
|
|
'sphinx_autorun',
|
2021-08-02 19:43:07 +02:00
|
|
|
'nbsphinx',
|
2021-08-18 22:00:28 +02:00
|
|
|
'myst_parser',
|
2020-06-10 17:45:53 +02:00
|
|
|
'matplotlib.sphinxext.plot_directive',
|
|
|
|
'nbsphinx',
|
|
|
|
'IPython.sphinxext.ipython_console_highlighting',
|
|
|
|
'numpydoc']
|
2013-08-07 16:40:18 +02:00
|
|
|
|
2021-08-18 22:00:28 +02:00
|
|
|
myst_enable_extensions = [
|
|
|
|
"amsmath",
|
|
|
|
"colon_fence",
|
|
|
|
"deflist",
|
|
|
|
"dollarmath",
|
|
|
|
"html_admonition",
|
|
|
|
"html_image",
|
|
|
|
"linkify",
|
|
|
|
"replacements",
|
|
|
|
"smartquotes",
|
|
|
|
"substitution",
|
|
|
|
"tasklist",
|
|
|
|
]
|
|
|
|
|
|
|
|
# The name of the Pygments (syntax highlighting) style to use.
|
|
|
|
pygments_style = 'sphinx'
|
|
|
|
|
2013-08-07 16:40:18 +02:00
|
|
|
source_suffix = '.rst'
|
|
|
|
|
2022-02-16 15:16:49 +01:00
|
|
|
# Turn on sphinx.ext.autosummary
|
|
|
|
autosummary_generate = True
|
|
|
|
autosummary_imported_members=False
|
|
|
|
|
2021-09-17 20:24:22 +02:00
|
|
|
project = 'TRIQS DFTTools'
|
2020-06-10 17:45:53 +02:00
|
|
|
version = '@PROJECT_VERSION@'
|
|
|
|
|
2022-03-10 19:25:16 +01:00
|
|
|
# this makes the current project version available as var in every rst file
|
|
|
|
rst_epilog = """
|
|
|
|
.. |PROJECT_VERSION| replace:: {version}
|
|
|
|
""".format(
|
|
|
|
version = version,
|
|
|
|
)
|
|
|
|
|
2021-09-17 20:24:22 +02:00
|
|
|
copyright = '2011-2021'
|
2013-08-07 16:40:18 +02:00
|
|
|
|
2020-08-10 17:07:05 +02:00
|
|
|
mathjax_path = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=default"
|
2020-06-10 17:45:53 +02:00
|
|
|
templates_path = ['@CMAKE_CURRENT_SOURCE_DIR@/_templates']
|
2013-08-07 16:40:18 +02:00
|
|
|
|
2021-08-02 19:43:07 +02:00
|
|
|
# this requires the sphinx_rtd_theme to be installed via pip
|
|
|
|
html_theme = 'sphinx_rtd_theme'
|
2021-08-18 22:00:28 +02:00
|
|
|
# this loads the custom css file to change the page width
|
|
|
|
html_style = 'css/custom.css'
|
|
|
|
|
|
|
|
#html_favicon = '@CMAKE_CURRENT_SOURCE_DIR@/logos/favicon.ico'
|
|
|
|
#html_logo = '@CMAKE_CURRENT_SOURCE_DIR@/logos/logo.png'
|
2021-08-02 19:43:07 +02:00
|
|
|
|
|
|
|
# options for the the rtd theme
|
|
|
|
html_theme_options = {
|
|
|
|
'logo_only': False,
|
|
|
|
'display_version': True,
|
|
|
|
'prev_next_buttons_location': 'bottom',
|
|
|
|
'style_external_links': False,
|
|
|
|
'vcs_pageview_mode': '',
|
2021-08-18 22:00:28 +02:00
|
|
|
'style_nav_header_background': '#7E588A',
|
2021-08-02 19:43:07 +02:00
|
|
|
# Toc options
|
|
|
|
'collapse_navigation': False,
|
|
|
|
'sticky_navigation': True,
|
2022-03-01 23:51:39 +01:00
|
|
|
'navigation_depth': 4,
|
2021-08-02 19:43:07 +02:00
|
|
|
'includehidden': True,
|
|
|
|
'titles_only': False
|
|
|
|
}
|
|
|
|
|
2013-09-01 17:56:17 +02:00
|
|
|
html_show_sphinx = False
|
2021-08-02 19:43:07 +02:00
|
|
|
|
2021-09-17 20:24:22 +02:00
|
|
|
html_context = {'header_title': 'TRIQS DFTTools'}
|
2021-08-02 19:43:07 +02:00
|
|
|
|
2020-06-10 17:45:53 +02:00
|
|
|
html_static_path = ['@CMAKE_CURRENT_SOURCE_DIR@/_static']
|
2013-09-04 16:54:45 +02:00
|
|
|
html_sidebars = {'index': ['sideb.html', 'searchbox.html']}
|
2013-09-01 17:56:17 +02:00
|
|
|
|
2020-06-10 17:45:53 +02:00
|
|
|
htmlhelp_basename = '@PROJECT_NAME@doc'
|
2013-09-01 17:56:17 +02:00
|
|
|
|
2020-06-10 22:46:58 +02:00
|
|
|
intersphinx_mapping = {'python': ('https://docs.python.org/3.8', None), 'triqslibs': ('https://triqs.github.io/triqs/latest', None)}
|
2021-08-02 19:43:07 +02:00
|
|
|
|
|
|
|
# open links in new tab instead of same window
|
|
|
|
from sphinx.writers.html import HTMLTranslator
|
|
|
|
from docutils import nodes
|
|
|
|
from docutils.nodes import Element
|
|
|
|
|
|
|
|
class PatchedHTMLTranslator(HTMLTranslator):
|
|
|
|
|
|
|
|
def visit_reference(self, node: Element) -> None:
|
|
|
|
atts = {'class': 'reference'}
|
|
|
|
if node.get('internal') or 'refuri' not in node:
|
|
|
|
atts['class'] += ' internal'
|
|
|
|
else:
|
|
|
|
atts['class'] += ' external'
|
|
|
|
# ---------------------------------------------------------
|
|
|
|
# Customize behavior (open in new tab, secure linking site)
|
|
|
|
atts['target'] = '_blank'
|
|
|
|
atts['rel'] = 'noopener noreferrer'
|
|
|
|
# ---------------------------------------------------------
|
|
|
|
if 'refuri' in node:
|
|
|
|
atts['href'] = node['refuri'] or '#'
|
|
|
|
if self.settings.cloak_email_addresses and atts['href'].startswith('mailto:'):
|
|
|
|
atts['href'] = self.cloak_mailto(atts['href'])
|
|
|
|
self.in_mailto = True
|
|
|
|
else:
|
|
|
|
assert 'refid' in node, \
|
|
|
|
'References must have "refuri" or "refid" attribute.'
|
|
|
|
atts['href'] = '#' + node['refid']
|
|
|
|
if not isinstance(node.parent, nodes.TextElement):
|
|
|
|
assert len(node) == 1 and isinstance(node[0], nodes.image)
|
|
|
|
atts['class'] += ' image-reference'
|
|
|
|
if 'reftitle' in node:
|
|
|
|
atts['title'] = node['reftitle']
|
|
|
|
if 'target' in node:
|
|
|
|
atts['target'] = node['target']
|
|
|
|
self.body.append(self.starttag(node, 'a', '', **atts))
|
|
|
|
|
|
|
|
if node.get('secnumber'):
|
|
|
|
self.body.append(('%s' + self.secnumber_suffix) %
|
|
|
|
'.'.join(map(str, node['secnumber'])))
|
|
|
|
|
|
|
|
def setup(app):
|
|
|
|
app.set_translator('html', PatchedHTMLTranslator)
|