Skip to content
Myr

conf.py

This file

Path

docs/conf.py

94 lines · 3.1 KiB · Python

Last changed by

Merge pull request #3554 from pallets/drop-python2David Lordbefore adoptioncd8a374

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]22intersphinx_mapping = {23    "python": ("https://docs.python.org/3/", None),24    "werkzeug": ("https://werkzeug.palletsprojects.com/", None),25    "click": ("https://click.palletsprojects.com/", None),26    "jinja": ("https://jinja.palletsprojects.com/", None),27    "itsdangerous": ("https://itsdangerous.palletsprojects.com/", None),28    "sqlalchemy": ("https://docs.sqlalchemy.org/", None),29    "wtforms": ("https://wtforms.readthedocs.io/en/stable/", None),30    "blinker": ("https://pythonhosted.org/blinker/", None),31}32issues_github_path = "pallets/flask"3334# HTML -----------------------------------------------------------------3536html_theme = "flask"37html_theme_options = {"index_sidebar_logo": False}38html_context = {39    "project_links": [40        ProjectLink("Donate to Pallets", "https://palletsprojects.com/donate"),41        ProjectLink("Flask Website", "https://palletsprojects.com/p/flask/"),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    ]46}47html_sidebars = {48    "index": ["project.html", "localtoc.html", "searchbox.html"],49    "**": ["localtoc.html", "relations.html", "searchbox.html"],50}51singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]}52html_static_path = ["_static"]53html_favicon = "_static/flask-icon.png"54html_logo = "_static/flask-icon.png"55html_title = f"Flask Documentation ({version})"56html_show_sourcelink = False5758# LaTeX ----------------------------------------------------------------5960latex_documents = [(master_doc, f"Flask-{version}.tex", html_title, author, "manual")]6162# Local Extensions -----------------------------------------------------636465def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):66    app = inliner.document.settings.env.app67    release = app.config.release68    base_url = "https://github.com/pallets/flask/tree/"6970    if text.endswith(">"):71        words, text = text[:-1].rsplit("<", 1)72        words = words.strip()73    else:74        words = None7576    if packaging.version.parse(release).is_devrelease:77        url = f"{base_url}master/{text}"78    else:79        url = f"{base_url}{release}/{text}"8081    if words is None:82        words = url8384    from docutils.nodes import reference85    from docutils.parsers.rst.roles import set_classes8687    options = options or {}88    set_classes(options)89    node = reference(rawtext, words, refuri=url, **options)90    return [node], []919293def setup(app):94    app.add_role("gh", github_link)