Skip to content

Commit ae8caf4

Browse files
committed
skpkg: migration of docs
1 parent b4417be commit ae8caf4

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

doc/source/conf.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
from importlib.metadata import version
1919
from pathlib import Path
2020

21+
# Attempt to import the version dynamically from GitHub tag.
22+
try:
23+
fullversion = version("diffpy.utils")
24+
except Exception:
25+
fullversion = "No version found. The correct version will appear in the released version." # noqa: E501
26+
2127
# If extensions (or modules to document with autodoc) are in another directory,
2228
# add these directories to sys.path here. If the directory is relative to the
2329
# documentation root, use Path().resolve() to make it absolute, like shown here.
@@ -43,6 +49,7 @@
4349
"sphinx.ext.viewcode",
4450
"sphinx.ext.intersphinx",
4551
"sphinx_rtd_theme",
52+
"sphinx_copybutton",
4653
"m2r",
4754
]
4855

@@ -88,6 +95,11 @@
8895
# substitute YEAR in the copyright string
8996
copyright = copyright.replace("%Y", year)
9097

98+
# For sphinx_copybutton extension.
99+
# Do not copy "$" for shell commands in code-blocks.
100+
copybutton_prompt_text = r"^\$ "
101+
copybutton_prompt_is_regexp = True
102+
91103
# List of patterns, relative to source directory, that match files and
92104
# directories to ignore when looking for source files.
93105
exclude_patterns = ["build"]
@@ -123,6 +135,14 @@
123135
#
124136
html_theme = "sphinx_rtd_theme"
125137

138+
html_context = {
139+
"display_github": True,
140+
"github_user": "diffpy",
141+
"github_repo": "diffpy.utils",
142+
"github_version": "main",
143+
"conf_py_path": "/doc/source/",
144+
}
145+
126146
# Theme options are theme-specific and customize the look and feel of a theme
127147
# further. For a list of options available for each theme, see the
128148
# documentation.
@@ -256,7 +276,13 @@
256276
# One entry per manual page. List of tuples
257277
# (source start file, name, description, authors, manual section).
258278
man_pages = [
259-
("index", "diffpy.utils", "diffpy.utils Documentation", ab_authors, 1)
279+
(
280+
"index",
281+
"diffpy.utils",
282+
"diffpy.utils Documentation",
283+
ab_authors,
284+
1,
285+
)
260286
]
261287

262288
# If true, show URL addresses after external links.

0 commit comments

Comments
 (0)