forked from gravwell/wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconf.py
175 lines (147 loc) · 4.92 KB
/
conf.py
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import os
import pathlib
import subprocess
import sys
from datetime import date
from sphinx.highlighting import lexers
sys.path.insert(0, os.path.abspath("."))
from gravy_lexer import GravwellLexer
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = "Gravwell"
copyright = f"Gravwell, Inc. {date.today().year}"
author = "Gravwell, Inc."
release = "v5.6.6"
# Default to localhost:8000, so the version switcher looks OK on livehtml
version_list_url = os.environ.get(
"VERSION_LIST_URL", "http://localhost:8000/_static/versions.json"
)
print("Using version_list_url:", version_list_url)
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = [
"myst_parser",
"sphinx_design",
"notfound.extension",
"sphinx_copybutton",
"sphinx_favicon",
]
myst_enable_extensions = [
"colon_fence",
"fieldlist",
"substitution",
]
templates_path = ["_templates"]
exclude_patterns = [
".github",
"README.md",
"_build",
"Thumbs.db",
".DS_Store",
"env",
"_vendor",
"_tools",
]
language = "en"
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_show_sourcelink = False
html_copy_source = False
html_theme = "pydata_sphinx_theme"
html_static_path = ["_static"]
html_css_files = ["css/custom.css"]
html_theme_options = {
"logo": {
"image_light": "_static/images/Gravwell-Color.svg",
"image_dark": "_static/images/Gravwell-Color-Reverse.svg",
},
"icon_links": [
{
# Label for this link
"name": "GitHub",
# URL where the link will redirect
"url": "https://github.com/gravwell", # required
# Icon class (if "type": "fontawesome"), or path to local image (if "type": "local")
"icon": "fa-brands fa-github",
# The type of image to be used (see below for details)
"type": "fontawesome",
},
{
# Label for this link
"name": "Discord",
# URL where the link will redirect
"url": "https://discord.com/invite/gravwell", # required
# Icon class (if "type": "fontawesome"), or path to local image (if "type": "local")
"icon": "fa-brands fa-discord",
# The type of image to be used (see below for details)
"type": "fontawesome",
},
],
"header_links_before_dropdown": 6,
"footer_start": [
"sphinx-version",
"theme-version",
],
"footer_end": [
"copyright",
"git-commit-footer",
],
"navigation_with_keys": False,
#
# Version switcher
#
"switcher": {
"json_url": version_list_url,
# The `version` field of each entry in verions.json must match a vN.N.N release name
"version_match": release,
},
# Show a warning banner if the user's looking at any page other than latest
"show_version_warning_banner": True,
# Don't fail to compile just because the version switcher file (json_url) isn't reachable
"check_switcher": False,
# include the version switcher next to the logo
"navbar_start": ["navbar-logo", "version-switcher"],
# use custom center for navbar, so that we can better manage responsiveness
"navbar_center": ["dynamic-navbar"],
}
# sphinx-favicon
favicons = [
{
"rel": "icon",
"sizes": "48x48",
"href": "favicon.ico",
},
]
# -- Gravwell Query Language Config ----------------------------
lexers["gw"] = lexers["gravwell"] = GravwellLexer(startinline=True)
# -- "Not Found" Extension Config ----------------------------
notfound_urls_prefix = ""
# -- Substitutions -------------------------------------------------
# Determine git commit ID
#
# Make sure we're checking the commit id for the wiki project, by passing the directory
# to the git subprocess call
git_dir = pathlib.Path(__file__).parent.resolve()
commit_id = (
subprocess.check_output(["git", "rev-parse", "--short", "HEAD"], cwd=git_dir)
.strip()
.decode("ascii")
)
try:
subprocess.check_call(["git", "diff", "--quiet"], cwd=git_dir)
is_dirty_tree = False
except subprocess.CalledProcessError:
is_dirty_tree = True
# Variables to substitute in HTML template files
html_context = {
"git_commit": commit_id,
"git_dirty_tree": is_dirty_tree,
}
# Variables to substitute in Markdown files
myst_substitutions = {}
# Copy button
copybutton_selector = "div.highlight pre,div.docutils pre.literal-block"