From c33ad7a3f01e741216acc2fa118d1a3b004d98ed Mon Sep 17 00:00:00 2001
From: u214892 <u214892@sbb.ch>
Date: Tue, 17 Sep 2019 15:03:31 +0200
Subject: [PATCH] #174 sphinx

---
 Makefile                                |  9 +--------
 docs/conf.py                            |  2 +-
 make_docs.py                            | 13 +++++++++----
 requirements_continuous_integration.txt |  1 +
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile
index c84991f6..4b3bed8f 100644
--- a/Makefile
+++ b/Makefile
@@ -67,14 +67,7 @@ coverage: ## check code coverage quickly with the default Python
 	$(BROWSER) htmlcov/index.html
 
 docs: ## generate Sphinx HTML documentation, including API docs
-	rm -f docs/flatland*.rst
-	rm -f docs/modules.rst
-	sphinx-apidoc --force -a -e -o docs/ flatland -H "Flatland Reference"
-	$(MAKE) -C docs clean
-	cp *.md docs
-	$(MAKE) -C docs html
-	pydeps --no-config --noshow flatland -o docs/_build/html/flatland.svg
-	$(BROWSER) docs/_build/html/index.html
+	python make_docs.py
 
 servedocs: docs ## compile the docs watching for changes
 	watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
diff --git a/docs/conf.py b/docs/conf.py
index b0366ddb..9cfc10f9 100755
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -33,7 +33,7 @@ sys.path.insert(0, os.path.abspath('..'))
 
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['recommonmark', 'sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.intersphinx']
+extensions = ['recommonmark', 'sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.intersphinx', 'numpydoc']
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
diff --git a/make_docs.py b/make_docs.py
index be36a7bb..47588be7 100644
--- a/make_docs.py
+++ b/make_docs.py
@@ -1,10 +1,11 @@
 #!/usr/bin/env python
-
+import glob
 import os
+import shutil
 import subprocess
 import webbrowser
 from urllib.request import pathname2url
-
+from shutil import copyfile
 
 def browser(pathname):
     webbrowser.open("file:" + pathname2url(os.path.abspath(pathname)))
@@ -18,10 +19,14 @@ def remove_exists(filename):
 
 
 # clean docs config and html files, and rebuild everything
-remove_exists('docs/flatland.rst')
+remove_exists('docs/flatland*.rst')
 remove_exists('docs/modules.rst')
 
-subprocess.call(['sphinx-apidoc', '-o', 'docs/', 'flatland'])
+subprocess.call(['sphinx-apidoc', '--force', '-a', '-e', '-o', 'docs/', 'flatland', '-H', '"Flatland Reference"'])
+
+for file in glob.glob(r'./*.md'):
+    print(file)
+    shutil.copy(file, 'docs/')
 
 os.environ["SPHINXPROJ"] = "flatland"
 os.chdir('docs')
diff --git a/requirements_continuous_integration.txt b/requirements_continuous_integration.txt
index db4885e7..9a523cc1 100644
--- a/requirements_continuous_integration.txt
+++ b/requirements_continuous_integration.txt
@@ -6,6 +6,7 @@ benchmarker>=4.0.1
 coverage>=4.5.1
 Sphinx>=1.8.1
 sphinx-rtd-theme>=0.4.3
+numpydoc
 docutils>=0.15.2
 flake8>=3.7.7
 flake8-eradicate>=0.2.0
-- 
GitLab