forked from nextcloud/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.py
69 lines (55 loc) · 2.13 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
# global configuration for every documentation added at the end
import os, sys, datetime
import sphinx_rtd_theme
dir_path = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.abspath(dir_path + '/_ext'))
now = datetime.datetime.now()
extensions = []
# General information about the project.
copyright = str(now.year) + ' Nextcloud GmbH'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = 'latest'
# The full version, including alpha/beta/rc tags.
release = version
# RTD theme options
html_theme_options = {
'logo_only': True,
'style_external_links': True,
'display_version': False,
}
# relative path to subdirectories
html_logo = "../_shared_assets/static/logo-white.png"
# substitutions go here
rst_epilog = '.. |version| replace:: %s' % version
# building the versions list
version_start = 22 # THIS IS THE SUPPORTED VERSION NUMBER
version_stable = 24 # INCREASE THIS NUMBER TO THE LATEST STABLE VERSION NUMBER
def generateVersionsDocs(current_docs):
versions_doc = []
for v in range(version_start, version_stable + 1):
url = 'https://docs.nextcloud.com/server/%s/%s' % (str(v), current_docs)
versions_doc.append(tuple((v, url)))
versions_doc.append(tuple(('stable', 'https://docs.nextcloud.com/server/%s/%s' % ('stable', current_docs))))
versions_doc.append(tuple(('latest', 'https://docs.nextcloud.com/server/%s/%s' % ('latest', current_docs))))
return versions_doc
if version.isdigit():
github_branch = 'stable%s' % version
else:
github_branch = 'master'
html_context = {
'current_version': version,
'READTHEDOCS': True,
'extra_css_files': ['_static/custom.css'],
# force github plugin
'display_github': True,
'github_user': 'nextcloud',
'github_repo': 'documentation',
# If current version is an int, use the stablexxx branches, otherwise, edit on master
'theme_vcs_pageview_mode': 'edit/%s/' % github_branch, # to be completed by each individual conf.py
}
edit_on_github_project = 'nextcloud/documentation'
edit_on_github_branch = 'master'