Skip to content

Commit 8423249

Browse files
authored
switch to sphinx-favicon from deprecated "favicons" config (#388)
1 parent 1c54d80 commit 8423249

File tree

2 files changed

+112
-114
lines changed

2 files changed

+112
-114
lines changed

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ install_requires =
4040
sphinx==5.*
4141
sphinx-reredirects==0.1.*
4242
sphinxcontrib-runcmd==0.2.*
43+
sphinx-favicon
4344
python-Levenshtein
4445
sphinx-intl
4546

src/conf.py

Lines changed: 111 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020

2121
# -- Project information -----------------------------------------------------
2222

23-
project = 'Common Workflow Language User Guide'
24-
copyright = '2013, CWL Project Team'
25-
author = 'CWL Project Team'
23+
project = "Common Workflow Language User Guide"
24+
copyright = "2013, CWL Project Team"
25+
author = "CWL Project Team"
2626

2727
# The full version, including alpha/beta/rc tags
28-
release = '0.1'
28+
release = "0.1"
2929

3030
# Define the version we use for matching in the version switcher.
3131
version_match = os.environ.get("READTHEDOCS_VERSION")
@@ -37,142 +37,163 @@
3737
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3838
# ones.
3939
extensions = [
40-
'myst_parser',
41-
'sphinx.ext.graphviz',
42-
'sphinx_reredirects',
43-
'cwl.sphinx.runcmd'
40+
"myst_parser",
41+
"sphinx.ext.graphviz",
42+
"sphinx_reredirects",
43+
"sphinx_favicon",
44+
"cwl.sphinx.runcmd",
4445
]
4546

4647
# myst-parser settings
4748
myst_heading_anchors = 4
4849
myst_enable_extensions = [
49-
'colon_fence',
50-
'deflist',
51-
'substitution',
52-
'replacements',
50+
"colon_fence",
51+
"deflist",
52+
"substitution",
53+
"replacements",
5354
]
54-
CWL_VERSION = 'v1.2'
55+
CWL_VERSION = "v1.2"
5556
myst_substitutions = {
56-
'repo_url': 'https://github.com/common-workflow-language/user_guide/',
57-
'source_branch': 'main',
58-
'cwl_version': f'`{CWL_VERSION}`',
59-
'cwl_version_text': f'{CWL_VERSION}'
57+
"repo_url": "https://github.com/common-workflow-language/user_guide/",
58+
"source_branch": "main",
59+
"cwl_version": f"`{CWL_VERSION}`",
60+
"cwl_version_text": f"{CWL_VERSION}",
6061
}
6162

62-
master_doc = 'index'
63+
master_doc = "index"
6364

6465
# Set the default role so we can use `foo` instead of ``foo``
65-
default_role = 'literal'
66+
default_role = "literal"
6667

6768
# Add any paths that contain templates here, relative to this directory.
68-
templates_path = ['_templates']
69+
templates_path = ["_templates"]
6970

7071
# List of patterns, relative to source directory, that match files and
7172
# directories to ignore when looking for source files.
7273
# This pattern also affects html_static_path and html_extra_path.
7374
# CONTRIBUTING.md is referenced in the footer, but not linked via Sphinx
7475
# aio.md is also referenced in one page, but not directly via Sphinx, hence the exclusions here.
7576
exclude_patterns = [
76-
'**/Thumbs.db',
77-
'**/.DS_Store',
78-
'**/.git',
79-
'.idea',
80-
'.github',
81-
'**/_build',
82-
'**/_includes',
83-
'cwl',
84-
'venv',
85-
'README.md',
86-
'CODE_OF_CONDUCT.md',
87-
'CONTRIBUTING.md'
77+
"**/Thumbs.db",
78+
"**/.DS_Store",
79+
"**/.git",
80+
".idea",
81+
".github",
82+
"**/_build",
83+
"**/_includes",
84+
"cwl",
85+
"venv",
86+
"README.md",
87+
"CODE_OF_CONDUCT.md",
88+
"CONTRIBUTING.md",
8889
]
8990

90-
source_suffix = ['.rst', '.md']
91+
source_suffix = [".rst", ".md"]
9192

9293
# -- Options for URL redirects -----------------------------------------------
9394

9495
redirects = {
95-
'01-introduction/index.md': '../introduction/quick-start.html',
96-
'02-1st-example/index.md': '../introduction/quick-start.html',
97-
'03-input/index.md': '../topics/inputs.html',
98-
'04-output/index.md': '../topics/outputs.html',
99-
'05-stdout/index.md': '../topics/outputs.html',
100-
'06-params/index.md': '../topics/parameter-references.html',
101-
'07-containers/index.md': '../topics/using-containers.html',
102-
'08-arguments/index.md': '../topics/additional-arguments-and-parameters.html',
103-
'09-array-inputs/index.md': '../topics/inputs.html',
104-
'10-array-outputs/index.md': '../topics/outputs.html',
105-
'11-records/index.md': '../topics/inputs.html',
106-
'12-env/index.md': '../topics/environment-variables.html',
107-
'13-expressions/index.md': '../topics/expressions.html',
108-
'14-runtime/index.md': '../topics/creating-files-at-runtime.html',
109-
'15-staging/index.md': '../topics/staging-input-files.html',
110-
'16-file-formats/index.md': '../topics/file-formats.html',
111-
'17-metadata/index.md': '../topics/metadata-and-authorship.html',
112-
'19-custom-types/index.md': '../topics/custom-types.html',
113-
'20-software-requirements/index.md': '../topics/specifying-software-requirements.html',
114-
'21-1st-workflow/index.md': '../topics/workflows.html',
115-
'22-nested-workflows/index.md': '../topics/workflows.html#nested-workflows',
116-
'23-scatter-workflow/index.md': '../topics/workflows.html#scattering-workflows',
117-
'24_conditional-workflow/index.md': '../topics/workflows.html#conditional-workflows',
118-
'rec-practices/index.md': '../topics/best-practices.html',
119-
'misc/index.md': '../faq.html',
120-
'episodes.md': 'index.html#table-of-contents',
121-
'setup.md': 'introduction/prerequisites.html',
122-
'extras.md': '/index.html',
123-
'yaml/index.md': '../topics/yaml-guide.html',
124-
'CODE_OF_CONDUCT.html': 'https://github.com/common-workflow-language/user_guide/blob/main/CODE_OF_CONDUCT.md'
96+
"01-introduction/index.md": "../introduction/quick-start.html",
97+
"02-1st-example/index.md": "../introduction/quick-start.html",
98+
"03-input/index.md": "../topics/inputs.html",
99+
"04-output/index.md": "../topics/outputs.html",
100+
"05-stdout/index.md": "../topics/outputs.html",
101+
"06-params/index.md": "../topics/parameter-references.html",
102+
"07-containers/index.md": "../topics/using-containers.html",
103+
"08-arguments/index.md": "../topics/additional-arguments-and-parameters.html",
104+
"09-array-inputs/index.md": "../topics/inputs.html",
105+
"10-array-outputs/index.md": "../topics/outputs.html",
106+
"11-records/index.md": "../topics/inputs.html",
107+
"12-env/index.md": "../topics/environment-variables.html",
108+
"13-expressions/index.md": "../topics/expressions.html",
109+
"14-runtime/index.md": "../topics/creating-files-at-runtime.html",
110+
"15-staging/index.md": "../topics/staging-input-files.html",
111+
"16-file-formats/index.md": "../topics/file-formats.html",
112+
"17-metadata/index.md": "../topics/metadata-and-authorship.html",
113+
"19-custom-types/index.md": "../topics/custom-types.html",
114+
"20-software-requirements/index.md": "../topics/specifying-software-requirements.html",
115+
"21-1st-workflow/index.md": "../topics/workflows.html",
116+
"22-nested-workflows/index.md": "../topics/workflows.html#nested-workflows",
117+
"23-scatter-workflow/index.md": "../topics/workflows.html#scattering-workflows",
118+
"24_conditional-workflow/index.md": "../topics/workflows.html#conditional-workflows",
119+
"rec-practices/index.md": "../topics/best-practices.html",
120+
"misc/index.md": "../faq.html",
121+
"episodes.md": "index.html#table-of-contents",
122+
"setup.md": "introduction/prerequisites.html",
123+
"extras.md": "/index.html",
124+
"yaml/index.md": "../topics/yaml-guide.html",
125+
"CODE_OF_CONDUCT.html": "https://github.com/common-workflow-language/user_guide/blob/main/CODE_OF_CONDUCT.md",
125126
}
126127

127128
# -- Options for Pygments ----------------------------------------------------
128129

129-
pygments_style = 'default'
130+
pygments_style = "default"
130131

131132
# TODO: maybe write our own lexer to customize tokens, keywords, etc?
132-
lexers['cwl'] = YamlLexer()
133+
lexers["cwl"] = YamlLexer()
133134

134-
highlight_options = {
135-
'default': {
136-
'stripall': True
137-
}
138-
}
135+
highlight_options = {"default": {"stripall": True}}
139136

140137
# -- GraphViz configuration --------------------------------------------------
141138

142139
from cwl.doc.graphs import create_processing_units_graph
143140

144-
graphviz_output_format = 'svg'
141+
graphviz_output_format = "svg"
145142

146-
myst_substitutions['CWL_PROCESSING_UNITS_GRAPH'] = create_processing_units_graph()
143+
myst_substitutions["CWL_PROCESSING_UNITS_GRAPH"] = create_processing_units_graph()
147144

148145
# -- Options for HTML output -------------------------------------------------
149146

150147
# The theme to use for HTML and HTML Help pages. See the documentation for
151148
# a list of builtin themes.
152149
#
153-
html_theme = 'pydata_sphinx_theme'
150+
html_theme = "pydata_sphinx_theme"
154151

155152
# Add any paths that contain custom static files (such as style sheets) here,
156153
# relative to this directory. They are copied after the builtin static files,
157154
# so a file named "default.css" will overwrite the builtin "default.css".
158-
html_static_path = ['_static']
155+
html_static_path = ["_static"]
156+
favicons = [
157+
{
158+
"rel": "icon",
159+
"sizes": "16x16",
160+
"href": "images/favicons/cwl/favicon-16x16.png",
161+
},
162+
{
163+
"rel": "icon",
164+
"sizes": "32x32",
165+
"href": "images/favicons/cwl/favicon-32x32.png",
166+
},
167+
{
168+
"rel": "icon",
169+
"sizes": "96x96",
170+
"href": "images/favicons/cwl/favicon-96x96.png",
171+
},
172+
{
173+
"rel": "icon",
174+
"sizes": "128x128",
175+
"href": "images/favicons/cwl/favicon-128.png",
176+
},
177+
{
178+
"rel": "icon",
179+
"sizes": "196x196",
180+
"href": "images/favicons/cwl/favicon-196x196.png",
181+
},
182+
]
183+
159184

160185
html_css_files = [
161-
'css/custom.css',
186+
"css/custom.css",
162187
]
163188

164-
html_logo = '_static/images/logos/cwl/CWL-Logo-HD-cropped2.png'
165-
html_favicon = '_static/images/favicons/cwl/favicon.ico'
189+
html_logo = "_static/images/logos/cwl/CWL-Logo-HD-cropped2.png"
190+
html_favicon = "_static/images/favicons/cwl/favicon.ico"
166191

167-
html_extra_path = [
168-
'browserconfig.xml',
169-
'favicon.ico',
170-
'manifest.json'
171-
]
192+
html_extra_path = ["browserconfig.xml", "favicon.ico", "manifest.json"]
172193

173194
html_theme_options = {
174195
"external_links": [
175-
{"name": "Community", "url": "https://www.commonwl.org/community/"},
196+
{"name": "Community", "url": "https://www.commonwl.org/community/"},
176197
],
177198
"header_links_before_dropdown": 6,
178199
"icon_links": [
@@ -191,39 +212,12 @@
191212
"navbar_end": [
192213
# "version-switcher",
193214
"theme-switcher",
194-
"navbar-icon-links"
215+
"navbar-icon-links",
195216
],
196217
"show_nav_level": 2,
197218
"navigation_depth": 2,
198219
"collapse_navigation": True,
199220
"show_prev_next": True,
200-
"favicons": [
201-
{
202-
"rel": "icon",
203-
"sizes": "16x16",
204-
"href": "images/favicons/cwl/favicon-16x16.png"
205-
},
206-
{
207-
"rel": "icon",
208-
"sizes": "32x32",
209-
"href": "images/favicons/cwl/favicon-32x32.png"
210-
},
211-
{
212-
"rel": "icon",
213-
"sizes": "96x96",
214-
"href": "images/favicons/cwl/favicon-96x96.png"
215-
},
216-
{
217-
"rel": "icon",
218-
"sizes": "128x128",
219-
"href": "images/favicons/cwl/favicon-128.png"
220-
},
221-
{
222-
"rel": "icon",
223-
"sizes": "196x196",
224-
"href": "images/favicons/cwl/favicon-196x196.png"
225-
}
226-
],
227221
"footer_items": ["copyright"],
228222
}
229223

@@ -232,12 +226,12 @@
232226
"github_repo": "user_guide",
233227
"github_version": "main",
234228
"doc_path": "src",
235-
"default_mode": "light"
229+
"default_mode": "light",
236230
}
237231

238232
gettext_uuid = True
239233
gettext_compact = "user_guide"
240-
locale_dirs = ['../locales/']
234+
locale_dirs = ["../locales/"]
241235

242236

243237
# Patched MyST parser
@@ -260,6 +254,7 @@
260254

261255
SPHINX_LOGGER = logging.getLogger(__name__)
262256

257+
263258
class MystParser(SphinxParser):
264259
"""Sphinx parser for Markedly Structured Text (MyST)."""
265260

@@ -309,7 +304,9 @@ def parse(self, inputstring: str, document: nodes.document) -> None:
309304
# gives you the translation without resolving the links. Here we just re-use the
310305
# ``md_env`` dictionary that contains the ``.references`` populated in the first
311306
# pass, fixing i18n with MyST Parser.
312-
env = {} if not hasattr(document.settings, 'md_env') else document.settings.md_env
307+
env = (
308+
{} if not hasattr(document.settings, "md_env") else document.settings.md_env
309+
)
313310
parser.options["document"] = document
314311
parser.render(inputstring, env)
315312
document.settings.md_env = parser.renderer.md_env

0 commit comments

Comments
 (0)