forked from zammad/zammad-admin-documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconf.py
93 lines (78 loc) · 2.99 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
import sys
import os
import time
import sphinx_rtd_theme
html_logo = "images/zammad_logo_70x61.png"
html_favicon = "images/favicon.ico"
project = u'Zammad'
copyright = u'2012 - %s, Zammad Foundation' % time.strftime("%Y")
author = u'Zammad'
source_suffix = '.rst'
master_doc = 'index'
exclude_patterns = ['_build', 'html', 'doctrees']
extensions = [
'versionwarning.extension',
'sphinx_tabs.tabs',
'sphinxcontrib.mermaid'
]
locale_dirs = ['locale/']
gettext_compact = "admin-docs"
language = "en"
html_static_path = ['_static']
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# thanks to https://blog.deimos.fr/2014/10/02/sphinxdoc-and-readthedocs-theme-tricks-2/
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# Override default css to get a larger width for local build
def setup(app):
app.add_js_file('theme/zammad_overrides.js')
app.add_js_file('theme/mermaid.min.js')
app.add_css_file('theme/theme_overrides.css')
# We're running outside of readthedocs and expect the compiled version to
# be a pre release
branch = 'pre-release'
else:
# Override default css to get a larger width for ReadTheDoc build
html_css_files = [
'https://media.readthedocs.org/css/sphinx_rtd_theme.css',
'https://media.readthedocs.org/css/readthedocs-doc-embed.css',
'theme/theme_overrides.css'
]
html_js_files = [
'theme/zammad_overrides.js',
'theme/mermaid.min.js'
]
# Get current version we're on for possible version warning
version = os.environ.get('READTHEDOCS_VERSION')
# If we're **not on latest**, we'll display a deprecation warning.
if version == 'latest':
branch = version
elif version == 'pre-release':
branch = "pre-release"
else:
branch = "old-version"
# Default definitions for this documentations version warnings if applicable
# https://sphinx-version-warning.readthedocs.io/en/latest/configuration.html
versionwarning_project_slug = "zammad-admin-documentation"
versionwarning_admonition_type = "warning"
versionwarning_project_version = branch
versionwarning_body_selector = "div.document"
versionwarning_messages = {
"pre-release": (
"You're viewing a <strong>pre-release</strong> version of this "
"documentation! If you want to see the stable, current version of "
"this documentation, please see "
'<a href="https://admin-docs.zammad.org/en/latest/" '
'title="current documentation version">here</a>.'
),
"old-version": (
"You're viewing a <strong>deprecated</strong> version of Zammad's "
"documentation. If you're still running that version, please consider "
'<a href="https://docs.zammad.org/en/latest/install/update.html" '
'title="Updating Zammad">Updating Zammad</a> asap.'
),
}