Backport documentation build from master

This commit is contained in:
kaiyou
2018-12-16 22:31:28 +01:00
parent cd80fda12e
commit a4551870aa
4 changed files with 36 additions and 29 deletions

View File

@@ -1,2 +1,9 @@
{% set version=github_version %}
{% extends "!layout.html" %} {% extends "!layout.html" %}
{% block document %}
{% if version != stable_version %}
<div class="wy-alert info">
<p>You are currently browsing documentation for the <b>{{ version }}</b> branch. Documentation for the stable <b>{{ stable_version }}</b> branch can be found <a href="/{{ stable_version }}/">here</a>.</p>
</div>
{% endif %}
{{ super() }}
{% endblock %}

16
docs/_templates/versions.html vendored Normal file
View File

@@ -0,0 +1,16 @@
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Versions</span>
v: {{ version }}
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
<dl>
<dt>{{ _('Versions') }}</dt>
{% for slug, url in versions %}
<dd><a href="{{ url }}">{{ slug }}</a></dd>
{% endfor %}
</dl>
</div>
</div>

View File

@@ -2,16 +2,18 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
import os
extensions = ['sphinx.ext.imgmath', 'sphinx.ext.viewcode'] extensions = ['sphinx.ext.imgmath', 'sphinx.ext.viewcode']
templates_path = ['_templates'] templates_path = ['_templates']
source_suffix = '.rst' source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
project = 'Mailu' project = 'Mailu'
copyright = '2017, Mailu authors' copyright = '2018, Mailu authors'
author = 'Mailu authors' author = 'Mailu authors'
version = release = 'latest' version = release = os.environ.get('VERSION', 'master')
language = None language = None
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'Dockerfile', 'docker-compose.yml']
pygments_style = 'sphinx' pygments_style = 'sphinx'
todo_include_todos = False todo_include_todos = False
html_theme = 'sphinx_rtd_theme' html_theme = 'sphinx_rtd_theme'
@@ -23,7 +25,7 @@ htmlhelp_basename = 'Mailudoc'
# to template names. # to template names.
html_sidebars = { html_sidebars = {
'**': [ '**': [
'relations.html', # needs 'show_related': True theme option to display 'relations.html',
'searchbox.html', 'searchbox.html',
] ]
} }
@@ -33,27 +35,11 @@ html_context = {
'display_github': True, 'display_github': True,
'github_user': 'mailu', 'github_user': 'mailu',
'github_repo': 'mailu', 'github_repo': 'mailu',
'github_version': 'master', 'github_version': version,
'stable_version': '1.5',
'versions': [
('1.5', '/1.5/'),
('master', '/master/')
],
'conf_py_path': '/docs/' 'conf_py_path': '/docs/'
} }
# Upload function when the script is called directly
if __name__ == "__main__":
import os, sys, paramiko
build_dir, hostname, username, password, dest_dir = sys.argv[1:]
transport = paramiko.Transport((hostname, 22))
transport.connect(username=username, password=password)
sftp = paramiko.SFTPClient.from_transport(transport)
os.chdir(build_dir)
for dirpath, dirnames, filenames in os.walk("."):
remote_path = os.path.join(dest_dir, dirpath)
try:
sftp.mkdir(remote_path)
except:
pass
for filename in filenames:
sftp.put(
os.path.join(dirpath, filename),
os.path.join(remote_path, filename)
)

View File

@@ -2,5 +2,3 @@ recommonmark
Sphinx Sphinx
sphinx-autobuild sphinx-autobuild
sphinx-rtd-theme sphinx-rtd-theme
sphinxcontrib-versioning
paramiko