mirror of
https://github.com/nextcloud/documentation.git
synced 2025-12-12 07:29:47 +07:00
Add edit-on-github functionality
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
@@ -297,3 +297,4 @@ current_docs = 'admin_manual'
|
||||
|
||||
# Generate the versions list
|
||||
html_context['versions'] = generateVersionsDocs(current_docs)
|
||||
html_context['theme_vcs_pageview_mode'] += current_docs
|
||||
|
||||
20
conf.py
20
conf.py
@@ -8,7 +8,7 @@ dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.abspath(dir_path + '/_ext'))
|
||||
now = datetime.datetime.now()
|
||||
|
||||
extensions = ['edit_on_github']
|
||||
extensions = []
|
||||
|
||||
# General information about the project.
|
||||
copyright = str(now.year) + ' Nextcloud GmbH'
|
||||
@@ -36,9 +36,9 @@ html_logo = "../_shared_assets/static/logo-white.png"
|
||||
rst_epilog = '.. |version| replace:: %s' % version
|
||||
|
||||
# building the versions list
|
||||
version_start = 13 # THIS IS THE SUPPORTED VERSION NUMBER
|
||||
version_stable = 15 # INCREASE THIS NUMBER TO THE LATEST STABLE VERSION NUMBER
|
||||
def generateVersionsDocs(current_docs):
|
||||
version_start = 13 # THIS IS THE SUPPORTED VERSION NUMBER
|
||||
version_stable = 15 # INCREASE THIS NUMBER TO THE LATEST STABLE VERSION NUMBER
|
||||
versions_doc = []
|
||||
for v in range(version_start, version_stable + 1):
|
||||
url = 'https://docs.nextcloud.com/server/%s/%s' % (str(v), current_docs)
|
||||
@@ -46,11 +46,23 @@ def generateVersionsDocs(current_docs):
|
||||
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']
|
||||
'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'
|
||||
|
||||
@@ -315,3 +315,4 @@ StandaloneHTMLBuilder.supported_image_types = [
|
||||
|
||||
# Generate the versions list
|
||||
html_context['versions'] = generateVersionsDocs(current_docs)
|
||||
html_context['theme_vcs_pageview_mode'] += current_docs
|
||||
|
||||
@@ -308,3 +308,4 @@ current_docs = 'user_manual'
|
||||
|
||||
# Generate the versions list
|
||||
html_context['versions'] = generateVersionsDocs(current_docs)
|
||||
html_context['theme_vcs_pageview_mode'] += current_docs
|
||||
|
||||
@@ -300,3 +300,4 @@ current_docs = 'user_manual_de'
|
||||
|
||||
# Generate the versions list
|
||||
html_context['versions'] = generateVersionsDocs(current_docs)
|
||||
html_context['theme_vcs_pageview_mode'] += current_docs
|
||||
|
||||
Reference in New Issue
Block a user