diff --git a/Makefile b/Makefile index f98f77988..66107bc6a 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ developer-manual-pdf: @echo "Developer manual build finished; PDF is updated" api-docs: clean-api-docs - cd build && sh get-server-sources.sh master + cd build && sh get-server-sources.sh stable13 mkdir -p developer_manual/api/ cd build && composer install && composer update cd build && php generateApiDoc.php diff --git a/_ext/edit_on_github.py b/_ext/edit_on_github.py new file mode 100644 index 000000000..67fcf6f9d --- /dev/null +++ b/_ext/edit_on_github.py @@ -0,0 +1,47 @@ +""" +Sphinx extension to add ReadTheDocs-style "Edit on GitHub" links to the +sidebar. +Loosely based on https://github.com/astropy/astropy/pull/347 +""" + +import os +import warnings +from pprint import pprint + + +__licence__ = 'BSD (3 clause)' + + +def get_github_url(app, view, path): + return 'https://github.com/{project}/{view}/{branch}/{path}'.format( + project=app.config.edit_on_github_project, + view=view, + branch=app.config.edit_on_github_branch, + path=path) + + +def html_page_context(app, pagename, templatename, context, doctree): + if templatename != 'page.html': + return + + if not app.config.edit_on_github_project: + warnings.warn("edit_on_github_project not specified") + return + + if not app.config.current_docs: + warnings.warn("current_docs not specified") + return + + path = app.config.current_docs + '/' + os.path.relpath(doctree.get('source'), app.builder.srcdir) + show_url = get_github_url(app, 'blob', path) + edit_url = get_github_url(app, 'edit', path) + + context['show_on_github_url'] = show_url + context['edit_on_github_url'] = edit_url + + +def setup(app): + app.add_config_value('edit_on_github_project', '', True) + app.add_config_value('current_docs', '', True) + app.add_config_value('edit_on_github_branch', 'master', True) + app.connect('html-page-context', html_page_context) diff --git a/_shared_assets/themes/nextcloud_com/layout.html b/_shared_assets/themes/nextcloud_com/layout.html index e57f01e50..516ee7001 100644 --- a/_shared_assets/themes/nextcloud_com/layout.html +++ b/_shared_assets/themes/nextcloud_com/layout.html @@ -12,18 +12,18 @@ {% if theme_bootswatch_theme %} {# BS2 needs "bootstrap-responsive.css". BS3 doesn't. #} {% if theme_bootstrap_version == "3" %} - {% set theme_css_files = theme_css_files + [ - '_static/bootswatch-' + bootstrap_version + '/' + theme_bootswatch_theme + '/bootstrap.min.css', - '_static/bootstrap-sphinx.css' - ] - %} + {% set theme_css_files = theme_css_files + [ + '_static/bootswatch-' + bootstrap_version + '/' + theme_bootswatch_theme + '/bootstrap.min.css', + '_static/bootstrap-sphinx.css' + ] + %} {% else %} - {% set theme_css_files = theme_css_files + [ - '_static/bootswatch-' + bootstrap_version + '/' + theme_bootswatch_theme + '/bootstrap.min.css', - '_static/bootstrap-' + bootstrap_version + '/css/bootstrap-' + bootstrap_additional_css + '.min.css', - '_static/bootstrap-sphinx.css' - ] - %} + {% set theme_css_files = theme_css_files + [ + '_static/bootswatch-' + bootstrap_version + '/' + theme_bootswatch_theme + '/bootstrap.min.css', + '_static/bootstrap-' + bootstrap_version + '/css/bootstrap-' + bootstrap_additional_css + '.min.css', + '_static/bootstrap-sphinx.css' + ] + %} {% endif %} {% else %} {% set theme_css_files = theme_css_files + ['_static/main.min.css', '_static/styles.css'] @@ -36,10 +36,10 @@ {% set css_files = css_files + theme_css_files + bootswatch_css_custom %} {% set script_files = script_files + [ - '_static/js/jquery-1.11.0.min.js', - '_static/js/jquery-fix.js', - '_static/bootstrap-' + bootstrap_version + '/js/bootstrap.min.js', - '_static/bootstrap-sphinx.js' + '_static/js/jquery-1.11.0.min.js', + '_static/js/jquery-fix.js', + '_static/bootstrap-' + bootstrap_version + '/js/bootstrap.min.js', + '_static/bootstrap-sphinx.js' ] %} @@ -53,57 +53,56 @@ {# Sidebar: Rework into our Bootstrap nav section. #} {% macro navBar() %} - +
+
+ +
+ +
+ {% endmacro %} {% if theme_bootstrap_version == "3" %} {%- macro bsidebar() %} - {%- if render_sidebar %} -
- -
- {%- endif %} + {%- if render_sidebar %} +
+ +
+ {%- endif %} {%- endmacro %} {% else %} {%- macro bsidebar() %} - {%- if render_sidebar %} -
- -
- {%- endif %} + {%- if render_sidebar %} +
+ +
+ {%- endif %} {%- endmacro %} {% endif %} @@ -117,16 +116,16 @@ @@ -143,51 +142,51 @@
-
-
-

{{ project|e }}

-
- Versions: - {%- for v in doc_versions %} - {{v}} - {%- endfor %} -
-
-
- {% if theme_show_search %} -
- - -
- {% endif %} -
-
- {% block sidebartoc %} +
+
+

{{ project|e }}

+
+ Versions: + {%- for v in doc_versions %} + {{v}} + {%- endfor %} +
+
+
+ {% if theme_show_search %} +
+ + +
+ {% endif %} +
+
+ {% block sidebartoc %}
- {% endblock %} + {% endblock %}
- {% include "relations.html" %} + {% include "relations.html" %} {% block body %}{% endblock %} - {% include "relations.html" %} + {% include "relations.html" %}
-
+
{%- endblock %} @@ -195,64 +194,86 @@ {%- block footer %}
- - + +
+

All documentation licensed under the Creative Commons Attribution 3.0 Unported license.

+

See who contributed to our documentation/credits.

+ {%- if show_source and has_source and sourcename and edit_on_github_url %} +

Do you want to help us to improve this document? + {{ _('Edit this page on GitHub') }} +

+ {%- endif %} +
-