| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  | import packaging.version | 
					
						
							|  |  |  | from pallets_sphinx_themes import get_version | 
					
						
							|  |  |  | from pallets_sphinx_themes import ProjectLink | 
					
						
							| 
									
										
										
										
											2010-04-06 22:02:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  | # Project -------------------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2010-04-06 22:02:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  | project = "Flask" | 
					
						
							|  |  |  | copyright = "2010 Pallets" | 
					
						
							|  |  |  | author = "Pallets" | 
					
						
							|  |  |  | release, version = get_version("Flask") | 
					
						
							| 
									
										
										
										
											2010-04-06 22:02:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  | # General -------------------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2010-04-06 22:02:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  | master_doc = "index" | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  | extensions = [ | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  |     "sphinx.ext.autodoc", | 
					
						
							|  |  |  |     "sphinx.ext.intersphinx", | 
					
						
							|  |  |  |     "sphinxcontrib.log_cabinet", | 
					
						
							|  |  |  |     "pallets_sphinx_themes", | 
					
						
							|  |  |  |     "sphinx_issues", | 
					
						
							| 
									
										
										
										
											2020-10-16 05:08:37 +08:00
										 |  |  |     "sphinx_tabs.tabs", | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  | ] | 
					
						
							|  |  |  | intersphinx_mapping = { | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  |     "python": ("https://docs.python.org/3/", None), | 
					
						
							|  |  |  |     "werkzeug": ("https://werkzeug.palletsprojects.com/", None), | 
					
						
							|  |  |  |     "click": ("https://click.palletsprojects.com/", None), | 
					
						
							| 
									
										
										
										
											2019-11-15 12:27:44 +08:00
										 |  |  |     "jinja": ("https://jinja.palletsprojects.com/", None), | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  |     "itsdangerous": ("https://itsdangerous.palletsprojects.com/", None), | 
					
						
							|  |  |  |     "sqlalchemy": ("https://docs.sqlalchemy.org/", None), | 
					
						
							| 
									
										
										
										
											2020-08-07 19:01:42 +08:00
										 |  |  |     "wtforms": ("https://wtforms.readthedocs.io/", None), | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  |     "blinker": ("https://pythonhosted.org/blinker/", None), | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  | issues_github_path = "pallets/flask" | 
					
						
							| 
									
										
										
										
											2010-04-06 22:02:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  | # HTML ----------------------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2010-04-06 22:02:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  | html_theme = "flask" | 
					
						
							|  |  |  | html_theme_options = {"index_sidebar_logo": False} | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  | html_context = { | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  |     "project_links": [ | 
					
						
							| 
									
										
										
										
											2021-02-25 02:09:15 +08:00
										 |  |  |         ProjectLink("Donate", "https://palletsprojects.com/donate"), | 
					
						
							|  |  |  |         ProjectLink("PyPI Releases", "https://pypi.org/project/Flask/"), | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  |         ProjectLink("Source Code", "https://github.com/pallets/flask/"), | 
					
						
							|  |  |  |         ProjectLink("Issue Tracker", "https://github.com/pallets/flask/issues/"), | 
					
						
							| 
									
										
										
										
											2021-02-25 02:09:15 +08:00
										 |  |  |         ProjectLink("Website", "https://palletsprojects.com/p/flask/"), | 
					
						
							|  |  |  |         ProjectLink("Twitter", "https://twitter.com/PalletsTeam"), | 
					
						
							|  |  |  |         ProjectLink("Chat", "https://discord.gg/pallets"), | 
					
						
							| 
									
										
										
										
											2016-06-27 04:03:29 +08:00
										 |  |  |     ] | 
					
						
							| 
									
										
										
										
											2010-04-10 21:49:15 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  | html_sidebars = { | 
					
						
							|  |  |  |     "index": ["project.html", "localtoc.html", "searchbox.html"], | 
					
						
							|  |  |  |     "**": ["localtoc.html", "relations.html", "searchbox.html"], | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  | singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]} | 
					
						
							|  |  |  | html_static_path = ["_static"] | 
					
						
							|  |  |  | html_favicon = "_static/flask-icon.png" | 
					
						
							|  |  |  | html_logo = "_static/flask-icon.png" | 
					
						
							| 
									
										
										
										
											2020-04-05 00:43:06 +08:00
										 |  |  | html_title = f"Flask Documentation ({version})" | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  | html_show_sourcelink = False | 
					
						
							| 
									
										
										
										
											2010-04-06 22:02:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  | # LaTeX ---------------------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2010-04-06 22:02:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-05 00:43:06 +08:00
										 |  |  | latex_documents = [(master_doc, f"Flask-{version}.tex", html_title, author, "manual")] | 
					
						
							| 
									
										
										
										
											2010-04-06 22:02:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  | # Local Extensions ----------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2010-04-09 01:03:15 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  | def github_link(name, rawtext, text, lineno, inliner, options=None, content=None): | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  |     app = inliner.document.settings.env.app | 
					
						
							|  |  |  |     release = app.config.release | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  |     base_url = "https://github.com/pallets/flask/tree/" | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  |     if text.endswith(">"): | 
					
						
							|  |  |  |         words, text = text[:-1].rsplit("<", 1) | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  |         words = words.strip() | 
					
						
							|  |  |  |     else: | 
					
						
							|  |  |  |         words = None | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  |     if packaging.version.parse(release).is_devrelease: | 
					
						
							| 
									
										
										
										
											2020-04-05 00:43:06 +08:00
										 |  |  |         url = f"{base_url}master/{text}" | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  |     else: | 
					
						
							| 
									
										
										
										
											2020-04-05 00:43:06 +08:00
										 |  |  |         url = f"{base_url}{release}/{text}" | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if words is None: | 
					
						
							|  |  |  |         words = url | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     from docutils.nodes import reference | 
					
						
							|  |  |  |     from docutils.parsers.rst.roles import set_classes | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-13 03:44:09 +08:00
										 |  |  |     options = options or {} | 
					
						
							|  |  |  |     set_classes(options) | 
					
						
							|  |  |  |     node = reference(rawtext, words, refuri=url, **options) | 
					
						
							|  |  |  |     return [node], [] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def setup(app): | 
					
						
							| 
									
										
										
										
											2019-09-24 21:35:10 +08:00
										 |  |  |     app.add_role("gh", github_link) |