2013-09-21 02:46:43 +04: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 20:46:41 +03:00
|
|
|
import sys
|
2019-11-26 23:50:31 +03:00
|
|
|
|
2014-12-24 20:46:41 +03:00
|
|
|
# Set up Python environment to load build system packages.
|
|
|
|
OUR_DIR = os.path.dirname(__file__)
|
2020-06-04 15:42:45 +03:00
|
|
|
topsrcdir = os.path.normpath(os.path.join(OUR_DIR, ".."))
|
2013-09-21 02:46:43 +04:00
|
|
|
|
2021-01-02 18:39:07 +03:00
|
|
|
# Escapes $, [, ] and 3 dots in copy button
|
|
|
|
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
|
2020-06-23 18:03:30 +03:00
|
|
|
copybutton_prompt_is_regexp = True
|
|
|
|
|
2015-10-09 23:03:52 +03:00
|
|
|
EXTRA_PATHS = (
|
2020-06-04 15:42:45 +03:00
|
|
|
"layout/tools/reftest",
|
|
|
|
"python/mach",
|
|
|
|
"python/mozbuild",
|
|
|
|
"python/mozversioncontrol",
|
|
|
|
"testing/mozbase/manifestparser",
|
|
|
|
"testing/mozbase/mozfile",
|
|
|
|
"testing/mozbase/mozprocess",
|
2023-08-21 13:52:36 +03:00
|
|
|
"testing/mozbase/moznetwork",
|
2020-06-04 15:42:45 +03:00
|
|
|
"third_party/python/jsmin",
|
|
|
|
"third_party/python/which",
|
2022-01-31 18:12:40 +03:00
|
|
|
"docs/_addons",
|
2023-02-07 18:32:24 +03:00
|
|
|
"taskcluster/gecko_taskgraph/test",
|
2015-10-09 23:03:52 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
sys.path[:0] = [os.path.join(topsrcdir, p) for p in EXTRA_PATHS]
|
|
|
|
|
2014-12-24 20:46:41 +03:00
|
|
|
sys.path.insert(0, OUR_DIR)
|
2013-09-21 02:46:43 +04:00
|
|
|
|
|
|
|
extensions = [
|
2021-12-20 12:45:44 +03:00
|
|
|
"myst_parser",
|
2020-06-04 15:42:45 +03: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 20:11:33 +03:00
|
|
|
"sphinx_markdown_tables",
|
2023-03-30 11:01:21 +03:00
|
|
|
"sphinx_design",
|
2022-01-31 18:12:40 +03:00
|
|
|
"bzlink",
|
2013-09-21 02:46:43 +04:00
|
|
|
]
|
|
|
|
|
2017-09-14 23:17:09 +03:00
|
|
|
# JSDoc must run successfully for dirs specified, so running
|
|
|
|
# tree-wide (the default) will not work currently.
|
2023-03-24 22:35:25 +03: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 05:54:34 +03:00
|
|
|
js_source_path = [
|
2020-08-11 18:26:16 +03:00
|
|
|
"../browser/components/extensions",
|
2022-12-06 20:50:40 +03:00
|
|
|
"../browser/components/migration",
|
2022-12-06 20:50:40 +03:00
|
|
|
"../browser/components/migration/content",
|
2020-08-11 18:26:16 +03:00
|
|
|
"../browser/components/uitour",
|
2022-03-11 20:51:18 +03:00
|
|
|
"../browser/components/urlbar",
|
2021-05-31 20:36:06 +03:00
|
|
|
"../remote/marionette",
|
2022-11-11 18:56:31 +03:00
|
|
|
"../testing/mochitest/BrowserTestUtils",
|
|
|
|
"../testing/mochitest/tests/SimpleTest/SimpleTest.js",
|
|
|
|
"../testing/mochitest/tests/SimpleTest/EventUtils.js",
|
2022-11-17 15:00:25 +03:00
|
|
|
"../testing/modules/Assert.sys.mjs",
|
|
|
|
"../testing/modules/TestUtils.sys.mjs",
|
2022-04-22 23:46:11 +03:00
|
|
|
"../toolkit/actors",
|
2020-08-11 18:26:16 +03:00
|
|
|
"../toolkit/components/extensions",
|
|
|
|
"../toolkit/components/extensions/parent",
|
|
|
|
"../toolkit/components/featuregates",
|
|
|
|
"../toolkit/mozapps/extensions",
|
|
|
|
"../toolkit/components/prompts/src",
|
2021-03-27 00:55:19 +03:00
|
|
|
"../toolkit/components/pictureinpicture",
|
|
|
|
"../toolkit/components/pictureinpicture/content",
|
2023-04-12 17:06:07 +03:00
|
|
|
"../toolkit/components/search",
|
2020-08-11 18:26:16 +03:00
|
|
|
]
|
|
|
|
root_for_relative_js_paths = ".."
|
2020-06-04 15:42:45 +03:00
|
|
|
jsdoc_config_path = "jsdoc.json"
|
2017-09-14 23:17:09 +03:00
|
|
|
|
2020-06-04 15:42:45 +03:00
|
|
|
templates_path = ["_templates"]
|
|
|
|
source_suffix = [".rst", ".md"]
|
|
|
|
master_doc = "index"
|
|
|
|
project = "Firefox Source Docs"
|
2023-01-26 17:21:06 +03:00
|
|
|
|
2022-03-29 18:19:47 +03:00
|
|
|
# Override the search box to use Google instead of
|
2023-01-26 17:21:06 +03: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 18:19:47 +03:00
|
|
|
html_sidebars = {
|
|
|
|
"**": [
|
|
|
|
"searchbox.html",
|
|
|
|
]
|
|
|
|
}
|
2020-06-08 22:06:44 +03: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-21 02:46:43 +04:00
|
|
|
|
2023-04-25 14:07:07 +03:00
|
|
|
exclude_patterns = ["_build", "_staging", "_venv", "**security/nss/legacy/**"]
|
2020-06-04 15:42:45 +03:00
|
|
|
pygments_style = "sphinx"
|
2023-03-30 11:01:21 +03:00
|
|
|
# generate label “slugs” for header anchors so that
|
|
|
|
# we can reference them from markdown links.
|
|
|
|
myst_heading_anchors = 5
|
2013-09-21 02:46:43 +04:00
|
|
|
|
2015-11-04 19:26:26 +03:00
|
|
|
# We need to perform some adjustment of the settings and environment
|
|
|
|
# when running on Read The Docs.
|
2020-06-04 15:42:45 +03:00
|
|
|
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
|
2014-10-30 20:09:29 +03:00
|
|
|
|
2015-11-04 19:26:26 +03: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 15:42:45 +03:00
|
|
|
assert "SHELL" not in os.environ
|
|
|
|
os.environ["SHELL"] = "/bin/bash"
|
2015-11-04 19:26:26 +03:00
|
|
|
else:
|
|
|
|
# We only need to set the RTD theme when not on RTD because the RTD
|
|
|
|
# environment handles this otherwise.
|
2014-10-30 20:09:29 +03:00
|
|
|
import sphinx_rtd_theme
|
2020-06-04 15:42:45 +03:00
|
|
|
|
|
|
|
html_theme = "sphinx_rtd_theme"
|
2014-10-30 20:09:29 +03:00
|
|
|
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
|
|
|
|
2013-09-21 02:46:43 +04:00
|
|
|
|
2020-06-04 15:42:45 +03:00
|
|
|
html_static_path = ["_static"]
|
2021-12-20 13:20:23 +03:00
|
|
|
htmlhelp_basename = "FirefoxTreeDocs"
|
2017-08-24 21:12:21 +03:00
|
|
|
|
2020-06-04 15:42:45 +03:00
|
|
|
moz_project_name = "main"
|
2019-10-22 20:37:38 +03:00
|
|
|
|
|
|
|
html_show_copyright = False
|
2019-11-26 23:50:31 +03:00
|
|
|
|
2020-09-21 18:31:57 +03: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 23:50:31 +03:00
|
|
|
|
2023-03-30 11:01:21 +03:00
|
|
|
def install_sphinx_design(app, pagename, templatename, context, doctree):
|
2021-11-02 22:11:06 +03:00
|
|
|
if "perfdocs" in pagename:
|
2023-03-30 11:01:21 +03:00
|
|
|
app.add_js_file("sphinx_design.js")
|
|
|
|
app.add_css_file("sphinx_design.css")
|
2021-04-27 21:19:03 +03:00
|
|
|
|
|
|
|
|
2019-11-26 23:50:31 +03:00
|
|
|
def setup(app):
|
2021-07-16 20:38:43 +03:00
|
|
|
app.add_css_file("custom_theme.css")
|
2023-03-30 11:01:21 +03:00
|
|
|
app.connect("html-page-context", install_sphinx_design)
|