diff --git a/.gitignore b/.gitignore index 2f445a7b83..9104d6592e 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ static_collected/ google_fonts/ node_modules/ docs/build/ +docs/_templates/layout.html diff --git a/HISTORY.rst b/HISTORY.rst index a2cc419254..144f1a5c31 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,7 @@ - Add sphinx sitemap extension. - Move the file patching code from the Dependency class to a generalized utility of the storages app. +- Add book link to the documentation. 3.2.10 (2019-11-19) =================== diff --git a/docs/_static/book_cover.jpg b/docs/_static/book_cover.jpg new file mode 100644 index 0000000000..3eb727842a Binary files /dev/null and b/docs/_static/book_cover.jpg differ diff --git a/docs/_templates/donate.html b/docs/_templates/donate.html deleted file mode 100644 index 42850e33d2..0000000000 --- a/docs/_templates/donate.html +++ /dev/null @@ -1,16 +0,0 @@ -

Support

-

- Consulting and support plans are available, click here. -

-
-

- Or consider supporting Mayan EDMS by contributing to its development. (US tax payers, please note this contribution is not tax deductible). -

-
- - - - -
- -
diff --git a/docs/_templates/message_area.html b/docs/_templates/message_area.html new file mode 100644 index 0000000000..71dc332b9f --- /dev/null +++ b/docs/_templates/message_area.html @@ -0,0 +1,41 @@ + + +
+

Get the book!

+ + + + + +
+ +

+ On-site consulting and support plans are available, click here. +

+ +
+ +

+ Or consider donating to support the continued development of the project. +

+ +
+ + + + +
+
+ + diff --git a/docs/conf.py b/docs/conf.py index fdbce57f67..e3300b7885 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -123,7 +123,7 @@ html_theme = 'sphinx_rtd_theme' # further. For a list of options available for each theme, see the # documentation. html_theme_options = { - 'analytics_id': 'UA-52965619-6', + 'analytics_id': 'UA-52965619-6' } # Add any paths that contain custom themes here, relative to this directory. @@ -305,3 +305,4 @@ def setup(app): substitutions=substitutions ) ) + utils.patch_theme_template(app, templates_path=templates_path[0]) diff --git a/docs/utils.py b/docs/utils.py index bed070d934..f9fc3bba9a 100644 --- a/docs/utils.py +++ b/docs/utils.py @@ -1,5 +1,11 @@ from __future__ import unicode_literals +import shutil +from pathlib2 import Path +import sphinx_rtd_theme + +from mayan.apps.storage.utils import patch_files + def load_env_file(filename='../config.env'): result = {} @@ -19,3 +25,30 @@ def generate_substitutions(dictionary): result.append(('|{}|'.format(key), value)) return result + + +def patch_theme_template(app, templates_path): + package_path = Path(sphinx_rtd_theme.__file__) + source_file_path = package_path.parent / 'layout.html' + destination_path = Path(app.srcdir) / templates_path + destination_file_path = destination_path / 'layout.html' + + with source_file_path.open(mode='r') as source_file_object: + with destination_file_path.open(mode='w+') as destination_file_object: + shutil.copyfileobj( + fsrc=source_file_object, fdst=destination_file_object + ) + + patch_files( + path=destination_path, replace_list=[ + { + 'filename_pattern': 'layout.html', + 'content_patterns': [ + { + 'search': '\n \n\n
', + 'replace': '{% include "message_area.html" %}\n \n\n
', + }, + ] + } + ] + )