Merge pull request #963 from nextcloud/stb14-edit-on-github

Add edit-on-github functionality
This commit is contained in:
Morris Jobke 2018-11-28 20:22:25 +01:00 committed by GitHub
commit ae293e91ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 5 deletions

View File

@ -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
View File

@ -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)
@ -47,10 +47,22 @@ def generateVersionsDocs(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'

View File

@ -314,4 +314,6 @@ StandaloneHTMLBuilder.supported_image_types = [
]
# Generate the versions list
html_context['versions'] = generateVersionsDocs(current_docs)
html_context['versions'] = generateVersionsDocs(current_docs)
html_context['theme_vcs_pageview_mode'] += current_docs

View File

@ -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

View File

@ -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