|
1 | 1 | #!/usr/bin/env python
|
2 | 2 | # -*- coding: utf-8 -*-
|
3 | 3 | #
|
4 |
| -# diffpy.structure documentation build configuration file, created by |
| 4 | +# diffpy.structure documentation build configuration file, created by # noqa: E501 |
5 | 5 | # sphinx-quickstart on Thu Jan 30 15:49:41 2014.
|
6 | 6 | #
|
7 | 7 | # This file is execfile()d with the current directory set to its
|
|
18 | 18 | from importlib.metadata import version
|
19 | 19 | from pathlib import Path
|
20 | 20 |
|
| 21 | +# Attempt to import the version dynamically from GitHub tag. |
| 22 | +try: |
| 23 | + fullversion = version("diffpy.structure") |
| 24 | +except Exception: |
| 25 | + fullversion = "No version found. The correct version will appear in the released version." # noqa: E501 |
| 26 | + |
21 | 27 | # If extensions (or modules to document with autodoc) are in another directory,
|
22 | 28 | # add these directories to sys.path here. If the directory is relative to the
|
23 |
| -# documentation root, use Path().resolve() to make it absolute, like shown here. |
| 29 | +# documentation root, use Path().resolve() to make it absolute, like shown here. # noqa: E501 |
24 | 30 | # sys.path.insert(0, str(Path(".").resolve()))
|
25 | 31 | sys.path.insert(0, str(Path("../..").resolve()))
|
26 | 32 | sys.path.insert(0, str(Path("../../src").resolve()))
|
27 | 33 |
|
28 | 34 | # abbreviations
|
29 |
| -ab_authors = "Billinge Group members and community contributors" |
| 35 | +ab_authors = "Chris Farrow, Pavol Juhas, Simon Billinge, Billinge Group members" |
30 | 36 |
|
31 | 37 | # -- General configuration ------------------------------------------------
|
32 | 38 |
|
|
43 | 49 | "sphinx.ext.viewcode",
|
44 | 50 | "sphinx.ext.intersphinx",
|
45 | 51 | "sphinx_rtd_theme",
|
| 52 | + "sphinx_copybutton", |
46 | 53 | "m2r",
|
47 | 54 | ]
|
48 | 55 |
|
|
68 | 75 | # |version| and |release|, also used in various other places throughout the
|
69 | 76 | # built documents.
|
70 | 77 |
|
71 |
| -fullversion = version(project) |
72 | 78 | # The short X.Y version.
|
73 | 79 | version = "".join(fullversion.split(".post")[:1])
|
74 | 80 | # The full version, including alpha/beta/rc tags.
|
|
88 | 94 | # substitute YEAR in the copyright string
|
89 | 95 | copyright = copyright.replace("%Y", year)
|
90 | 96 |
|
| 97 | +# For sphinx_copybutton extension. |
| 98 | +# Do not copy "$" for shell commands in code-blocks. |
| 99 | +copybutton_prompt_text = r"^\$ " |
| 100 | +copybutton_prompt_is_regexp = True |
| 101 | + |
91 | 102 | # List of patterns, relative to source directory, that match files and
|
92 | 103 | # directories to ignore when looking for source files.
|
93 | 104 | exclude_patterns = ["build"]
|
|
123 | 134 | #
|
124 | 135 | html_theme = "sphinx_rtd_theme"
|
125 | 136 |
|
| 137 | +html_context = { |
| 138 | + "display_github": True, |
| 139 | + "github_user": "diffpy", |
| 140 | + "github_repo": "diffpy.structure", |
| 141 | + "github_version": "main", |
| 142 | + "conf_py_path": "/doc/source/", |
| 143 | +} |
| 144 | + |
126 | 145 | # Theme options are theme-specific and customize the look and feel of a theme
|
127 | 146 | # further. For a list of options available for each theme, see the
|
128 | 147 | # documentation.
|
|
221 | 240 | # (source start file, target name, title,
|
222 | 241 | # author, documentclass [howto, manual, or own class]).
|
223 | 242 | latex_documents = [
|
224 |
| - ("index", "diffpy.structure.tex", "diffpy.structure Documentation", ab_authors, "manual"), |
| 243 | + ( |
| 244 | + "index", |
| 245 | + "diffpy.structure.tex", |
| 246 | + "diffpy.structure Documentation", |
| 247 | + ab_authors, |
| 248 | + "manual", |
| 249 | + ), |
225 | 250 | ]
|
226 | 251 |
|
227 | 252 | # The name of an image file (relative to this directory) to place at the top of
|
|
249 | 274 |
|
250 | 275 | # One entry per manual page. List of tuples
|
251 | 276 | # (source start file, name, description, authors, manual section).
|
252 |
| -man_pages = [("index", "diffpy.structure", "diffpy.structure Documentation", ab_authors, 1)] |
| 277 | +man_pages = [ |
| 278 | + ( |
| 279 | + "index", |
| 280 | + "diffpy.structure", |
| 281 | + "diffpy.structure Documentation", |
| 282 | + ab_authors, |
| 283 | + 1, |
| 284 | + ) |
| 285 | +] |
253 | 286 |
|
254 | 287 | # If true, show URL addresses after external links.
|
255 | 288 | # man_show_urls = False
|
|
0 commit comments