diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5c8f2b8c60112a11fa2cbd86184b19d4df758210..629467242b4a16a4f4ee994708a03f85c7c29152 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,8 +7,8 @@ pages: - pip3 install sphinx - pip3 install sphinx-rtd-theme - apk --no-cache add make - - sphinx-build -b html source build/html/en - - sphinx-build -b html -D language=de source build/html/de + - sphinx-multiversion source build/html/en + - sphinx-multiversion -D language=de source build/html/de - mv build/html/ public/ - mv source/_static/redirect/index.html public/index.html artifacts: diff --git a/Makefile b/Makefile index 5b3c56a7edd85d790019f01d9512b10c606ab9b6..0b539388466eb035b7852af8a9d9ff1e075f0af3 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,9 @@ BUILDDIR = build help: venv @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -.PHONY: help Makefile venv +multi: Makefile venv + @$(VIRTUAL_ENV)/bin/sphinx-multiversion "$(SOURCEDIR)" "$(BUILDDIR)/multi/en" $(SPHINXOPTS) $(O) + @$(VIRTUAL_ENV)/bin/sphinx-multiversion -D language=de "$(SOURCEDIR)" "$(BUILDDIR)/multi/de" $(SPHINXOPTS) $(O) # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). @@ -23,5 +25,7 @@ help: venv venv: @if [ ! -d "$(VIRTUAL_ENV)" ]; \ then python3 -m venv "$(VIRTUAL_ENV)"; \ - $(VIRTUAL-ENV)/bin/pip3 install sphinx sphinx-rtd-theme; \ + $(VIRTUAL_ENV)/bin/pip3 install sphinx sphinx-rtd-theme sphinx-multiversion; \ fi + +.PHONY: help Makefile multi venv diff --git a/source/_static/js/switchLanguage.js b/source/_static/js/switchLanguage.js index 5c49c88351c57faec6e5c4de38dbfebdd07bfc31..b169b9e69c907c0efdcb8fe67fee928db975f40f 100644 --- a/source/_static/js/switchLanguage.js +++ b/source/_static/js/switchLanguage.js @@ -1,5 +1,7 @@ -function switchLanguage(originLanguage, targetLanguage) { - var url = window.location.href; - var target_url = url.replace('/' + originLanguage + '/', '/' + targetLanguage + '/'); - location.assign(target_url); -} \ No newline at end of file +$(function() { + document.querySelectorAll('[data-switch-language]').forEach(function(el) { + var originLanguage = document.documentElement.lang; + var targetLanguage = el.dataset.switchLanguage; + el.href = window.location.href.replace('/' + originLanguage + '/', '/' + targetLanguage + '/'); + }); +}); \ No newline at end of file diff --git a/source/_static/redirect/index.html b/source/_static/redirect/index.html index 708ed81cc417f2985b89f11225bd39f719156e08..5cab0360b2bfb73896d51ea7e2c9ff8dbb5fe97b 100644 --- a/source/_static/redirect/index.html +++ b/source/_static/redirect/index.html @@ -1,10 +1,10 @@ - + -

Please follow this link for english Castellum docs.

-

Hier geht es zur deutschen Dokumentation von Castellum.

+

Please follow this link for english Castellum docs.

+

Hier geht es zur deutschen Dokumentation von Castellum.

\ No newline at end of file diff --git a/source/_templates/layout.html b/source/_templates/layout.html deleted file mode 100644 index 2fc6f74bc0fc8c2025ee21c37dee82f3770000f6..0000000000000000000000000000000000000000 --- a/source/_templates/layout.html +++ /dev/null @@ -1,10 +0,0 @@ -{% extends "!layout.html" %} -{% block menu %} -

- - - - -

- {{ super() }} -{% endblock %} \ No newline at end of file diff --git a/source/_templates/versions.html b/source/_templates/versions.html new file mode 100644 index 0000000000000000000000000000000000000000..dce0a1ed098d41289b5ac69e4c210f09cdaa7484 --- /dev/null +++ b/source/_templates/versions.html @@ -0,0 +1,23 @@ +
+ + {{ _('Other Versions') }} + v: {{ current_version.name }} + + + +
diff --git a/source/conf.py b/source/conf.py index dd99f8c12424a30599c249f861a5bfa85799c2b4..0885ca73a0636a95dd7fec33317d8ebeb68e1db0 100644 --- a/source/conf.py +++ b/source/conf.py @@ -33,9 +33,11 @@ version = '0.55' extensions = [ 'sphinx_rtd_theme', 'sphinx.ext.todo', + 'sphinx_multiversion', ] todo_include_todos = True +smv_branch_whitelist = r'^master$' # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates']