Skip to content

Commit a5b166b

Browse files
committed
docs: Fix missing Edit Page button by adding dynamic branch detection
1 parent 467f9a8 commit a5b166b

File tree

1 file changed

+9
-233
lines changed

1 file changed

+9
-233
lines changed

docs/source/conf.py

Lines changed: 9 additions & 233 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
11
# -*- coding: utf-8 -*-
2-
3-
# Mypy documentation build configuration file, created by
4-
# sphinx-quickstart on Sun Sep 14 19:50:35 2014.
5-
6-
# This file is execfile()d with the current directory set to its
7-
# containing dir.
8-
9-
# Note that not all possible configuration values are present in this
10-
# autogenerated file.
11-
12-
# All configuration values have a default; values that are commented out
13-
# serve to show the default.
14-
152
from __future__ import annotations
163

174
import os
185
import sys
19-
6+
import subprocess
207
from sphinx.application import Sphinx
218
from sphinx.util.docfields import Field
229

@@ -29,92 +16,33 @@
2916

3017
# -- General configuration ------------------------------------------------
3118

32-
# If your documentation needs a minimal Sphinx version, state it here.
33-
# needs_sphinx = '1.0'
34-
35-
# Add any Sphinx extension module names here, as strings. They can be
36-
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
37-
# ones.
3819
extensions = [
3920
"sphinx.ext.intersphinx",
4021
"sphinx_inline_tabs",
4122
"docs.source.html_builder",
4223
"myst_parser",
4324
]
4425

45-
# Add any paths that contain templates here, relative to this directory.
4626
templates_path = ["_templates"]
47-
48-
# The suffix of source filenames.
4927
source_suffix = ".rst"
50-
51-
# The encoding of source files.
52-
# source_encoding = 'utf-8-sig'
53-
54-
# The master toctree document.
5528
master_doc = "index"
56-
57-
# General information about the project.
5829
project = "mypy"
5930
copyright = "2012-%Y Jukka Lehtosalo and mypy contributors"
6031

61-
# The version info for the project you're documenting, acts as replacement for
62-
# |version| and |release|, also used in various other places throughout the
63-
# built documents.
64-
#
65-
# The short X.Y version.
6632
version = mypy_version.split("-")[0]
67-
# The full version, including alpha/beta/rc tags.
6833
release = mypy_version
6934

70-
# The language for content autogenerated by Sphinx. Refer to documentation
71-
# for a list of supported languages.
72-
# language = None
73-
74-
# There are two options for replacing |today|: either, you set today to some
75-
# non-false value, then it is used:
76-
# today = ''
77-
# Else, today_fmt is used as the format for a strftime call.
78-
# today_fmt = '%B %d, %Y'
79-
80-
# List of patterns, relative to source directory, that match files and
81-
# directories to ignore when looking for source files.
82-
exclude_patterns = []
83-
84-
# The reST default role (used for this markup: `text`) to use for all
85-
# documents.
86-
# default_role = None
87-
88-
# If true, '()' will be appended to :func: etc. cross-reference text.
89-
# add_function_parentheses = True
90-
91-
# If true, the current module name will be prepended to all description
92-
# unit titles (such as .. function::).
93-
# add_module_names = True
94-
95-
# If true, sectionauthor and moduleauthor directives will be shown in the
96-
# output. They are ignored by default.
97-
# show_authors = False
98-
99-
# The name of the Pygments (syntax highlighting) style to use.
100-
# pygments_style = "sphinx"
101-
102-
# A list of ignored prefixes for module index sorting.
103-
# modindex_common_prefix = []
104-
105-
# If true, keep warnings as "system message" paragraphs in the built documents.
106-
# keep_warnings = False
107-
35+
exclude_patterns = [
36+
"build",
37+
"Thumbs.db",
38+
".DS_Store",
39+
]
10840

10941
# -- Options for HTML output ----------------------------------------------
11042

111-
# The theme to use for HTML and HTML Help pages. See the documentation for
112-
# a list of builtin themes.
11343
html_theme = "furo"
11444

115-
import os
116-
import subprocess
117-
45+
# --- DYNAMIC BRANCH DETECTION FOR EDIT BUTTON ---
11846
def get_git_branch():
11947
try:
12048
# Check if running on ReadTheDocs
@@ -135,161 +63,10 @@ def get_git_branch():
13563
"source_branch": current_branch,
13664
"source_directory": "docs/source",
13765
}
66+
# ------------------------------------------------
13867

139-
# Theme options are theme-specific and customize the look and feel of a theme
140-
# further. For a list of options available for each theme, see the
141-
# documentation.
142-
# html_theme_options = {}
143-
144-
# Add any paths that contain custom themes here, relative to this directory.
145-
# html_theme_path = []
146-
147-
# The name for this set of Sphinx documents. If None, it defaults to
148-
# "<project> v<release> documentation".
149-
# html_title = None
150-
151-
# A shorter title for the navigation bar. Default is the same as html_title.
152-
# html_short_title = None
153-
154-
# The name of an image file (relative to this directory) to place at the top
155-
# of the sidebar.
15668
html_logo = "mypy_light.svg"
157-
158-
# The name of an image file (within the static path) to use as favicon of the
159-
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
160-
# pixels large.
161-
# html_favicon = None
162-
163-
# Add any paths that contain custom static files (such as style sheets) here,
164-
# relative to this directory. They are copied after the builtin static files,
165-
# so a file named "default.css" will overwrite the builtin "default.css".
166-
# html_static_path = ['_static']
167-
168-
# Add any extra paths that contain custom files (such as robots.txt or
169-
# .htaccess) here, relative to this directory. These files are copied
170-
# directly to the root of the documentation.
171-
# html_extra_path = []
172-
173-
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
174-
# using the given strftime format.
175-
# html_last_updated_fmt = '%b %d, %Y'
176-
177-
# If true, SmartyPants will be used to convert quotes and dashes to
178-
# typographically correct entities.
179-
# html_use_smartypants = True
180-
181-
# Custom sidebar templates, maps document names to template names.
182-
# html_sidebars = {}
183-
184-
# Additional templates that should be rendered to pages, maps page names to
185-
# template names.
186-
# html_additional_pages = {}
187-
188-
# If false, no module index is generated.
189-
# html_domain_indices = True
190-
191-
# If false, no index is generated.
192-
# html_use_index = True
193-
194-
# If true, the index is split into individual pages for each letter.
195-
# html_split_index = False
196-
197-
# If true, links to the reST sources are added to the pages.
198-
# html_show_sourcelink = True
199-
200-
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
201-
# html_show_sphinx = True
202-
203-
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
204-
# html_show_copyright = True
205-
206-
# If true, an OpenSearch description file will be output, and all pages will
207-
# contain a <link> tag referring to it. The value of this option must be the
208-
# base URL from which the finished HTML is served.
209-
# html_use_opensearch = ''
210-
211-
# This is the file name suffix for HTML files (e.g. ".xhtml").
212-
# html_file_suffix = None
213-
214-
# Output file base name for HTML help builder.
215-
htmlhelp_basename = "mypydoc"
216-
217-
218-
# -- Options for LaTeX output ---------------------------------------------
219-
220-
latex_elements = {
221-
# The paper size ('letterpaper' or 'a4paper').
222-
#'papersize': 'letterpaper',
223-
# The font size ('10pt', '11pt' or '12pt').
224-
#'pointsize': '10pt',
225-
# Additional stuff for the LaTeX preamble.
226-
#'preamble': '',
227-
}
228-
229-
# Grouping the document tree into LaTeX files. List of tuples
230-
# (source start file, target name, title,
231-
# author, documentclass [howto, manual, or own class]).
232-
latex_documents = [("index", "Mypy.tex", "Mypy Documentation", "Jukka", "manual")]
233-
234-
# The name of an image file (relative to this directory) to place at the top of
235-
# the title page.
236-
# latex_logo = None
237-
238-
# For "manual" documents, if this is true, then toplevel headings are parts,
239-
# not chapters.
240-
# latex_use_parts = False
241-
242-
# If true, show page references after internal links.
243-
# latex_show_pagerefs = False
244-
245-
# If true, show URL addresses after external links.
246-
# latex_show_urls = False
247-
248-
# Documents to append as an appendix to all manuals.
249-
# latex_appendices = []
250-
251-
# If false, no module index is generated.
252-
# latex_domain_indices = True
253-
254-
255-
# -- Options for manual page output ---------------------------------------
256-
257-
# One entry per manual page. List of tuples
258-
# (source start file, name, description, authors, manual section).
259-
man_pages = [("index", "mypy", "Mypy Documentation", ["Jukka Lehtosalo"], 1)]
260-
261-
# If true, show URL addresses after external links.
262-
# man_show_urls = False
263-
264-
265-
# -- Options for Texinfo output -------------------------------------------
266-
267-
# Grouping the document tree into Texinfo files. List of tuples
268-
# (source start file, target name, title, author,
269-
# dir menu entry, description, category)
270-
texinfo_documents = [
271-
(
272-
"index",
273-
"Mypy",
274-
"Mypy Documentation",
275-
"Jukka",
276-
"Mypy",
277-
"One line description of project.",
278-
"Miscellaneous",
279-
)
280-
]
281-
282-
# Documents to append as an appendix to all manuals.
283-
# texinfo_appendices = []
284-
285-
# If false, no module index is generated.
286-
# texinfo_domain_indices = True
287-
288-
# How to display URL addresses: 'footnote', 'no', or 'inline'.
289-
# texinfo_show_urls = 'footnote'
290-
291-
# If true, do not generate a @detailmenu in the "Top" node's menu.
292-
# texinfo_no_detailmenu = False
69+
html_static_path = ['_static']
29370

29471
rst_prolog = ".. |...| unicode:: U+2026 .. ellipsis\n"
29572

@@ -301,7 +78,6 @@ def get_git_branch():
30178
"setuptools": ("https://setuptools.pypa.io/en/latest", None),
30279
}
30380

304-
30581
def setup(app: Sphinx) -> None:
30682
app.add_object_type(
30783
"confval",

0 commit comments

Comments
 (0)