Skip to content
Myr

conf.py

This file

Path

docs/conf.py

97 lines · 3.2 KiB · Python

Last changed by

Merge pull request #3922 from pallets/consistencyDavid Lordbefore adoptiondcd3b5c

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]23intersphinx_mapping = {24    "python": ("https://docs.python.org/3/", None),25    "werkzeug": ("https://werkzeug.palletsprojects.com/", None),26    "click": ("https://click.palletsprojects.com/", None),27    "jinja": ("https://jinja.palletsprojects.com/", None),28    "itsdangerous": ("https://itsdangerous.palletsprojects.com/", None),29    "sqlalchemy": ("https://docs.sqlalchemy.org/", None),30    "wtforms": ("https://wtforms.readthedocs.io/", None),31    "blinker": ("https://pythonhosted.org/blinker/", None),32}33issues_github_path = "pallets/flask"3435# HTML -----------------------------------------------------------------3637html_theme = "flask"38html_theme_options = {"index_sidebar_logo": False}39html_context = {40    "project_links": [41        ProjectLink("Donate", "https://palletsprojects.com/donate"),42        ProjectLink("PyPI Releases", "https://pypi.org/project/Flask/"),43        ProjectLink("Source Code", "https://github.com/pallets/flask/"),44        ProjectLink("Issue Tracker", "https://github.com/pallets/flask/issues/"),45        ProjectLink("Website", "https://palletsprojects.com/p/flask/"),46        ProjectLink("Twitter", "https://twitter.com/PalletsTeam"),47        ProjectLink("Chat", "https://discord.gg/pallets"),48    ]49}50html_sidebars = {51    "index": ["project.html", "localtoc.html", "searchbox.html"],52    "**": ["localtoc.html", "relations.html", "searchbox.html"],53}54singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]}55html_static_path = ["_static"]56html_favicon = "_static/flask-icon.png"57html_logo = "_static/flask-icon.png"58html_title = f"Flask Documentation ({version})"59html_show_sourcelink = False6061# LaTeX ----------------------------------------------------------------6263latex_documents = [(master_doc, f"Flask-{version}.tex", html_title, author, "manual")]6465# Local Extensions -----------------------------------------------------666768def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):69    app = inliner.document.settings.env.app70    release = app.config.release71    base_url = "https://github.com/pallets/flask/tree/"7273    if text.endswith(">"):74        words, text = text[:-1].rsplit("<", 1)75        words = words.strip()76    else:77        words = None7879    if packaging.version.parse(release).is_devrelease:80        url = f"{base_url}master/{text}"81    else:82        url = f"{base_url}{release}/{text}"8384    if words is None:85        words = url8687    from docutils.nodes import reference88    from docutils.parsers.rst.roles import set_classes8990    options = options or {}91    set_classes(options)92    node = reference(rawtext, words, refuri=url, **options)93    return [node], []949596def setup(app):97    app.add_role("gh", github_link)