Skip to content
Myr

conf.py

This file

Path

docs/conf.py

96 lines · 3.1 KiB · Python

Last changed by

Merge branch '1.0.x' into 1.1.xDavid Lordbefore adoption7fdd0df

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": ("http://jinja.pocoo.org/docs/", 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 = "Flask Documentation ({})".format(version)56html_show_sourcelink = False5758# LaTeX ----------------------------------------------------------------5960latex_documents = [61    (master_doc, "Flask-{}.tex".format(version), html_title, author, "manual")62]6364# Local Extensions -----------------------------------------------------656667def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):68    app = inliner.document.settings.env.app69    release = app.config.release70    base_url = "https://github.com/pallets/flask/tree/"7172    if text.endswith(">"):73        words, text = text[:-1].rsplit("<", 1)74        words = words.strip()75    else:76        words = None7778    if packaging.version.parse(release).is_devrelease:79        url = "{0}master/{1}".format(base_url, text)80    else:81        url = "{0}{1}/{2}".format(base_url, release, text)8283    if words is None:84        words = url8586    from docutils.nodes import reference87    from docutils.parsers.rst.roles import set_classes8889    options = options or {}90    set_classes(options)91    node = reference(rawtext, words, refuri=url, **options)92    return [node], []939495def setup(app):96    app.add_role("gh", github_link)