|
1 | 1 | #!/usr/bin/env python |
2 | 2 | # -*- coding: utf-8 -*- |
3 | 3 | # |
4 | | -# diffpy.fourigui documentation build configuration file, created by |
| 4 | +# diffpy.fourigui 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.fourigui") |
| 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())) |
|
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 |
|
|
90 | 97 | # substitute YEAR in the copyright string |
91 | 98 | copyright = copyright.replace("%Y", year) |
92 | 99 |
|
| 100 | +# For sphinx_copybutton extension. |
| 101 | +# Do not copy "$" for shell commands in code-blocks. |
| 102 | +copybutton_prompt_text = r"^\$ " |
| 103 | +copybutton_prompt_is_regexp = True |
| 104 | + |
93 | 105 | # List of patterns, relative to source directory, that match files and |
94 | 106 | # directories to ignore when looking for source files. |
95 | 107 | exclude_patterns = ["build"] |
|
125 | 137 | # |
126 | 138 | html_theme = "sphinx_rtd_theme" |
127 | 139 |
|
| 140 | +html_context = { |
| 141 | + "display_github": True, |
| 142 | + "github_user": "diffpy", |
| 143 | + "github_repo": "diffpy.fourigui", |
| 144 | + "github_version": "main", |
| 145 | + "conf_py_path": "/doc/source/", |
| 146 | +} |
| 147 | + |
128 | 148 | # Theme options are theme-specific and customize the look and feel of a theme |
129 | 149 | # further. For a list of options available for each theme, see the |
130 | 150 | # documentation. |
|
0 commit comments