-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconf.py
More file actions
120 lines (108 loc) · 3.58 KB
/
Copy pathconf.py
File metadata and controls
120 lines (108 loc) · 3.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import os
import sys
sys.path.insert(0, os.path.abspath("tools/sphinx_ext"))
project = "The Open Source Way"
author = "The Open Source Way contributors"
extensions = ["myst_parser", "cjk_emphasis"]
templates_path = [os.path.abspath("_templates")]
html_static_path = [os.path.abspath("_static")]
html_css_files = ["custom.css"]
source_suffix = {
".md": "markdown",
}
root_doc = "index"
exclude_patterns = [
".git",
".venv",
"_build",
"_staging",
"l10n/**",
"SUMMARY.md",
]
locale_dirs = [os.path.abspath("locales")]
gettext_compact = False
myst_enable_extensions = ["colon_fence", "tasklist"]
myst_heading_anchors = 3
# Sites that reject the linkcheck bot with HTTP 403 (and similar) in CI even
# though the URLs resolve fine in a browser. linkcheck is advisory, but these
# patterns keep the report focused on genuinely broken links. Genuine 404s and
# anchor problems are intentionally NOT listed here so they stay visible.
linkcheck_ignore = [
r"https://www\.bls\.gov/",
r"https://www\.nytimes\.com/",
r"https://www\.unwomen\.org/",
r"https://www\.weforum\.org/",
r"https://academic\.oup\.com/",
r"https://.*\.wiley\.com/",
r"https://www\.huffpost\.com/",
r"https://www\.managers\.org\.uk/",
r"https://www\.mayoclinic\.org/",
r"https://www\.teamblind\.com/",
r"https://www\.theburnoutproject\.com\.au/",
r"https://www\.opavote\.com/",
]
language = "en"
guidebook_languages = [
{"code": "en", "build_dir": "en", "label": "English", "aliases": []},
{"code": "zh_CN", "build_dir": "zh_CN", "label": "简体中文", "aliases": ["zh"]},
]
html_theme = "sphinx_book_theme"
html_title = project
html_theme_options = {
# The repository button and edit/issue links point at the guidebook repo,
# which holds the editorial content most readers will want to report on.
"repository_url": "https://github.com/theopensourceway/guidebook",
"repository_branch": "main",
"path_to_docs": "",
"use_edit_page_button": True,
"use_issues_button": True,
"use_repository_button": True,
"use_download_button": False,
# A secondary icon link points at the production repo for build toolchain,
# CI, and theme issues.
"icon_links": [
{
"name": "Build toolchain (production)",
"url": "https://github.com/theopensourceway/production",
"icon": "fa-solid fa-screwdriver-wrench",
"type": "fontawesome",
},
],
"home_page_in_toc": True,
"show_navbar_depth": 1,
"max_navbar_depth": 3,
"show_toc_level": 2,
"toc_title": "On this page",
}
latex_engine = "xelatex"
latex_documents = [
(root_doc, "the-open-source-way.tex", project, author, "manual"),
]
latex_elements = {
"papersize": "letterpaper",
"pointsize": "10pt",
"preamble": r"""
\usepackage{xeCJK}
\setCJKmainfont{Noto Serif CJK SC}
\setCJKsansfont{Noto Sans CJK SC}
\setCJKmonofont{Noto Sans Mono CJK SC}
""",
}
html_sidebars = {
"**": [
"navbar-logo.html",
"icon-links.html",
"search-button-field.html",
"language_switcher.html",
"sbt-sidebar-nav.html",
]
}
def setup(app):
def localize_theme_options(app, config):
if config.language == "zh_CN":
config.html_theme_options["toc_title"] = "本页内容"
def add_language_context(app, pagename, templatename, context, doctree):
context["guidebook_current_language"] = app.config.language
context["guidebook_languages"] = guidebook_languages
app.connect("config-inited", localize_theme_options)
app.connect("html-page-context", add_language_context)