conf.py
This file
Path
docs/conf.py
100 lines · 3.2 KiB · Python
Last changed by
add gettext config for docsDavid Lordbefore adoption18ffe1e
History of this fileTake it
1import 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 --------------------------------------------------------------1314default_role = "code"15extensions = [16 "sphinx.ext.autodoc",17 "sphinx.ext.extlinks",18 "sphinx.ext.intersphinx",19 "sphinxcontrib.log_cabinet",20 "sphinx_tabs.tabs",21 "pallets_sphinx_themes",22]23autodoc_member_order = "bysource"24autodoc_typehints = "description"25autodoc_preserve_defaults = True26extlinks = {27 "issue": ("https://github.com/pallets/flask/issues/%s", "#%s"),28 "pr": ("https://github.com/pallets/flask/pull/%s", "#%s"),29}30intersphinx_mapping = {31 "python": ("https://docs.python.org/3/", None),32 "werkzeug": ("https://werkzeug.palletsprojects.com/", None),33 "click": ("https://click.palletsprojects.com/", None),34 "jinja": ("https://jinja.palletsprojects.com/", None),35 "itsdangerous": ("https://itsdangerous.palletsprojects.com/", None),36 "sqlalchemy": ("https://docs.sqlalchemy.org/", None),37 "wtforms": ("https://wtforms.readthedocs.io/", None),38 "blinker": ("https://blinker.readthedocs.io/", None),39}4041# HTML -----------------------------------------------------------------4243html_theme = "flask"44html_theme_options = {"index_sidebar_logo": False}45html_context = {46 "project_links": [47 ProjectLink("Donate", "https://palletsprojects.com/donate"),48 ProjectLink("PyPI Releases", "https://pypi.org/project/Flask/"),49 ProjectLink("Source Code", "https://github.com/pallets/flask/"),50 ProjectLink("Issue Tracker", "https://github.com/pallets/flask/issues/"),51 ProjectLink("Chat", "https://discord.gg/pallets"),52 ]53}54html_sidebars = {55 "index": ["project.html", "localtoc.html", "searchbox.html", "ethicalads.html"],56 "**": ["localtoc.html", "relations.html", "searchbox.html", "ethicalads.html"],57}58singlehtml_sidebars = {"index": ["project.html", "localtoc.html", "ethicalads.html"]}59html_static_path = ["_static"]60html_favicon = "_static/shortcut-icon.png"61html_logo = "_static/flask-vertical.png"62html_title = f"Flask Documentation ({version})"63html_show_sourcelink = False6465gettext_uuid = True66gettext_compact = False6768# Local Extensions -----------------------------------------------------697071def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):72 app = inliner.document.settings.env.app73 release = app.config.release74 base_url = "https://github.com/pallets/flask/tree/"7576 if text.endswith(">"):77 words, text = text[:-1].rsplit("<", 1)78 words = words.strip()79 else:80 words = None8182 if packaging.version.parse(release).is_devrelease:83 url = f"{base_url}main/{text}"84 else:85 url = f"{base_url}{release}/{text}"8687 if words is None:88 words = url8990 from docutils.nodes import reference91 from docutils.parsers.rst.roles import set_classes9293 options = options or {}94 set_classes(options)95 node = reference(rawtext, words, refuri=url, **options)96 return [node], []979899def setup(app):100 app.add_role("gh", github_link)