Skip to content
Myr

conf.py

This file

Path

docs/conf.py

95 lines · 3.1 KiB · Python

Last changed by

Merge pull request #3270 from pallets/metadataDavid Lordbefore adoption31d3c7e

History of this file

Take it

1from pallets_sphinx_themes import get_version2from pallets_sphinx_themes import ProjectLink34# Project --------------------------------------------------------------56project = "Flask"7copyright = "2010 Pallets"8author = "Pallets"9release, version = get_version("Flask")1011# General --------------------------------------------------------------1213master_doc = "index"14extensions = [15    "sphinx.ext.autodoc",16    "sphinx.ext.intersphinx",17    "sphinxcontrib.log_cabinet",18    "pallets_sphinx_themes",19    "sphinx_issues",20]21intersphinx_mapping = {22    "python": ("https://docs.python.org/3/", None),23    "werkzeug": ("https://werkzeug.palletsprojects.com/", None),24    "click": ("https://click.palletsprojects.com/", None),25    "jinja": ("http://jinja.pocoo.org/docs/", None),26    "itsdangerous": ("https://itsdangerous.palletsprojects.com/", None),27    "sqlalchemy": ("https://docs.sqlalchemy.org/", None),28    "wtforms": ("https://wtforms.readthedocs.io/en/stable/", None),29    "blinker": ("https://pythonhosted.org/blinker/", None),30}31issues_github_path = "pallets/flask"3233# HTML -----------------------------------------------------------------3435html_theme = "flask"36html_theme_options = {"index_sidebar_logo": False}37html_context = {38    "project_links": [39        ProjectLink("Donate to Pallets", "https://palletsprojects.com/donate"),40        ProjectLink("Flask Website", "https://palletsprojects.com/p/flask/"),41        ProjectLink("PyPI releases", "https://pypi.org/project/Flask/"),42        ProjectLink("Source Code", "https://github.com/pallets/flask/"),43        ProjectLink("Issue Tracker", "https://github.com/pallets/flask/issues/"),44    ]45}46html_sidebars = {47    "index": ["project.html", "localtoc.html", "searchbox.html"],48    "**": ["localtoc.html", "relations.html", "searchbox.html"],49}50singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]}51html_static_path = ["_static"]52html_favicon = "_static/flask-icon.png"53html_logo = "_static/flask-icon.png"54html_title = "Flask Documentation ({})".format(version)55html_show_sourcelink = False5657# LaTeX ----------------------------------------------------------------5859latex_documents = [60    (master_doc, "Flask-{}.tex".format(version), html_title, author, "manual")61]6263# Local Extensions -----------------------------------------------------646566def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):67    app = inliner.document.settings.env.app68    release = app.config.release69    base_url = "https://github.com/pallets/flask/tree/"7071    if text.endswith(">"):72        words, text = text[:-1].rsplit("<", 1)73        words = words.strip()74    else:75        words = None7677    if release.endswith("dev"):78        url = "{0}master/{1}".format(base_url, text)79    else:80        url = "{0}{1}/{2}".format(base_url, release, text)8182    if words is None:83        words = url8485    from docutils.nodes import reference86    from docutils.parsers.rst.roles import set_classes8788    options = options or {}89    set_classes(options)90    node = reference(rawtext, words, refuri=url, **options)91    return [node], []929394def setup(app):95    app.add_role("gh", github_link)