|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | # |
3 | 3 | # Configuration file for the Sphinx documentation builder. |
| 4 | +# |
| 5 | +# This file does only contain a selection of the most common options. For a |
| 6 | +# full list see the documentation: |
| 7 | +# http://www.sphinx-doc.org/en/master/config |
4 | 8 |
|
5 | 9 | # -- Path setup -------------------------------------------------------------- |
6 | 10 |
|
| 11 | +# If extensions (or modules to document with autodoc) are in another directory, |
| 12 | +# add these directories to sys.path here. If the directory is relative to the |
| 13 | +# documentation root, use os.path.abspath to make it absolute, like shown here. |
| 14 | +# |
7 | 15 | import os |
8 | 16 | import sys |
9 | 17 | import sphinx_rtd_theme |
10 | 18 |
|
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
11 | 23 | # -- Project information ----------------------------------------------------- |
12 | 24 |
|
13 | 25 | project = 'Thermobar' |
|
17 | 29 | # The short X.Y version |
18 | 30 | version = '' |
19 | 31 | # The full version, including alpha/beta/rc tags |
20 | | -release = 'v.0' |
| 32 | +release = '0' |
| 33 | + |
21 | 34 |
|
22 | 35 | # If extensions (or modules to document with autodoc) are in another directory, |
23 | | -# add these directories to sys.path here. |
| 36 | +# add these directories to sys.path here. If the directory is relative to the |
| 37 | +# documentation root, use os.path.abspath to make it absolute, like shown here. |
24 | 38 | sys.path.insert(0, os.path.abspath('..')) |
25 | 39 |
|
26 | 40 | # -- General configuration --------------------------------------------------- |
27 | 41 |
|
28 | | -extensions = [ |
29 | | - "sphinx_rtd_theme", |
| 42 | +# If your documentation needs a minimal Sphinx version, state it here. |
| 43 | +# |
| 44 | +# needs_sphinx = '1.0' |
| 45 | + |
| 46 | +# Add any Sphinx extension module names here, as strings. They can be |
| 47 | +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 48 | +# ones. |
| 49 | +extensions = ["sphinx_rtd_theme", |
30 | 50 | 'sphinx.ext.autodoc', |
31 | 51 | 'sphinx.ext.autosummary', |
32 | 52 | 'sphinx.ext.intersphinx', |
| 53 | + #'sphinx.ext.pngmath',\ |
33 | 54 | 'sphinx.ext.napoleon', |
34 | 55 | 'sphinx.ext.mathjax', |
35 | 56 | 'sphinx.ext.viewcode', |
36 | 57 | 'IPython.sphinxext.ipython_directive', |
37 | 58 | 'IPython.sphinxext.ipython_console_highlighting', |
| 59 | + #'numpydoc', |
38 | 60 | 'nbsphinx', |
39 | 61 | 'sphinx.ext.viewcode', |
40 | 62 | 'sphinxcontrib.bibtex', |
41 | 63 | ] |
42 | | - |
43 | | -bibtex_bibfiles = ['references.bib'] |
| 64 | +bibtex_bibfiles=['references.bib'] |
44 | 65 | bibtex_reference_style = 'author_year' |
45 | 66 |
|
46 | | -# --- RTD / GitHub context for nbsphinx links -------------------------------- |
47 | 67 |
|
48 | | -on_rtd = os.environ.get('READTHEDOCS', '') == 'True' |
49 | 68 |
|
50 | | -# Use the actual ref RTD is building (branch/tag/commit), |
51 | | -# fall back to 'main' when building locally. |
52 | | -github_ref = os.environ.get('READTHEDOCS_GIT_IDENTIFIER', 'main') if on_rtd else 'main' |
| 69 | +## Erics nb sphinx |
53 | 70 |
|
54 | | -html_context = { |
55 | | - 'READTHEDOCS': on_rtd, |
56 | | - 'github_version': github_ref, |
57 | | -} |
| 71 | +# This is processed by Jinja2 and inserted before each notebook |
| 72 | +# Some change in dependencies made us need to replace `var` with |
| 73 | +# `env.config.html_context['var']`. |
58 | 74 |
|
59 | | -# --- nbsphinx prolog (adds the banner + buttons) ---------------------------- |
60 | 75 |
|
61 | 76 | nbsphinx_prolog = r""" |
62 | | -{% set docname = 'docs/' + env.doc2path(env.docname, base=None) %} |
63 | | -{% set git_ref = env.config.html_context.get('github_version', 'main') %} |
| 77 | +{% set docname = 'docs' / env.doc2path(env.docname, base=None) %} |
| 78 | +{% set git_ref = 'main' %} |
64 | 79 |
|
65 | 80 | .. raw:: html |
66 | 81 |
|
67 | 82 | <div class="admonition note"> |
68 | | - <p> |
69 | | - This page was generated from |
70 | | - <a class="reference external" |
71 | | - href="https://github.com/PennyWieser/Thermobar/blob/{{ git_ref|e }}/{{ docname|e }}"> |
72 | | - {{ docname|e }} |
73 | | - </a>. |
74 | | - </p> |
75 | | - <p> |
76 | | - Interactive online version: |
77 | | - <a class="reference external" |
78 | | - href="https://mybinder.org/v2/gh/PennyWieser/Thermobar/{{ git_ref|e }}?filepath={{ docname|e }}"> |
79 | | - <img alt="Binder badge" |
80 | | - src="https://mybinder.org/badge_logo.svg" |
81 | | - style="vertical-align:text-bottom"> |
82 | | - </a> |
83 | | - </p> |
84 | | - <p> |
85 | | - <a class="reference download internal" download="" |
86 | | - href="https://github.com/PennyWieser/Thermobar/raw/{{ git_ref|e }}/{{ docname|e }}"> |
87 | | - <code class="xref download docutils literal notranslate"> |
88 | | - <span class="pre">Python</span> |
89 | | - <span class="pre">Notebook</span> |
90 | | - <span class="pre">Download</span> |
91 | | - </code> |
92 | | - </a> |
| 83 | + <p>This page was generated from |
| 84 | + <a class="reference external" href="https://github.com/PennyWieser/Thermobar/blob/{{ git_ref|e }}/{{ docname|e }}">{{ docname|e }}</a>. |
| 85 | +
|
| 86 | + Interactive online version: |
| 87 | + <a href="https://mybinder.org/v2/gh/PennyWieser/Thermobar/{{ git_ref|e }}?filepath={{ docname|e }}"><img alt="Binder badge" src="https://mybinder.org/badge_logo.svg" style="vertical-align:text-bottom"></a>. |
| 88 | + </p> |
| 89 | + <p> |
| 90 | + <a class="reference download internal" download="" href="https://github.com/PennyWieser/Thermobar/blob/{{ git_ref|e }}/{{ docname|e }}"><code class="xref download docutils literal notranslate"><span class="pre">Python</span> <span class="pre">Notebook</span> <span class="pre">Download</span></code></a> |
93 | 91 | </p> |
94 | 92 | <script> |
95 | 93 | if (document.location.host) { |
96 | 94 | var p = document.currentScript.previousSibling.previousSibling; |
97 | 95 | var a = document.createElement('a'); |
98 | 96 | a.innerHTML = 'View in <em>nbviewer</em>'; |
99 | | - a.href = 'https://nbviewer.jupyter.org/url' + |
100 | | - (window.location.protocol === 'https:' ? 's/' : '/') + |
101 | | - window.location.host + |
102 | | - window.location.pathname.slice(0, -5) + 'ipynb'; |
| 97 | + a.href = `https://nbviewer.jupyter.org/url${ |
| 98 | + (window.location.protocol == 'https:' ? 's/' : '/') + |
| 99 | + window.location.host + |
| 100 | + window.location.pathname.slice(0, -4) }ipynb`; |
103 | 101 | a.classList.add('reference'); |
104 | 102 | a.classList.add('external'); |
105 | 103 | p.appendChild(a); |
106 | 104 | p.appendChild(document.createTextNode('.')); |
107 | 105 | } |
108 | 106 | </script> |
109 | 107 | </div> |
110 | | -
|
111 | 108 | .. raw:: latex |
112 | 109 |
|
113 | 110 | \nbsphinxstartnotebook{\scriptsize\noindent\strut |
114 | 111 | \textcolor{gray}{The following section was generated from |
115 | 112 | \sphinxcode{\sphinxupquote{\strut {{ docname | escape_latex }}}} \dotfill}} |
116 | 113 | """ |
117 | 114 |
|
118 | | -# -- Templates ---------------------------------------------------------------- |
119 | | - |
| 115 | +# Add any paths that contain templates here, relative to this directory. |
120 | 116 | templates_path = ['_templates'] |
121 | 117 |
|
122 | 118 | # The suffix(es) of source filenames. |
| 119 | +# You can specify multiple suffix as a list of string: |
| 120 | +# |
| 121 | +# source_suffix = ['.rst', '.md'] |
123 | 122 | source_suffix = '.rst' |
124 | 123 |
|
125 | 124 | # The master toctree document. |
126 | 125 | master_doc = 'index' |
127 | 126 |
|
128 | | -# The language for content autogenerated by Sphinx. |
| 127 | +# The language for content autogenerated by Sphinx. Refer to documentation |
| 128 | +# for a list of supported languages. |
| 129 | +# |
| 130 | +# This is also used if you do content translation via gettext catalogs. |
| 131 | +# Usually you set "language" from the command line for these cases. |
129 | 132 | language = 'en' |
130 | 133 |
|
131 | | -# List of patterns, relative to source directory, to ignore. |
| 134 | +# List of patterns, relative to source directory, that match files and |
| 135 | +# directories to ignore when looking for source files. |
| 136 | +# This pattern also affects html_static_path and html_extra_path . |
132 | 137 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] |
133 | 138 |
|
134 | 139 | # The name of the Pygments (syntax highlighting) style to use. |
135 | 140 | pygments_style = 'sphinx' |
136 | 141 |
|
| 142 | + |
137 | 143 | # -- Options for HTML output ------------------------------------------------- |
138 | 144 |
|
139 | | -html_theme = "sphinx_rtd_theme" |
140 | | -# html_static_path = ['_static'] # (left commented as in your original) |
| 145 | +# The theme to use for HTML and HTML Help pages. See the documentation for |
| 146 | +# a list of builtin themes. |
| 147 | +# |
| 148 | +html_theme = "sphinx_rtd_theme" #'alabaster' |
| 149 | + |
| 150 | +# Theme options are theme-specific and customize the look and feel of a theme |
| 151 | +# further. For a list of options available for each theme, see the |
| 152 | +# documentation. |
| 153 | +# |
| 154 | +# html_theme_options = {} |
| 155 | + |
| 156 | +# Add any paths that contain custom static files (such as style sheets) here, |
| 157 | +# relative to this directory. They are copied after the builtin static files, |
| 158 | +# so a file named "default.css" will overwrite the builtin "default.css". |
| 159 | +#html_static_path = ['_static'] |
| 160 | + |
| 161 | +# Custom sidebar templates, must be a dictionary that maps document names |
| 162 | +# to template names. |
| 163 | +# |
| 164 | +# The default sidebars (for documents that don't match any pattern) are |
| 165 | +# defined by theme itself. Builtin themes are using these templates by |
| 166 | +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', |
| 167 | +# 'searchbox.html']``. |
| 168 | +# |
| 169 | +# html_sidebars = {} |
| 170 | + |
141 | 171 |
|
142 | 172 | # -- Options for HTMLHelp output --------------------------------------------- |
143 | 173 |
|
| 174 | +# Output file base name for HTML help builder. |
144 | 175 | htmlhelp_basename = 'Thermobardoc' |
145 | 176 |
|
| 177 | + |
146 | 178 | # -- Options for LaTeX output ------------------------------------------------ |
147 | 179 |
|
148 | 180 | latex_elements = { |
149 | | - # Keep your defaults |
| 181 | + # The paper size ('letterpaper' or 'a4paper'). |
| 182 | + # |
| 183 | + # 'papersize': 'letterpaper', |
| 184 | + |
| 185 | + # The font size ('10pt', '11pt' or '12pt'). |
| 186 | + # |
| 187 | + # 'pointsize': '10pt', |
| 188 | + |
| 189 | + # Additional stuff for the LaTeX preamble. |
| 190 | + # |
| 191 | + # 'preamble': '', |
| 192 | + |
| 193 | + # Latex figure (float) alignment |
| 194 | + # |
| 195 | + # 'figure_align': 'htbp', |
150 | 196 | } |
151 | 197 |
|
| 198 | +# Grouping the document tree into LaTeX files. List of tuples |
| 199 | +# (source start file, target name, title, |
| 200 | +# author, documentclass [howto, manual, or own class]). |
152 | 201 | latex_documents = [ |
153 | 202 | (master_doc, 'Thermobar.tex', 'Thermobar Documentation', |
154 | 203 | 'Penny Wieser', 'manual'), |
155 | 204 | ] |
156 | 205 |
|
| 206 | + |
157 | 207 | # -- Options for manual page output ------------------------------------------ |
158 | 208 |
|
| 209 | +# One entry per manual page. List of tuples |
| 210 | +# (source start file, name, description, authors, manual section). |
159 | 211 | man_pages = [ |
160 | 212 | (master_doc, 'Thermobar', 'Thermobar Documentation', |
161 | 213 | [author], 1) |
162 | 214 | ] |
163 | 215 |
|
| 216 | + |
164 | 217 | # -- Options for Texinfo output ---------------------------------------------- |
165 | 218 |
|
| 219 | +# Grouping the document tree into Texinfo files. List of tuples |
| 220 | +# (source start file, target name, title, author, |
| 221 | +# dir menu entry, description, category) |
166 | 222 | texinfo_documents = [ |
167 | 223 | (master_doc, 'Thermobar', 'Thermobar Documentation', |
168 | 224 | author, 'Thermobar', 'One line description of project.', |
169 | 225 | 'Miscellaneous'), |
170 | 226 | ] |
171 | 227 |
|
172 | | -# -- Intersphinx ------------------------------------------------------------- |
173 | 228 |
|
174 | 229 | intersphinx_mapping = { |
175 | 230 | 'python': ('https://docs.python.org/3', None), |
176 | 231 | 'pandas': ('https://pandas.pydata.org/en/latest', None), |
177 | 232 | 'numpy': ('https://docs.scipy.org/doc/numpy', None), |
178 | 233 | } |
| 234 | + |
| 235 | + |
| 236 | + |
| 237 | +html_context = { |
| 238 | + 'READTHEDOCS': os.environ.get('READTHEDOCS', '') == 'True', |
| 239 | + 'github_version': os.environ.get('READTHEDOCS_VERSION', 'main'), # Pull correct version info |
| 240 | + 'current_version': release, # Use release variable defined earlier |
| 241 | +} |
| 242 | + |
| 243 | + |
| 244 | + |
| 245 | + |
0 commit comments