2013-09-20 22:46:43 +00:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
import os
|
2014-12-24 17:46:41 +00:00
|
|
|
import sys
|
2019-11-26 20:50:31 +00:00
|
|
|
|
2014-12-24 17:46:41 +00:00
|
|
|
# Set up Python environment to load build system packages.
|
|
|
|
OUR_DIR = os.path.dirname(__file__)
|
2020-06-04 12:42:45 +00:00
|
|
|
topsrcdir = os.path.normpath(os.path.join(OUR_DIR, ".."))
|
2013-09-20 22:46:43 +00:00
|
|
|
|
2021-01-02 15:39:07 +00:00
|
|
|
# Escapes $, [, ] and 3 dots in copy button
|
|
|
|
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
|
2020-06-23 15:03:30 +00:00
|
|
|
copybutton_prompt_is_regexp = True
|
|
|
|
|
2015-10-09 20:03:52 +00:00
|
|
|
EXTRA_PATHS = (
|
2020-06-04 12:42:45 +00:00
|
|
|
"layout/tools/reftest",
|
|
|
|
"python/mach",
|
|
|
|
"python/mozbuild",
|
|
|
|
"python/mozversioncontrol",
|
|
|
|
"testing/mozbase/manifestparser",
|
|
|
|
"testing/mozbase/mozfile",
|
|
|
|
"testing/mozbase/mozprocess",
|
2023-08-21 10:52:36 +00:00
|
|
|
"testing/mozbase/moznetwork",
|
2020-06-04 12:42:45 +00:00
|
|
|
"third_party/python/jsmin",
|
|
|
|
"third_party/python/which",
|
2022-01-31 15:12:40 +00:00
|
|
|
"docs/_addons",
|
2023-02-07 15:32:24 +00:00
|
|
|
"taskcluster/gecko_taskgraph/test",
|
2015-10-09 20:03:52 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
sys.path[:0] = [os.path.join(topsrcdir, p) for p in EXTRA_PATHS]
|
|
|
|
|
2014-12-24 17:46:41 +00:00
|
|
|
sys.path.insert(0, OUR_DIR)
|
2013-09-20 22:46:43 +00:00
|
|
|
|
|
|
|
extensions = [
|
2021-12-20 09:45:44 +00:00
|
|
|
"myst_parser",
|
2020-06-04 12:42:45 +00:00
|
|
|
"sphinx.ext.autodoc",
|
|
|
|
"sphinx.ext.autosectionlabel",
|
|
|
|
"sphinx.ext.doctest",
|
|
|
|
"sphinx.ext.graphviz",
|
|
|
|
"sphinx.ext.napoleon",
|
|
|
|
"sphinx.ext.todo",
|
|
|
|
"mozbuild.sphinx",
|
|
|
|
"sphinx_js",
|
|
|
|
"sphinxcontrib.mermaid",
|
|
|
|
"sphinx_copybutton",
|
2020-07-17 17:11:33 +00:00
|
|
|
"sphinx_markdown_tables",
|
2023-03-30 08:01:21 +00:00
|
|
|
"sphinx_design",
|
2022-01-31 15:12:40 +00:00
|
|
|
"bzlink",
|
2013-09-20 22:46:43 +00:00
|
|
|
]
|
|
|
|
|
2017-09-14 20:17:09 +00:00
|
|
|
# JSDoc must run successfully for dirs specified, so running
|
|
|
|
# tree-wide (the default) will not work currently.
|
2023-03-24 19:35:25 +00:00
|
|
|
# When adding more paths to this list, please ensure that they are not
|
|
|
|
# excluded from valid-jsdoc in the top-level .eslintrc.js.
|
2017-12-06 02:54:34 +00:00
|
|
|
js_source_path = [
|
2020-08-11 15:26:16 +00:00
|
|
|
"../browser/components/extensions",
|
2022-12-06 17:50:40 +00:00
|
|
|
"../browser/components/migration",
|
2022-12-06 17:50:40 +00:00
|
|
|
"../browser/components/migration/content",
|
2020-08-11 15:26:16 +00:00
|
|
|
"../browser/components/uitour",
|
2022-03-11 17:51:18 +00:00
|
|
|
"../browser/components/urlbar",
|
2021-05-31 17:36:06 +00:00
|
|
|
"../remote/marionette",
|
2022-11-11 15:56:31 +00:00
|
|
|
"../testing/mochitest/BrowserTestUtils",
|
|
|
|
"../testing/mochitest/tests/SimpleTest/SimpleTest.js",
|
|
|
|
"../testing/mochitest/tests/SimpleTest/EventUtils.js",
|
2022-11-17 12:00:25 +00:00
|
|
|
"../testing/modules/Assert.sys.mjs",
|
|
|
|
"../testing/modules/TestUtils.sys.mjs",
|
2022-04-22 20:46:11 +00:00
|
|
|
"../toolkit/actors",
|
2020-08-11 15:26:16 +00:00
|
|
|
"../toolkit/components/extensions",
|
|
|
|
"../toolkit/components/extensions/parent",
|
|
|
|
"../toolkit/components/featuregates",
|
|
|
|
"../toolkit/mozapps/extensions",
|
|
|
|
"../toolkit/components/prompts/src",
|
2021-03-26 21:55:19 +00:00
|
|
|
"../toolkit/components/pictureinpicture",
|
|
|
|
"../toolkit/components/pictureinpicture/content",
|
2023-04-12 14:06:07 +00:00
|
|
|
"../toolkit/components/search",
|
2020-08-11 15:26:16 +00:00
|
|
|
]
|
|
|
|
root_for_relative_js_paths = ".."
|
2020-06-04 12:42:45 +00:00
|
|
|
jsdoc_config_path = "jsdoc.json"
|
2017-09-14 20:17:09 +00:00
|
|
|
|
2020-06-04 12:42:45 +00:00
|
|
|
templates_path = ["_templates"]
|
|
|
|
source_suffix = [".rst", ".md"]
|
|
|
|
master_doc = "index"
|
|
|
|
project = "Firefox Source Docs"
|
2023-01-26 14:21:06 +00:00
|
|
|
|
2022-03-29 15:19:47 +00:00
|
|
|
# Override the search box to use Google instead of
|
2023-01-26 14:21:06 +00:00
|
|
|
# sphinx search on firefox-source-docs.mozilla.org
|
|
|
|
if (
|
|
|
|
os.environ.get("MOZ_SOURCE_DOCS_USE_GOOGLE") == "1"
|
|
|
|
and os.environ.get("MOZ_SCM_LEVEL") == "3"
|
|
|
|
):
|
|
|
|
templates_path.append("_search_template")
|
|
|
|
|
2022-03-29 15:19:47 +00:00
|
|
|
html_sidebars = {
|
|
|
|
"**": [
|
|
|
|
"searchbox.html",
|
|
|
|
]
|
|
|
|
}
|
2020-06-08 19:06:44 +00:00
|
|
|
html_logo = os.path.join(
|
|
|
|
topsrcdir, "browser/branding/nightly/content/firefox-wordmark.svg"
|
|
|
|
)
|
|
|
|
html_favicon = os.path.join(topsrcdir, "browser/branding/nightly/firefox.ico")
|
2013-09-20 22:46:43 +00:00
|
|
|
|
2023-04-25 11:07:07 +00:00
|
|
|
exclude_patterns = ["_build", "_staging", "_venv", "**security/nss/legacy/**"]
|
2020-06-04 12:42:45 +00:00
|
|
|
pygments_style = "sphinx"
|
2023-03-30 08:01:21 +00:00
|
|
|
# generate label “slugs” for header anchors so that
|
|
|
|
# we can reference them from markdown links.
|
|
|
|
myst_heading_anchors = 5
|
2013-09-20 22:46:43 +00:00
|
|
|
|
2015-11-04 16:26:26 +00:00
|
|
|
# We need to perform some adjustment of the settings and environment
|
|
|
|
# when running on Read The Docs.
|
2020-06-04 12:42:45 +00:00
|
|
|
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
|
2014-10-30 17:09:29 +00:00
|
|
|
|
2015-11-04 16:26:26 +00:00
|
|
|
if on_rtd:
|
|
|
|
# SHELL isn't set on RTD and mach.mixin.process's import raises if a
|
|
|
|
# shell-related environment variable can't be found. Set the variable here
|
|
|
|
# to hack us into working on RTD.
|
2020-06-04 12:42:45 +00:00
|
|
|
assert "SHELL" not in os.environ
|
|
|
|
os.environ["SHELL"] = "/bin/bash"
|
2015-11-04 16:26:26 +00:00
|
|
|
else:
|
|
|
|
# We only need to set the RTD theme when not on RTD because the RTD
|
|
|
|
# environment handles this otherwise.
|
2014-10-30 17:09:29 +00:00
|
|
|
import sphinx_rtd_theme
|
2020-06-04 12:42:45 +00:00
|
|
|
|
|
|
|
html_theme = "sphinx_rtd_theme"
|
2014-10-30 17:09:29 +00:00
|
|
|
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
|
|
|
|
2013-09-20 22:46:43 +00:00
|
|
|
|
2020-06-04 12:42:45 +00:00
|
|
|
html_static_path = ["_static"]
|
2021-12-20 10:20:23 +00:00
|
|
|
htmlhelp_basename = "FirefoxTreeDocs"
|
2017-08-24 18:12:21 +00:00
|
|
|
|
2020-06-04 12:42:45 +00:00
|
|
|
moz_project_name = "main"
|
2019-10-22 17:37:38 +00:00
|
|
|
|
|
|
|
html_show_copyright = False
|
2019-11-26 20:50:31 +00:00
|
|
|
|
2020-09-21 15:31:57 +00:00
|
|
|
# Only run autosection for the page title.
|
|
|
|
# Otherwise, we have a huge number of duplicate links.
|
|
|
|
# For example, the page https://firefox-source-docs.mozilla.org/code-quality/lint/
|
|
|
|
# is called "Linting"
|
|
|
|
# just like https://firefox-source-docs.mozilla.org/remote/CodeStyle.html
|
|
|
|
autosectionlabel_maxdepth = 1
|
|
|
|
|
2019-11-26 20:50:31 +00:00
|
|
|
|
2023-03-30 08:01:21 +00:00
|
|
|
def install_sphinx_design(app, pagename, templatename, context, doctree):
|
2021-11-02 19:11:06 +00:00
|
|
|
if "perfdocs" in pagename:
|
2023-03-30 08:01:21 +00:00
|
|
|
app.add_js_file("sphinx_design.js")
|
|
|
|
app.add_css_file("sphinx_design.css")
|
2021-04-27 18:19:03 +00:00
|
|
|
|
|
|
|
|
2019-11-26 20:50:31 +00:00
|
|
|
def setup(app):
|
2021-07-16 17:38:43 +00:00
|
|
|
app.add_css_file("custom_theme.css")
|
2023-03-30 08:01:21 +00:00
|
|
|
app.connect("html-page-context", install_sphinx_design)
|