conf.py
This file
Path
docs/conf.py
97 lines · 3.1 KiB · Python
Last changed by
Merge branch '1.0.x' into 1.1.xDavid Lordbefore adoption02cfee8
History of this fileTake it
1import packaging23from pallets_sphinx_themes import get_version4from pallets_sphinx_themes import ProjectLink56# Project --------------------------------------------------------------78project = "Flask"9copyright = "2010 Pallets"10author = "Pallets"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 "sphinx_issues",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": ("http://jinja.pocoo.org/docs/", None),28 "itsdangerous": ("https://itsdangerous.palletsprojects.com/", None),29 "sqlalchemy": ("https://docs.sqlalchemy.org/", None),30 "wtforms": ("https://wtforms.readthedocs.io/en/stable/", 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 to Pallets", "https://palletsprojects.com/donate"),42 ProjectLink("Flask Website", "https://palletsprojects.com/p/flask/"),43 ProjectLink("PyPI releases", "https://pypi.org/project/Flask/"),44 ProjectLink("Source Code", "https://github.com/pallets/flask/"),45 ProjectLink("Issue Tracker", "https://github.com/pallets/flask/issues/"),46 ]47}48html_sidebars = {49 "index": ["project.html", "localtoc.html", "searchbox.html"],50 "**": ["localtoc.html", "relations.html", "searchbox.html"],51}52singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]}53html_static_path = ["_static"]54html_favicon = "_static/flask-icon.png"55html_logo = "_static/flask-icon.png"56html_title = "Flask Documentation ({})".format(version)57html_show_sourcelink = False5859# LaTeX ----------------------------------------------------------------6061latex_documents = [62 (master_doc, "Flask-{}.tex".format(version), html_title, author, "manual")63]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 = "{0}master/{1}".format(base_url, text)81 else:82 url = "{0}{1}/{2}".format(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)