From 994bfbeb04ab1f3188bacd1d9d0b7dbb265e5ccf Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Wed, 2 Oct 2019 16:27:59 +0200
Subject: [PATCH] Use sphinx_rtd documentation theme, added logo and link to
 source on Gitlab

---
 .gitlab-ci.yml  |  4 ++--
 docs/Dockerfile |  2 +-
 docs/conf.py    | 17 ++++++++++++++---
 docs/logo.svg   | 30 ++++++++++++++++++++++++++++++
 4 files changed, 47 insertions(+), 6 deletions(-)
 create mode 100644 docs/logo.svg

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ca343ca1b..70727fc15 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -71,7 +71,7 @@ review_docs:
     - cd docs
     - apt-get update
     - apt-get install -y graphviz
-    - pip install sphinx
+    - pip install sphinx sphinx_rtd_theme
   script:
     - ./build_docs.sh
   cache:
@@ -203,7 +203,7 @@ pages:
     - cd docs
     - apt-get update
     - apt-get install -y graphviz
-    - pip install sphinx
+    - pip install sphinx sphinx_rtd_theme
   script:
     - ./build_docs.sh
   cache:
diff --git a/docs/Dockerfile b/docs/Dockerfile
index 76147bb6d..1de9a3ede 100644
--- a/docs/Dockerfile
+++ b/docs/Dockerfile
@@ -1,5 +1,5 @@
 FROM python:3.6
 
 RUN apt-get update && apt-get install -y graphviz
-RUN pip install sphinx livereload
+RUN pip install sphinx livereload sphinx_rtd_theme
 WORKDIR /app/docs
diff --git a/docs/conf.py b/docs/conf.py
index bf1afa0a6..6b7466d64 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -89,13 +89,24 @@ todo_include_todos = False
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
 #
-html_theme = "alabaster"
+html_theme = "sphinx_rtd_theme"
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
 # documentation.
 #
-# html_theme_options = {}
+html_theme_options = {
+    'gitlab_url': 'https://dev.funkwhale.audio/funkwhale/funkwhale'
+}
+html_context = {
+  'display_gitlab': True,
+  'gitlab_host': 'dev.funkwhale.audio',
+  'gitlab_repo': 'funkwhale',
+  'gitlab_user': 'funkwhale',
+  'gitlab_version': 'master',
+  'conf_py_path': '/docs/',
+}
+html_logo = 'logo.svg'
 
 # Add any paths that contain custom static files (such as style sheets) here,
 # relative to this directory. They are copied after the builtin static files,
@@ -166,7 +177,7 @@ redirect_files = [
     ('importing-music.html', 'admin/importing-music.html'),
     ('architecture.html', 'developers/architecture.html'),
     ('troubleshooting.html', 'admin/troubleshooting.html'),
-    ('configuration.html', 'admin/configuration.html'), 
+    ('configuration.html', 'admin/configuration.html'),
     ('upgrading/index.html', '../admin/upgrading.html'),
     ('upgrading/0.17.html', '../admin/0.17.html'),
     ('users/django.html', '../admin/django.html'),
diff --git a/docs/logo.svg b/docs/logo.svg
new file mode 100644
index 000000000..1487fcf74
--- /dev/null
+++ b/docs/logo.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 viewBox="0 0 256 256" style="enable-background:new 0 0 256 256;" xml:space="preserve">
+<style type="text/css">
+	.st0{fill:#FFFFFF;}
+	.st1{fill:#009FE3;}
+	.st2{fill:#3C3C3B;}
+</style>
+<circle class="st0" cx="128" cy="128" r="128"/>
+<g>
+	<g>
+		<g>
+			<path class="st1" d="M128,157.1c17.7,0,32.1-14.4,32.1-32.1c0-0.9-0.8-1.7-1.7-1.7h-12.1c-0.9,0-1.7,0.8-1.7,1.7
+				c0,9.1-7.4,16.6-16.6,16.6c-9.1,0-16.6-7.4-16.6-16.6c0-0.9-0.8-1.7-1.7-1.7H97.6c-0.9,0-1.7,0.8-1.7,1.7
+				C95.9,142.8,110.3,157.1,128,157.1z"/>
+			<path class="st1" d="M128,187.4c34.3,0,62.3-28,62.3-62.3c0-0.9-0.8-1.7-1.7-1.7h-12.1c-0.9,0-1.7,0.8-1.7,1.7
+				c0,25.9-21,46.9-46.9,46.9s-46.9-21-46.9-46.9c0-0.9-0.8-1.7-1.7-1.7H67.4c-0.9,0-1.7,0.8-1.7,1.7
+				C65.5,159.4,93.5,187.4,128,187.4z"/>
+			<path class="st1" d="M219,123.4h-12.1c-0.9,0-1.7,0.8-1.7,1.7c0,42.6-34.8,77.3-77.3,77.3c-42.6,0-77.3-34.6-77.3-77.3
+				c0-0.9-0.8-1.7-1.7-1.7H37c-0.9,0-1.7,0.8-1.7,1.7c0,51.1,41.6,92.7,92.7,92.7s92.7-41.6,92.7-92.7
+				C220.7,124.2,219.9,123.4,219,123.4z"/>
+		</g>
+		<path class="st2" d="M86.3,83.3c6.2,3.2,12.9,3.8,18.9,7.3c3.9,2.3,6.4,4.8,8.8,8.6c3.8,5.7,3.6,12.9,3.6,12.9l0.5,7.9
+			c0,0,3,7.9,9.7,7.9c7.1,0,9.7-7.9,9.7-7.9l0.5-7.9c0,0-0.2-7.1,3.6-12.9c2.4-3.8,4.8-6.5,8.8-8.6c6-3.5,12.7-4.1,18.9-7.3
+			c6.2-3.2,12.2-7.3,16.3-13s6-13.3,3.8-20c-11.8-0.6-25.4,0.8-35.8,6.4c-14.5,7.7-23.3,5-25.9,16.5h-0.2
+			c-2.6-11.6-11.3-8.8-25.9-16.5c-10.4-5.6-24-7-35.8-6.4c-2.3,6.7-0.3,14.2,3.8,20C74,76.1,80.1,80.2,86.3,83.3z"/>
+	</g>
+</g>
+</svg>
-- 
GitLab