Skip to content
Myr

conf.py

This file

Path

docs/conf.py

104 lines · 3.3 KiB · Python

Last changed by

Merge pull request #3064 from pallets/docs-fixDavid Lordbefore adoption1096e22

History of this file

Take it

1# -*- coding: utf-8 -*-2from __future__ import print_function34from pallets_sphinx_themes import ProjectLink, get_version56# Project --------------------------------------------------------------78project = "Flask"9copyright = "2010 Pallets Team"10author = "Pallets Team"11release, version = get_version("Flask")1213# General --------------------------------------------------------------1415master_doc = "index"16extensions = [17    "sphinx.ext.autodoc",18    "sphinx.ext.intersphinx",19    "sphinxcontrib.log_cabinet",20    "pallets_sphinx_themes",21]22intersphinx_mapping = {23    "python": ("https://docs.python.org/3/", None),24    "werkzeug": ("http://werkzeug.pocoo.org/docs/", 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}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-favicon.ico"53html_logo = "_static/flask.png"54html_title = "Flask Documentation ({})".format(version)55html_show_sourcelink = False5657# LaTeX ----------------------------------------------------------------5859latex_documents = [60    (master_doc, "Flask.tex", "Flask Documentation", "Pallets Team", "manual")61]62latex_use_modindex = False63latex_elements = {64    "papersize": "a4paper",65    "pointsize": "12pt",66    "fontpkg": r"\usepackage{mathpazo}",67    "preamble": r"\usepackage{flaskstyle}",68}69latex_use_parts = True70latex_additional_files = ["flaskstyle.sty", "logo.pdf"]7172# Local Extensions -----------------------------------------------------737475def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):76    app = inliner.document.settings.env.app77    release = app.config.release78    base_url = "https://github.com/pallets/flask/tree/"7980    if text.endswith(">"):81        words, text = text[:-1].rsplit("<", 1)82        words = words.strip()83    else:84        words = None8586    if release.endswith("dev"):87        url = "{0}master/{1}".format(base_url, text)88    else:89        url = "{0}{1}/{2}".format(base_url, release, text)9091    if words is None:92        words = url9394    from docutils.nodes import reference95    from docutils.parsers.rst.roles import set_classes9697    options = options or {}98    set_classes(options)99    node = reference(rawtext, words, refuri=url, **options)100    return [node], []101102103def setup(app):104    app.add_role("gh", github_link)