conf.py
This file
Path
docs/conf.py
105 lines · 3.4 KiB · Python
Last changed by
Merge branch '1.0-maintenance'David Lordbefore adoptionf7d50d4
History of this fileTake it
1from __future__ import print_function23from pallets_sphinx_themes import get_version4from pallets_sphinx_themes import ProjectLink56# 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", "versions.html", "searchbox.html"],48 "**": ["localtoc.html", "relations.html", "versions.html", "searchbox.html"],49}50singlehtml_sidebars = {"index": ["project.html", "versions.html", "localtoc.html"]}51html_static_path = ["_static"]52html_favicon = "_static/flask-icon.png"53html_logo = "_static/flask-logo-sidebar.png"54html_title = "Flask Documentation ({})".format(version)55html_show_sourcelink = False56html_domain_indices = False5758# LaTeX ----------------------------------------------------------------5960latex_documents = [61 (master_doc, "Flask-{}.tex".format(version), html_title, author, "manual")62]63latex_use_modindex = False64latex_elements = {65 "papersize": "a4paper",66 "pointsize": "12pt",67 "fontpkg": r"\usepackage{mathpazo}",68 "preamble": r"\usepackage{flaskstyle}",69}70latex_use_parts = True71latex_additional_files = ["flaskstyle.sty", "logo.pdf"]7273# Local Extensions -----------------------------------------------------747576def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):77 app = inliner.document.settings.env.app78 release = app.config.release79 base_url = "https://github.com/pallets/flask/tree/"8081 if text.endswith(">"):82 words, text = text[:-1].rsplit("<", 1)83 words = words.strip()84 else:85 words = None8687 if release.endswith("dev"):88 url = "{0}master/{1}".format(base_url, text)89 else:90 url = "{0}{1}/{2}".format(base_url, release, text)9192 if words is None:93 words = url9495 from docutils.nodes import reference96 from docutils.parsers.rst.roles import set_classes9798 options = options or {}99 set_classes(options)100 node = reference(rawtext, words, refuri=url, **options)101 return [node], []102103104def setup(app):105 app.add_role("gh", github_link)