conf.py
This file
Path
docs/conf.py
101 lines · 3.3 KiB · Python
Last changed by
Merge branch 'stable'David Lordbefore adoption85c5d93
History of this fileTake it
The walk stopped after 200 commits: lines older than 73739a2 point at it.
Merge branch '2.2.x'David Lordbefore adoption73739a2
lines 1–13why, one step back1import packaging.version2from pallets_sphinx_themes import get_version3from pallets_sphinx_themes import ProjectLink45# Project --------------------------------------------------------------67project = "Flask"8copyright = "2010 Pallets"9author = "Pallets"10release, version = get_version("Flask")1112# General --------------------------------------------------------------13Merge branch '3.0.x'David Lordbefore adoption6ab71ed
line 14why, one step back14default_role = "code"Merge branch '2.2.x'David Lordbefore adoption73739a2
lines 15–16why, one step back15extensions = [16 "sphinx.ext.autodoc",Merge branch '3.0.x'David Lordbefore adoption6ab71ed
line 17why, one step back17 "sphinx.ext.extlinks",Merge branch '2.2.x'David Lordbefore adoption73739a2
lines 18–20why, one step back18 "sphinx.ext.intersphinx",19 "sphinxcontrib.log_cabinet",20 "sphinx_tabs.tabs",Merge branch '3.0.x'David Lordbefore adoption6ab71ed
line 21why, one step back21 "pallets_sphinx_themes",Merge branch '2.2.x'David Lordbefore adoption73739a2
line 22why, one step back22]Merge branch '3.0.x'David Lordbefore adoption6ab71ed
line 23why, one step back23autodoc_member_order = "bysource"Merge branch '2.2.x'David Lordbefore adoption73739a2
line 24why, one step back24autodoc_typehints = "description"Merge branch '3.0.x'David Lordbefore adoption6ab71ed
lines 25–28why, one step back25autodoc_preserve_defaults = True26extlinks = {27 "issue": ("https://github.com/pallets/flask/issues/%s", "#%s"),28 "pr": ("https://github.com/pallets/flask/pull/%s", "#%s"),Merge branch 'stable'David Lordbefore adoptionb78b5a2
line 29why, one step back29 "ghsa": ("https://github.com/pallets/flask/security/advisories/GHSA-%s", "GHSA-%s"),Merge branch '3.0.x'David Lordbefore adoption6ab71ed
line 30why, one step back30}Merge branch '2.2.x'David Lordbefore adoption73739a2
lines 31–60why, one step back31intersphinx_mapping = {32 "python": ("https://docs.python.org/3/", None),33 "werkzeug": ("https://werkzeug.palletsprojects.com/", None),34 "click": ("https://click.palletsprojects.com/", None),35 "jinja": ("https://jinja.palletsprojects.com/", None),36 "itsdangerous": ("https://itsdangerous.palletsprojects.com/", None),37 "sqlalchemy": ("https://docs.sqlalchemy.org/", None),38 "wtforms": ("https://wtforms.readthedocs.io/", None),39 "blinker": ("https://blinker.readthedocs.io/", None),40}4142# HTML -----------------------------------------------------------------4344html_theme = "flask"45html_theme_options = {"index_sidebar_logo": False}46html_context = {47 "project_links": [48 ProjectLink("Donate", "https://palletsprojects.com/donate"),49 ProjectLink("PyPI Releases", "https://pypi.org/project/Flask/"),50 ProjectLink("Source Code", "https://github.com/pallets/flask/"),51 ProjectLink("Issue Tracker", "https://github.com/pallets/flask/issues/"),52 ProjectLink("Chat", "https://discord.gg/pallets"),53 ]54}55html_sidebars = {56 "index": ["project.html", "localtoc.html", "searchbox.html", "ethicalads.html"],57 "**": ["localtoc.html", "relations.html", "searchbox.html", "ethicalads.html"],58}59singlehtml_sidebars = {"index": ["project.html", "localtoc.html", "ethicalads.html"]}60html_static_path = ["_static"]Merge branch 'stable'David Lordbefore adoption211cce0
line 61why, one step back61html_favicon = "_static/flask-icon.svg"Merge branch 'stable'David Lordbefore adoption85c5d93
line 62why, one step back62html_logo = "_static/flask-logo.svg"Merge branch '2.2.x'David Lordbefore adoption73739a2
lines 63–65why, one step back63html_title = f"Flask Documentation ({version})"64html_show_sourcelink = False65Merge branch 'stable'David Lordbefore adoption6b054f8
lines 66–68why, one step back66gettext_uuid = True67gettext_compact = False68Merge branch '2.2.x'David Lordbefore adoption73739a2
lines 69–101why, one step back69# Local Extensions -----------------------------------------------------707172def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):73 app = inliner.document.settings.env.app74 release = app.config.release75 base_url = "https://github.com/pallets/flask/tree/"7677 if text.endswith(">"):78 words, text = text[:-1].rsplit("<", 1)79 words = words.strip()80 else:81 words = None8283 if packaging.version.parse(release).is_devrelease:84 url = f"{base_url}main/{text}"85 else:86 url = f"{base_url}{release}/{text}"8788 if words is None:89 words = url9091 from docutils.nodes import reference92 from docutils.parsers.rst.roles import set_classes9394 options = options or {}95 set_classes(options)96 node = reference(rawtext, words, refuri=url, **options)97 return [node], []9899100def setup(app):101 app.add_role("gh", github_link)