Skip to content
Myr

conf.py

This file

Path

docs/conf.py

98 lines · 3.3 KiB · Python

Last changed by

Merge branch '2.1.x'David Lordbefore adoption02a0851

History of this file

Take 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 --------------------------------------------------------------1314master_doc = "index"15extensions = [16    "sphinx.ext.autodoc",17    "sphinx.ext.intersphinx",18    "sphinxcontrib.log_cabinet",19    "pallets_sphinx_themes",20    "sphinx_issues",21    "sphinx_tabs.tabs",22]23autodoc_typehints = "description"24intersphinx_mapping = {25    "python": ("https://docs.python.org/3/", None),26    "werkzeug": ("https://werkzeug.palletsprojects.com/", None),27    "click": ("https://click.palletsprojects.com/", None),28    "jinja": ("https://jinja.palletsprojects.com/", None),29    "itsdangerous": ("https://itsdangerous.palletsprojects.com/", None),30    "sqlalchemy": ("https://docs.sqlalchemy.org/", None),31    "wtforms": ("https://wtforms.readthedocs.io/", None),32    "blinker": ("https://blinker.readthedocs.io/", None),33}34issues_github_path = "pallets/flask"3536# HTML -----------------------------------------------------------------3738html_theme = "flask"39html_theme_options = {"index_sidebar_logo": False}40html_context = {41    "project_links": [42        ProjectLink("Donate", "https://palletsprojects.com/donate"),43        ProjectLink("PyPI Releases", "https://pypi.org/project/Flask/"),44        ProjectLink("Source Code", "https://github.com/pallets/flask/"),45        ProjectLink("Issue Tracker", "https://github.com/pallets/flask/issues/"),46        ProjectLink("Website", "https://palletsprojects.com/p/flask/"),47        ProjectLink("Twitter", "https://twitter.com/PalletsTeam"),48        ProjectLink("Chat", "https://discord.gg/pallets"),49    ]50}51html_sidebars = {52    "index": ["project.html", "localtoc.html", "searchbox.html", "ethicalads.html"],53    "**": ["localtoc.html", "relations.html", "searchbox.html", "ethicalads.html"],54}55singlehtml_sidebars = {"index": ["project.html", "localtoc.html", "ethicalads.html"]}56html_static_path = ["_static"]57html_favicon = "_static/flask-icon.png"58html_logo = "_static/flask-icon.png"59html_title = f"Flask Documentation ({version})"60html_show_sourcelink = False6162# LaTeX ----------------------------------------------------------------6364latex_documents = [(master_doc, f"Flask-{version}.tex", html_title, author, "manual")]6566# Local Extensions -----------------------------------------------------676869def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):70    app = inliner.document.settings.env.app71    release = app.config.release72    base_url = "https://github.com/pallets/flask/tree/"7374    if text.endswith(">"):75        words, text = text[:-1].rsplit("<", 1)76        words = words.strip()77    else:78        words = None7980    if packaging.version.parse(release).is_devrelease:81        url = f"{base_url}main/{text}"82    else:83        url = f"{base_url}{release}/{text}"8485    if words is None:86        words = url8788    from docutils.nodes import reference89    from docutils.parsers.rst.roles import set_classes9091    options = options or {}92    set_classes(options)93    node = reference(rawtext, words, refuri=url, **options)94    return [node], []959697def setup(app):98    app.add_role("gh", github_link)