Skip to content

Commit 2779a6c

Browse files
committed
implement html_baseurl according to RTD guidance
1 parent 96fdb9f commit 2779a6c

File tree

1 file changed

+42
-90
lines changed

1 file changed

+42
-90
lines changed

conf.py

Lines changed: 42 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -7,139 +7,104 @@
77
# -- Environment -------------------------------------------------------------
88

99
# Explicitly put the extensions directory to Python path
10-
sys.path.append(os.path.abspath('_extensions'))
10+
sys.path.append(os.path.abspath("_extensions"))
1111

1212

1313
# -- Project information -----------------------------------------------------
1414

15-
project = 'Dokumentace české Python komunity'
16-
copyright = '2023, Pyvec, z.s.'
17-
author = 'Pyvec, z.s.'
15+
project = "Dokumentace české Python komunity"
16+
copyright = "2023, Pyvec, z.s."
17+
author = "Pyvec, z.s."
1818

1919
# The short X.Y version
20-
version = ''
20+
version = ""
2121
# The full version, including alpha/beta/rc tags
22-
release = ''
22+
release = ""
2323

2424

2525
# -- General configuration ---------------------------------------------------
2626

27-
# If your documentation needs a minimal Sphinx version, state it here.
28-
#
29-
# needs_sphinx = '1.0'
30-
3127
# Add any Sphinx extension module names here, as strings. They can be
3228
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3329
# ones.
3430
extensions = [
35-
'sphinx.ext.doctest',
36-
'sphinx.ext.todo',
37-
'sphinx.ext.githubpages',
38-
'sphinxemoji.sphinxemoji',
39-
'slack',
40-
'twitter',
41-
'gh_repo',
42-
'myst_parser',
31+
"sphinx.ext.doctest",
32+
"sphinx.ext.todo",
33+
"sphinx.ext.githubpages",
34+
"sphinxemoji.sphinxemoji",
35+
"slack",
36+
"twitter",
37+
"gh_repo",
38+
"myst_parser",
4339
]
4440

4541
# Add any paths that contain templates here, relative to this directory.
46-
templates_path = ['_templates']
42+
templates_path = ["_templates"]
4743

4844
# The suffix(es) of source filenames.
4945
# You can specify multiple suffix as a list of string:
5046
#
5147
# source_suffix = ['.rst', '.md']
52-
source_suffix = ['.rst', '.md']
48+
source_suffix = [".rst", ".md"]
5349

5450
# The master toctree document.
55-
master_doc = 'index'
51+
master_doc = "index"
5652

5753
# The language for content autogenerated by Sphinx. Refer to documentation
5854
# for a list of supported languages.
5955
#
6056
# This is also used if you do content translation via gettext catalogs.
6157
# Usually you set "language" from the command line for these cases.
62-
language = 'cs'
58+
language = "cs"
6359

6460
# List of patterns, relative to source directory, that match files and
6561
# directories to ignore when looking for source files.
6662
# This pattern also affects html_static_path and html_extra_path .
67-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'venv']
63+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "venv", ".venv"]
6864

6965
# The name of the Pygments (syntax highlighting) style to use.
70-
pygments_style = 'monokai'
66+
pygments_style = "monokai"
7167

7268

7369
# -- Options for HTML output -------------------------------------------------
7470

71+
# Set canonical URL from the Read the Docs Domain
72+
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
73+
7574
# The theme to use for HTML and HTML Help pages. See the documentation for
7675
# a list of builtin themes.
77-
html_theme = 'sphinx_rtd_theme'
78-
html_logo = '_static/images/org-i.svg'
79-
80-
# Theme options are theme-specific and customize the look and feel of a theme
81-
# further. For a list of options available for each theme, see the
82-
# documentation.
83-
#
84-
# html_theme_options = {}
76+
html_theme = "sphinx_rtd_theme"
77+
html_logo = "_static/images/org-i.svg"
8578

8679
# Add any paths that contain custom static files (such as style sheets) here,
8780
# relative to this directory. They are copied after the builtin static files,
8881
# so a file named "default.css" will overwrite the builtin "default.css".
89-
html_static_path = ['_static']
90-
91-
# Custom sidebar templates, must be a dictionary that maps document names
92-
# to template names.
93-
#
94-
# The default sidebars (for documents that don't match any pattern) are
95-
# defined by theme itself. Builtin themes are using these templates by
96-
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
97-
# 'searchbox.html']``.
98-
#
99-
# html_sidebars = {}
82+
html_static_path = ["_static"]
10083

10184

10285
# -- Options for HTMLHelp output ---------------------------------------------
10386

10487
# Output file base name for HTML help builder.
105-
htmlhelp_basename = 'pyvec-doc'
88+
htmlhelp_basename = "pyvec-doc"
10689

10790

10891
# -- Options for LaTeX output ------------------------------------------------
10992

110-
latex_elements = {
111-
# The paper size ('letterpaper' or 'a4paper').
112-
#
113-
# 'papersize': 'letterpaper',
114-
115-
# The font size ('10pt', '11pt' or '12pt').
116-
#
117-
# 'pointsize': '10pt',
118-
119-
# Additional stuff for the LaTeX preamble.
120-
#
121-
# 'preamble': '',
122-
123-
# Latex figure (float) alignment
124-
#
125-
# 'figure_align': 'htbp',
126-
}
93+
latex_elements = {}
12794

12895
# Grouping the document tree into LaTeX files. List of tuples
12996
# (source start file, target name, title,
13097
# author, documentclass [howto, manual, or own class]).
13198
latex_documents = [
132-
(master_doc, 'pyvec.tex', project, author, 'manual'),
99+
(master_doc, "pyvec.tex", project, author, "manual"),
133100
]
134101

135102

136103
# -- Options for manual page output ------------------------------------------
137104

138105
# One entry per manual page. List of tuples
139106
# (source start file, name, description, authors, manual section).
140-
man_pages = [
141-
(master_doc, 'pyvec', project, [author], 1)
142-
]
107+
man_pages = [(master_doc, "pyvec", project, [author], 1)]
143108

144109

145110
# -- Options for Texinfo output ----------------------------------------------
@@ -148,8 +113,7 @@
148113
# (source start file, target name, title, author,
149114
# dir menu entry, description, category)
150115
texinfo_documents = [
151-
(master_doc, 'pyvec', project, author, 'pyvec', project,
152-
'Miscellaneous'),
116+
(master_doc, "pyvec", project, author, "pyvec", project, "Miscellaneous"),
153117
]
154118

155119

@@ -161,32 +125,19 @@
161125
epub_publisher = author
162126
epub_copyright = copyright
163127

164-
# The unique identifier of the text. This can be a ISBN number
165-
# or the project homepage.
166-
#
167-
# epub_identifier = ''
168-
169-
# A unique identification for the text.
170-
#
171-
# epub_uid = ''
172-
173128
# A list of files that should not be packed into the epub file.
174-
epub_exclude_files = ['search.html']
129+
epub_exclude_files = ["search.html"]
175130

176131

177132
# -- Extension configuration -------------------------------------------------
178133

179134
linkcheck_ignore = [
180-
r'http://127\.0\.0\.1:\d+', # localhost
181-
r'https://docs\.google\.com/.+', # links to private documents
182-
183-
# crawling/DDoS protection
184-
r'https://twitter\.com/.+',
185-
r'https://(www\.)?buffer\.com.*',
186-
r'https://www\.nytimes\.com/.*',
187-
188-
# see https://pyvec.slack.com/archives/C4PPZNPDK/p1617716799001200
189-
r'https://cz\.pycon\.org/\d+/.+',
135+
r"http://127\.0\.0\.1:\d+", # localhost
136+
r"https://docs\.google\.com/.+", # links to private documents
137+
r"https://twitter\.com/.+", # crawling/DDoS protection
138+
r"https://(www\.)?buffer\.com.*", # crawling/DDoS protection
139+
r"https://www\.nytimes\.com/.*", # crawling/DDoS protection
140+
r"https://cz\.pycon\.org/\d+/.+", # see https://pyvec.slack.com/archives/C4PPZNPDK/p1617716799001200
190141
]
191142

192143

@@ -199,11 +150,12 @@
199150
# -- Options for the emoji extension -----------------------------------------
200151

201152
# Ensures consistent emoji style on all computers, operating systems, browsers
202-
sphinxemoji_style = 'twemoji'
153+
sphinxemoji_style = "twemoji"
203154

204155

205156
# -- Setting up extensions ---------------------------------------------------
206157

158+
207159
def setup(app):
208-
app.add_css_file('custom.css')
209-
app.add_js_file('redirect.js')
160+
app.add_css_file("custom.css")
161+
app.add_js_file("redirect.js")

0 commit comments

Comments
 (0)