Bug 1672538 [wpt PR 26196] - Fix two hyphenation tests, a=testonly
[gecko.git] / docs / conf.py
blob67e24ed2c502a9e719b325dd38df4458362cde2a
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
7 import os
8 import sys
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 copybutton_prompt_text = ">>> |\\\\$ |\\[\\d*\\]: |\\.\\.\\.: "
17 copybutton_prompt_is_regexp = True
19 EXTRA_PATHS = (
20 "layout/tools/reftest",
21 "python/mach",
22 "python/mozbuild",
23 "python/mozversioncontrol",
24 "testing/mozbase/manifestparser",
25 "testing/mozbase/mozfile",
26 "testing/mozbase/mozprocess",
27 "third_party/python/futures",
28 "third_party/python/jsmin",
29 "third_party/python/which",
30 "toolkit/components/glean/sphinx",
33 sys.path[:0] = [os.path.join(topsrcdir, p) for p in EXTRA_PATHS]
35 sys.path.insert(0, OUR_DIR)
37 extensions = [
38 "sphinx.ext.autodoc",
39 "sphinx.ext.autosectionlabel",
40 "sphinx.ext.doctest",
41 "sphinx.ext.graphviz",
42 "sphinx.ext.napoleon",
43 "sphinx.ext.todo",
44 "mozbuild.sphinx",
45 "sphinx_js",
46 "sphinxcontrib.mermaid",
47 "recommonmark",
48 "sphinx_copybutton",
49 "sphinx_markdown_tables",
50 "glean",
53 # JSDoc must run successfully for dirs specified, so running
54 # tree-wide (the default) will not work currently.
55 js_source_path = [
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",
65 root_for_relative_js_paths = ".."
66 jsdoc_config_path = "jsdoc.json"
68 templates_path = ["_templates"]
69 source_suffix = [".rst", ".md"]
70 master_doc = "index"
71 project = "Firefox Source Docs"
72 html_logo = os.path.join(topsrcdir, "browser/branding/nightly/content/firefox-wordmark.svg")
73 html_favicon = os.path.join(topsrcdir, "browser/branding/nightly/firefox.ico")
75 exclude_patterns = ["_build", "_staging", "_venv"]
76 pygments_style = "sphinx"
78 # We need to perform some adjustment of the settings and environment
79 # when running on Read The Docs.
80 on_rtd = os.environ.get("READTHEDOCS", None) == "True"
82 if on_rtd:
83 # SHELL isn't set on RTD and mach.mixin.process's import raises if a
84 # shell-related environment variable can't be found. Set the variable here
85 # to hack us into working on RTD.
86 assert "SHELL" not in os.environ
87 os.environ["SHELL"] = "/bin/bash"
88 else:
89 # We only need to set the RTD theme when not on RTD because the RTD
90 # environment handles this otherwise.
91 import sphinx_rtd_theme
93 html_theme = "sphinx_rtd_theme"
94 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
97 html_static_path = ["_static"]
98 htmlhelp_basename = "MozillaTreeDocs"
100 moz_project_name = "main"
102 html_show_copyright = False
104 # Only run autosection for the page title.
105 # Otherwise, we have a huge number of duplicate links.
106 # For example, the page https://firefox-source-docs.mozilla.org/code-quality/lint/
107 # is called "Linting"
108 # just like https://firefox-source-docs.mozilla.org/remote/CodeStyle.html
109 autosectionlabel_maxdepth = 1
112 def setup(app):
113 app.add_config_value(
114 "recommonmark_config",
116 # Crashes with sphinx
117 "enable_inline_math": False,
118 # We use it for testing/web-platform/tests
119 "enable_eval_rst": True,
121 True,
123 app.add_stylesheet("custom_theme.css")
124 app.add_transform(AutoStructify)