Skip to content

Commit 8181c6c

Browse files
committed
Change to PyData Sphinx Theme
1 parent 9dcead5 commit 8181c6c

File tree

4 files changed

+98
-201
lines changed

4 files changed

+98
-201
lines changed

requirements.txt

+4
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ nbsphinx
77
Pygments==2.15.0
88
# MarkupSafe 2.1.1 breaks Jinja2 2.10.1
99
MarkupSafe==2.0.1
10+
pydata-sphinx-theme
11+
myst-parser
12+
sphinx_design
13+
File renamed without changes.

source/_static/css/pyscf-pst.css

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
:root {
2+
--pyscf-primary: #3677e0;
3+
--pyscf-accent: #3677e0;
4+
}
5+
6+
html[data-theme="light"] {
7+
--pst-color-primary: var(--pyscf-primary);
8+
--pst-color-secondary: var(--pyscf-accent);
9+
}
10+
11+
html[data-theme="dark"] {
12+
--pst-color-primary: var(--pyscf-primary);
13+
--pst-color-secondary: var(--pyscf-accent);
14+
}

source/conf.py

+80-201
Original file line numberDiff line numberDiff line change
@@ -2,166 +2,12 @@
22

33
# import os
44
import sys
5-
6-
# import ablog
5+
from datetime import datetime
76

87
from pyscf import __version__
98

109
sys.path.append("./source/tools/extensions")
1110

12-
13-
# -- General ABlog Options ----------------------------------------------------
14-
15-
# A path relative to the configuration directory for blog archive pages.
16-
# blog_path = 'blog'
17-
18-
# The "title" for the blog, used in active pages. Default is ``'Blog'``.
19-
blog_title = u"PySCF Docs"
20-
21-
# Base URL for the website, required for generating feeds.
22-
# e.g. blog_baseurl = "http://example.com/"
23-
blog_baseurl = u""
24-
25-
# Choose to archive only post titles. Archiving only titles can speed
26-
# up project building.
27-
# blog_archive_titles = False
28-
29-
# -- Blog Authors, Languages, and Locations -----------------------------------
30-
31-
# A dictionary of author names mapping to author full display names and
32-
# links. Dictionary keys are what should be used in ``post`` directive
33-
# to refer to the author. Default is ``{}``.
34-
blog_authors = {"James E. T. Smith": ("James E. T. Smith", None)}
35-
36-
37-
# A dictionary of language code names mapping to full display names and
38-
# links of these languages. Similar to :confval:`blog_authors`, dictionary
39-
# keys should be used in ``post`` directive to refer to the locations.
40-
# Default is ``{}``.
41-
# blog_languages = {
42-
# 'en': ('English', None),
43-
# }
44-
45-
46-
# A dictionary of location names mapping to full display names and
47-
# links of these locations. Similar to :confval:`blog_authors`, dictionary
48-
# keys should be used in ``post`` directive to refer to the locations.
49-
# Default is ``{}``.
50-
# blog_locations = {
51-
# 'Earth': ('The Blue Planet', 'https://en.wikipedia.org/wiki/Earth),
52-
# }
53-
54-
# -- Blog Post Related --------------------------------------------------------
55-
56-
# Format date for a post.
57-
# post_date_format = '%b %d, %Y'
58-
59-
# Number of paragraphs (default is ``1``) that will be displayed as an excerpt
60-
# from the post. Setting this ``0`` will result in displaying no post excerpt
61-
# in archive pages. This option can be set on a per post basis using
62-
# post_auto_excerpt = 1
63-
64-
# Index of the image that will be displayed in the excerpt of the post.
65-
# Default is ``0``, meaning no image. Setting this to ``1`` will include
66-
# the first image, when available, to the excerpt. This option can be set
67-
# on a per post basis using :rst:dir:`post` directive option ``image``.
68-
# post_auto_image = 0
69-
70-
# Number of seconds (default is ``5``) that a redirect page waits before
71-
# refreshing the page to redirect to the post.
72-
# post_redirect_refresh = 5
73-
74-
# When ``True``, post title and excerpt is always taken from the section that
75-
# contains the :rst:dir:`post` directive, instead of the document. This is the
76-
# behavior when :rst:dir:`post` is used multiple times in a document. Default
77-
# is ``False``.
78-
# post_always_section = False
79-
80-
# When ``False``, the :rst:dir:`orphan` directive is not automatically set
81-
# for each post. Without this directive, Sphinx will warn about posts that
82-
# are not explicitly referenced via another document. :rst:dir:`orphan` can
83-
# be set on a per-post basis as well if this is false. Default is ``True``.
84-
# post_auto_orphan = True
85-
86-
# -- ABlog Sidebars -------------------------------------------------------
87-
88-
# There are seven sidebars you can include in your HTML output.
89-
# postcard.html provides information regarding the current post.
90-
# recentposts.html lists most recent five posts. Others provide
91-
# a link to a archive pages generated for each tag, category, and year.
92-
# In addition, there are authors.html, languages.html, and locations.html
93-
# sidebars that link to author and location archive pages.
94-
html_sidebars = {
95-
"**": [
96-
# "about.html",
97-
# "postcard.html",
98-
# "navigation.html",
99-
# "recentposts.html",
100-
# "tagcloud.html",
101-
# "categories.html",
102-
# "archives.html",
103-
"searchbox.html",
104-
"logo-text.html",
105-
"globaltoc.html",
106-
"localtoc.html",
107-
],
108-
#"index": [
109-
# "searchbox.html",
110-
# #"logo-text.html",
111-
#]
112-
}
113-
114-
# -- Blog Feed Options --------------------------------------------------------
115-
116-
# Turn feeds by setting :confval:`blog_baseurl` configuration variable.
117-
# Choose to create feeds per author, location, tag, category, and year,
118-
# default is ``False``.
119-
# blog_feed_archives = False
120-
121-
# Choose to display full text in blog feeds, default is ``False``.
122-
# blog_feed_fulltext = False
123-
124-
# Blog feed subtitle, default is ``None``.
125-
# blog_feed_subtitle = None
126-
127-
# Choose to feed only post titles, default is ``False``.
128-
# blog_feed_titles = False
129-
130-
# Specify number of recent posts to include in feeds, default is ``None``
131-
# for all posts.
132-
# blog_feed_length = None
133-
134-
# -- Font-Awesome Options -----------------------------------------------------
135-
136-
# ABlog templates will use of Font Awesome icons if one of the following
137-
# is ``True``
138-
139-
# Link to `Font Awesome`_ at `Bootstrap CDN`_ and use icons in sidebars
140-
# and post footers. Default: ``None``
141-
# fontawesome_link_cdn = None
142-
143-
# Sphinx_ theme already links to `Font Awesome`_. Default: ``False``
144-
# fontawesome_included = False
145-
146-
# Alternatively, you can provide the path to `Font Awesome`_ :file:`.css`
147-
# with the configuration option: fontawesome_css_file
148-
# Path to `Font Awesome`_ :file:`.css` (default is ``None``) that will
149-
# be linked to in HTML output by ABlog.
150-
# fontawesome_css_file = None
151-
152-
# -- Disqus Integration -------------------------------------------------------
153-
154-
# You can enable Disqus_ by setting ``disqus_shortname`` variable.
155-
# Disqus_ short name for the blog.
156-
# disqus_shortname = None
157-
158-
# Choose to disqus pages that are not posts, default is ``False``.
159-
# disqus_pages = False
160-
161-
# Choose to disqus posts that are drafts (without a published date),
162-
# default is ``False``.
163-
# disqus_drafts = False
164-
16511
# -- Sphinx Options -----------------------------------------------------------
16612

16713
# If your project needs a minimal Sphinx version, state it here.
@@ -181,22 +27,20 @@
18127
"sphinxcontrib.bibtex",
18228
"nbsphinx",
18329
"pyscfdocext",
184-
# "ablog",
30+
"myst_parser",
31+
"sphinx_design",
32+
# "gallery_directive",
18533
]
18634
bibtex_bibfiles = ['user/ref.bib']
18735
myst_update_mathjax = False
36+
myst_enable_extensions = [
37+
"colon_fence",
38+
"dollarmath",
39+
]
18840

18941

19042
# Add any paths that contain templates here, relative to this directory.
19143
templates_path = ["_templates"]
192-
# templates_path = ["_templates", ablog.get_html_templates_path()]
193-
194-
# The suffix(es) of source filenames.
195-
source_suffix = {
196-
".rst": "restructuredtext",
197-
# ".txt": "markdown",
198-
# ".md": "markdown",
199-
}
20044

20145
# The encoding of source files.
20246
# source_encoding = 'utf-8-sig'
@@ -206,7 +50,8 @@
20650

20751
# General information about the project.
20852
project = u"PySCF"
209-
copyright = u"2015-2021, The PySCF Developers"
53+
year = datetime.now().year
54+
copyright = f"{year}, The PySCF Developers"
21055

21156
# The version info for the project you're documenting, acts as replacement for
21257
# |version| and |release|, also used in various other places throughout the
@@ -267,40 +112,84 @@
267112

268113
# -- Options for HTML output ----------------------------------------------
269114

115+
# Add any paths that contain custom static files (such as style sheets) here,
116+
# relative to this directory. They are copied after the builtin static files,
117+
# so a file named "default.css" will overwrite the builtin "default.css".
118+
html_static_path = ["_static"]
119+
120+
270121
# The theme to use for HTML and HTML Help pages. See the documentation for
271122
# a list of builtin themes.
272-
html_theme = "sphinx_material"
123+
#html_theme = "sphinx_material"
124+
html_theme = "pydata_sphinx_theme"
273125

274126
# Theme options are theme-specific and customize the look and feel of a theme
275127
# further. For a list of options available for each theme, see the
276128
# documentation.
277-
html_theme_options = {
278-
# "github_button": False,
279-
"repo_name": "PySCF",
280-
"repo_url": "https://github.com/pyscf/pyscf/",
281-
"nav_title": "PySCF {0}".format(version),
282-
#"color_primary": "blue",
283-
#"color_accent": "amber",
284-
"color_primary": "pyscf",
285-
"color_accent": "pyscf",
286-
"globaltoc_depth": 2,
287-
"globaltoc_collapse": True,
288-
"master_doc": False,
289-
"heroes": {"index": "The Python-based Simulations of Chemistry Framework"},
290-
"nav_links": [
291-
{"href": "index", "title": "Home", "internal": True},
292-
#{"href": "overview", "title": "Overview", "internal": True},
293-
{"href": "install", "title": "Install", "internal": True},
294-
{"href": "quickstart", "title": "Quickstart", "internal": True},
295-
{"href": "user", "title": "User Guide", "internal": True},
296-
{"href": "develop", "title": "Developer Guide", "internal": True},
297-
{"href": "pyscf_api_docs/modules", "title": "API", "internal": True},
298-
# {"href": "blog_wrapper", "title": "Blog", "internal": True},
299-
{"href": "about", "title": "About", "internal": True},
300-
],
301-
"table_classes": ["simple"],
129+
130+
if html_theme == 'sphinx_material':
131+
html_css_files = ["css/pyscf-material.css"]
132+
html_theme_options = {
133+
# "github_button": False,
134+
"repo_name": "PySCF",
135+
"repo_url": "https://github.com/pyscf/pyscf/",
136+
"nav_title": "PySCF {0}".format(version),
137+
#"color_primary": "blue",
138+
#"color_accent": "amber",
139+
"color_primary": "pyscf",
140+
"color_accent": "pyscf",
141+
"globaltoc_depth": 2,
142+
"globaltoc_collapse": True,
143+
"master_doc": False,
144+
"heroes": {"index": "The Python-based Simulations of Chemistry Framework"},
145+
"nav_links": [
146+
{"href": "index", "title": "Home", "internal": True},
147+
#{"href": "overview", "title": "Overview", "internal": True},
148+
{"href": "install", "title": "Install", "internal": True},
149+
{"href": "quickstart", "title": "Quickstart", "internal": True},
150+
{"href": "user", "title": "User Guide", "internal": True},
151+
{"href": "develop", "title": "Developer Guide", "internal": True},
152+
{"href": "pyscf_api_docs/modules", "title": "API", "internal": True},
153+
{"href": "about", "title": "About", "internal": True},
154+
],
155+
"table_classes": ["simple"],
156+
}
157+
158+
# The name of an image file (relative to this directory) to place at the top
159+
# of the sidebar.
160+
html_logo = "../logo/pyscf-logo-white.svg"
161+
162+
163+
if html_theme == 'pydata_sphinx_theme':
164+
html_css_files = ["css/pyscf-pst.css"]
165+
html_context = {
166+
"github_user": "pyscf",
167+
"github_repo": "pyscf.github.io",
168+
"github_version": "master",
169+
"doc_path": "source",
170+
}
171+
172+
html_theme_options = {
173+
"logo": {
174+
"text": "PySCF",
175+
"image_light": "../logo/logo-64x64.png",
176+
"image_dark": "../logo/logo-64x64.png",
177+
},
178+
"show_toc_level": 1,
179+
"use_edit_page_button": True,
180+
"secondary_sidebar_items": {
181+
"**": ["page-toc", "edit-this-page"],
182+
},
183+
# "navbar_align": "left",
184+
}
185+
186+
html_sidebars = {
187+
"install": [],
188+
"quickstart": [],
189+
"about": [],
302190
}
303191

192+
304193
# Add any paths that contain custom themes here, relative to this directory.
305194
# html_theme_path = [alabaster.get_path()]
306195

@@ -311,21 +200,11 @@
311200
# A shorter title for the navigation bar. Default is the same as html_title.
312201
#html_short_title = "PySCF"
313202

314-
# The name of an image file (relative to this directory) to place at the top
315-
# of the sidebar.
316-
html_logo = "../logo/pyscf-logo-white.svg"
317-
318203
# The name of an image file (within the static path) to use as favicon of the
319204
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
320205
# pixels large.
321206
html_favicon = "../logo/favicon-32x32.png"
322207

323-
# Add any paths that contain custom static files (such as style sheets) here,
324-
# relative to this directory. They are copied after the builtin static files,
325-
# so a file named "default.css" will overwrite the builtin "default.css".
326-
html_static_path = ["_static"]
327-
html_css_files = ["css/pyscf.css"]
328-
329208
# Add any extra paths that contain custom files (such as robots.txt or
330209
# .htaccess) here, relative to this directory. These files are copied
331210
# directly to the root of the documentation.

0 commit comments

Comments
 (0)