|
12 | 12 | import re
|
13 | 13 | import semantic_version
|
14 | 14 | import shutil
|
15 |
| -import sphinx_bootstrap_theme |
16 | 15 | import sys
|
| 16 | +import urllib.request |
17 | 17 |
|
18 | 18 | # -- Path setup --------------------------------------------------------------
|
19 | 19 |
|
|
24 | 24 | docssrc_dir = os.path.dirname(os.path.abspath(__file__))
|
25 | 25 | project_dir = os.path.dirname(docssrc_dir)
|
26 | 26 |
|
| 27 | +# Download the *See Also* cards from a centralized location so it can be kept |
| 28 | +# up-to-date across all projects |
| 29 | +with urllib.request.urlopen("https://gist.githubusercontent.com/althonos/5d6bf5a512d64dc951c42a91d5fc3fb3/raw/related.rst") as src: |
| 30 | + with open("related.rst", "wb") as dst: |
| 31 | + shutil.copyfileobj(src, dst) |
27 | 32 |
|
28 | 33 | # -- Project information -----------------------------------------------------
|
29 | 34 |
|
|
40 | 45 | version = str(semver.truncate(level="patch"))
|
41 | 46 | release = str(semver)
|
42 | 47 |
|
43 |
| -# extract the project URLs from ``setup.cfg`` |
44 |
| -cfgparser = configparser.ConfigParser() |
45 |
| -cfgparser.read(os.path.join(project_dir, "setup.cfg")) |
46 |
| -project_urls = dict( |
47 |
| - map(str.strip, line.split(" = ", 1)) |
48 |
| - for line in cfgparser.get("metadata", "project_urls").splitlines() |
49 |
| - if line.strip() |
50 |
| -) |
51 |
| - |
52 | 48 | # patch the docstring so that we don't show the link to redirect
|
53 | 49 | # to the docs (we don't want to see it when reading the docs already, duh!)
|
54 | 50 | doc_lines = pyskani.__doc__.splitlines()
|
|
77 | 73 | "sphinx.ext.mathjax",
|
78 | 74 | "sphinx.ext.todo",
|
79 | 75 | "sphinx.ext.extlinks",
|
80 |
| - "sphinx_bootstrap_theme", |
81 | 76 | "recommonmark",
|
| 77 | + "sphinx_design", |
| 78 | + "sphinxcontrib.jquery", |
82 | 79 | #"nbsphinx",
|
83 | 80 | ]
|
84 | 81 |
|
|
102 | 99 | # The name of the default role for inline references
|
103 | 100 | default_role = "py:obj"
|
104 | 101 |
|
105 |
| - |
106 |
| - |
107 |
| -# The name of the default role for inline references |
108 |
| -default_role = "py:obj" |
109 |
| - |
110 |
| - |
111 | 102 | # -- Options for HTML output -------------------------------------------------
|
112 | 103 |
|
113 | 104 | # The theme to use for HTML and HTML Help pages. See the documentation for
|
114 | 105 | # a list of builtin themes.
|
115 | 106 | #
|
116 |
| -html_theme = 'bootstrap' |
| 107 | +html_theme = 'pydata_sphinx_theme' |
117 | 108 |
|
118 | 109 | # Add any paths that contain custom static files (such as style sheets) here,
|
119 | 110 | # relative to this directory. They are copied after the builtin static files,
|
120 | 111 | # so a file named "default.css" will overwrite the builtin "default.css".
|
121 |
| -html_static_path = ['_static'] |
| 112 | +html_static_path = ['_static/js', '_static/bibtex', '_static/css', '_static/json'] |
| 113 | +html_js_files = ["custom-icon.js"] |
| 114 | +html_css_files = ["custom.css"] |
122 | 115 |
|
123 | 116 | # Theme options are theme-specific and customize the look and feel of a theme
|
124 | 117 | # further. For a list of options available for each theme, see the
|
125 | 118 | # documentation.
|
126 | 119 | #
|
127 | 120 | html_theme_options = {
|
128 |
| - # Bootswatch (http://bootswatch.com/) theme. |
129 |
| - "bootswatch_theme": "flatly", |
130 |
| - # Choose Bootstrap version. |
131 |
| - "bootstrap_version": "3", |
132 |
| - # Tab name for entire site. (Default: "Site") |
133 |
| - "navbar_site_name": "Documentation", |
134 |
| - # HTML navbar class (Default: "navbar") to attach to <div> element. |
135 |
| - # For black navbar, do "navbar navbar-inverse" |
136 |
| - "navbar_class": "navbar", |
137 |
| - # Render the next and previous page links in navbar. (Default: true) |
138 |
| - "navbar_sidebarrel": True, |
139 |
| - # Render the current pages TOC in the navbar. (Default: true) |
140 |
| - "navbar_pagenav": False, |
141 |
| - # A list of tuples containing pages or urls to link to. |
142 |
| - "navbar_links": [ |
143 |
| - ("GitHub", cfgparser.get("metadata", "home_page").strip(), True) |
144 |
| - ] + [ |
145 |
| - (k, v, True) |
146 |
| - for k, v in project_urls.items() |
147 |
| - if k in {"Zenodo", "PyPI"} |
| 121 | + "external_links": [], |
| 122 | + "show_toc_level": 2, |
| 123 | + "use_edit_page_button": True, |
| 124 | + "icon_links": [ |
| 125 | + { |
| 126 | + "name": "GitHub", |
| 127 | + "url": "https://github.com/althonos/pyskani", |
| 128 | + "icon": "fa-brands fa-github", |
| 129 | + }, |
| 130 | + { |
| 131 | + "name": "PyPI", |
| 132 | + "url": "https://pypi.org/project/pyskani", |
| 133 | + "icon": "fa-custom fa-pypi", |
| 134 | + }, |
148 | 135 | ],
|
149 |
| - "admonition_use_panel": True, |
| 136 | + "logo": { |
| 137 | + "text": "Pyskani", |
| 138 | + # "image_light": "_images/logo.png", |
| 139 | + # "image_dark": "_images/logo.png", |
| 140 | + }, |
| 141 | + "navbar_start": ["navbar-logo", "version-switcher"], |
| 142 | + "navbar_align": "left", |
| 143 | + "footer_start": ["copyright"], |
| 144 | + "footer_center": ["sphinx-version"], |
| 145 | + "switcher": { |
| 146 | + "json_url": "https://pyskani.readthedocs.io/en/latest/_static/switcher.json", |
| 147 | + "version_match": version, |
| 148 | + } |
150 | 149 | }
|
151 | 150 |
|
152 |
| -# Custom sidebar templates, must be a dictionary that maps document names |
153 |
| -# to template names. |
154 |
| -# |
155 |
| -# The default sidebars (for documents that don't match any pattern) are |
156 |
| -# defined by theme itself. Builtin themes are using these templates by |
157 |
| -# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', |
158 |
| -# 'searchbox.html']``. |
159 |
| -# |
160 |
| -html_sidebars = { |
161 |
| - "*": ["localtoc.html"], |
162 |
| - "api/*": ["localtoc.html"], |
163 |
| - "examples/*": ["localtoc.html"], |
| 151 | +html_context = { |
| 152 | + "github_user": "althonos", |
| 153 | + "github_repo": "pyskani", |
| 154 | + "github_version": "main", |
| 155 | + "doc_path": "docs", |
164 | 156 | }
|
165 | 157 |
|
| 158 | +html_favicon = '_images/favicon.ico' |
| 159 | + |
166 | 160 | # -- Options for HTMLHelp output ---------------------------------------------
|
167 | 161 |
|
168 | 162 | # Output file base name for HTML help builder.
|
|
196 | 190 | # Example configuration for intersphinx: refer to the Python standard library.
|
197 | 191 | intersphinx_mapping = {
|
198 | 192 | "python": ("https://docs.python.org/3/", None),
|
199 |
| - "biopython": ("https://biopython.org/docs/latest/api/", None), |
| 193 | + "biopython": ("https://biopython.org/docs/latest/", None), |
200 | 194 | }
|
201 | 195 |
|
202 | 196 | # -- Options for recommonmark extension --------------------------------------
|
|
0 commit comments