1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 from __future__
import absolute_import
, unicode_literals
10 from recommonmark
.transform
import AutoStructify
12 # Set up Python environment to load build system packages.
13 OUR_DIR
= os
.path
.dirname(__file__
)
14 topsrcdir
= os
.path
.normpath(os
.path
.join(OUR_DIR
, ".."))
16 # Escapes $, [, ] and 3 dots in copy button
17 copybutton_prompt_text
= r
">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
18 copybutton_prompt_is_regexp
= True
21 "layout/tools/reftest",
24 "python/mozversioncontrol",
25 "testing/mozbase/manifestparser",
26 "testing/mozbase/mozfile",
27 "testing/mozbase/mozprocess",
28 "third_party/python/futures",
29 "third_party/python/jsmin",
30 "third_party/python/which",
33 sys
.path
[:0] = [os
.path
.join(topsrcdir
, p
) for p
in EXTRA_PATHS
]
35 sys
.path
.insert(0, OUR_DIR
)
39 "sphinx.ext.autosectionlabel",
41 "sphinx.ext.graphviz",
42 "sphinx.ext.napoleon",
46 "sphinxcontrib.mermaid",
49 "sphinx_markdown_tables",
53 # JSDoc must run successfully for dirs specified, so running
54 # tree-wide (the default) will not work currently.
56 "../browser/components/extensions",
57 "../browser/components/uitour",
58 "../testing/marionette",
59 "../toolkit/components/extensions",
60 "../toolkit/components/extensions/parent",
61 "../toolkit/components/featuregates",
62 "../toolkit/mozapps/extensions",
63 "../toolkit/components/prompts/src",
64 "../toolkit/components/pictureinpicture",
65 "../toolkit/components/pictureinpicture/content",
67 root_for_relative_js_paths
= ".."
68 jsdoc_config_path
= "jsdoc.json"
70 templates_path
= ["_templates"]
71 source_suffix
= [".rst", ".md"]
73 project
= "Firefox Source Docs"
74 html_logo
= os
.path
.join(
75 topsrcdir
, "browser/branding/nightly/content/firefox-wordmark.svg"
77 html_favicon
= os
.path
.join(topsrcdir
, "browser/branding/nightly/firefox.ico")
78 html_js_files
= ["https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.9.1/mermaid.js"]
80 exclude_patterns
= ["_build", "_staging", "_venv"]
81 pygments_style
= "sphinx"
83 # We need to perform some adjustment of the settings and environment
84 # when running on Read The Docs.
85 on_rtd
= os
.environ
.get("READTHEDOCS", None) == "True"
88 # SHELL isn't set on RTD and mach.mixin.process's import raises if a
89 # shell-related environment variable can't be found. Set the variable here
90 # to hack us into working on RTD.
91 assert "SHELL" not in os
.environ
92 os
.environ
["SHELL"] = "/bin/bash"
94 # We only need to set the RTD theme when not on RTD because the RTD
95 # environment handles this otherwise.
96 import sphinx_rtd_theme
98 html_theme
= "sphinx_rtd_theme"
99 html_theme_path
= [sphinx_rtd_theme
.get_html_theme_path()]
102 html_static_path
= ["_static"]
103 htmlhelp_basename
= "MozillaTreeDocs"
105 moz_project_name
= "main"
107 html_show_copyright
= False
109 # Only run autosection for the page title.
110 # Otherwise, we have a huge number of duplicate links.
111 # For example, the page https://firefox-source-docs.mozilla.org/code-quality/lint/
112 # is called "Linting"
113 # just like https://firefox-source-docs.mozilla.org/remote/CodeStyle.html
114 autosectionlabel_maxdepth
= 1
117 def install_sphinx_panels(app
, pagename
, templatename
, context
, doctree
):
118 if "raptor" in pagename
:
119 app
.add_js_file("sphinx_panels.js")
120 app
.add_css_file("sphinx_panels.css")
124 app
.add_config_value(
125 "recommonmark_config",
127 # Crashes with sphinx
128 "enable_inline_math": False,
129 # We use it for testing/web-platform/tests
130 "enable_eval_rst": True,
134 app
.add_stylesheet("custom_theme.css")
135 app
.add_transform(AutoStructify
)
136 app
.connect("html-page-context", install_sphinx_panels
)