Skip to content

Commit 46892c4

Browse files
committed
fix: restore missing main conf.py
1 parent d1f4681 commit 46892c4

1 file changed

Lines changed: 131 additions & 0 deletions

File tree

conf.py

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# global configuration for every documentation added at the end
2+
3+
import os, sys, datetime
4+
5+
import sphinx_rtd_theme
6+
7+
dir_path = os.path.dirname(os.path.realpath(__file__))
8+
sys.path.insert(0, os.path.abspath(dir_path + '/_ext'))
9+
now = datetime.datetime.now()
10+
11+
os.environ["READTHEDOCS"] = "True"
12+
13+
extensions = [
14+
'sphinx_rtd_theme',
15+
'sphinx_rtd_dark_mode',
16+
'sphinx_copybutton',
17+
'sphinxcontrib.mermaid',
18+
'notfound.extension',
19+
]
20+
21+
# General information about the project.
22+
copyright = '2016-' + str(now.year) + ' Nextcloud GmbH and Nextcloud contributors'
23+
24+
# The version info for the project you're documenting, acts as replacement for
25+
# |version| and |release|, also used in various other places throughout the
26+
# built documents.
27+
#
28+
# The short X.Y version.
29+
version = 'latest'
30+
# The full version, including alpha/beta/rc tags.
31+
release = version
32+
33+
# RTD theme options
34+
html_theme_options = {
35+
'logo_only': True,
36+
'navigation_with_keys': True,
37+
'style_external_links': True,
38+
'version_selector': False,
39+
}
40+
41+
# relative path to subdirectories
42+
html_logo = "../_shared_assets/static/logo-white.png"
43+
44+
# disable including the reST sources in HTML builds (in _sources/) (default is True)
45+
html_copy_source = False
46+
47+
# substitutions go here
48+
rst_epilog = '.. |version| replace:: %s' % version
49+
50+
# building the versions list
51+
version_start = 31 # THIS IS THE OLDEST SUPPORTED VERSION NUMBER
52+
53+
# THIS IS THE VERSION THAT IS MAPPED TO https://docs.nextcloud.com/server/stable/
54+
version_stable = 32 # CHANGING IT MUST RESULT IN A CHANGE OF THE SYMLINK ON THE LIVE SERVER
55+
56+
# Also search for "TODO ON RELEASE" in the rst files
57+
58+
def generateVersionsDocs(current_docs):
59+
versions_doc = []
60+
for v in range(version_start, version_stable + 1):
61+
url = 'https://docs.nextcloud.com/server/%s/%s' % (str(v), current_docs)
62+
versions_doc.append(tuple((v, url)))
63+
versions_doc.append(tuple(('stable', 'https://docs.nextcloud.com/server/%s/%s' % ('stable', current_docs))))
64+
versions_doc.append(tuple(('latest', 'https://docs.nextcloud.com/server/%s/%s' % ('latest', current_docs))))
65+
return versions_doc
66+
67+
if version.isdigit():
68+
github_branch = 'stable%s' % version
69+
else:
70+
github_branch = 'master'
71+
72+
html_context = {
73+
'current_version': version,
74+
'READTHEDOCS': True,
75+
76+
# force github plugin
77+
'display_github': True,
78+
'github_user': 'nextcloud',
79+
'github_repo': 'documentation',
80+
# If current version is an int, use the stablexxx branches, otherwise, edit on master
81+
'theme_vcs_pageview_mode': 'edit/%s/' % github_branch, # to be completed by each individual conf.py
82+
}
83+
84+
html_static_path = ['_static']
85+
# Extra CSS relative to html_static_path
86+
html_css_files = [
87+
'custom.css'
88+
]
89+
90+
edit_on_github_project = 'nextcloud/documentation'
91+
edit_on_github_branch = 'master'
92+
93+
# Automatically add EoL warning banner to docs for unsupported releases
94+
if (version.isdigit() and version < version_start):
95+
rst_prolog = """.. danger::
96+
**OUTDATED DOCUMENTATION**
97+
98+
*You are viewing documentation for a retired version of Nextcloud.
99+
Do not follow these instructions for current releases.*
100+
101+
**To ensure you have the most reliable and up-to-date guidance,
102+
please visit the** `Nextcloud Documentation homepage
103+
<https://docs.nextcloud.com/>`_.
104+
"""
105+
106+
# user starts in light mode
107+
default_dark_mode = False
108+
109+
latex_engine = "xelatex"
110+
111+
# -- Options for sphinx-notfound-page extension -----------------------------------
112+
# https://github.com/readthedocs/sphinx-notfound-page
113+
114+
# content context passed to the 404 template
115+
notfound_context = {
116+
"title": "404 Page Not Found",
117+
"body": """
118+
<h1>Page Not Found</h1>
119+
<h2>Sorry, we can't seem to find the page you're looking for.</h2>
120+
<h6>Error code: 404</h6>
121+
122+
<h3>Here are some alternatives:</h3>
123+
<ol>
124+
<li>Try using the search box.</li>
125+
<li>Check the content menu on the side of this page.</li>
126+
<li>Regroup at our <a href="/">documentation homepage.</a></p></li>
127+
</ol>
128+
""",
129+
}
130+
131+
notfound_urls_prefix = None

0 commit comments

Comments
 (0)