summaryrefslogtreecommitdiffstats
path: root/Utilities/Sphinx
diff options
context:
space:
mode:
Diffstat (limited to 'Utilities/Sphinx')
-rw-r--r--Utilities/Sphinx/apply_qthelp_css_workaround.cmake14
-rw-r--r--Utilities/Sphinx/cmake.py8
-rw-r--r--Utilities/Sphinx/templates/layout.html12
3 files changed, 27 insertions, 7 deletions
diff --git a/Utilities/Sphinx/apply_qthelp_css_workaround.cmake b/Utilities/Sphinx/apply_qthelp_css_workaround.cmake
index 8b74d12..288f370 100644
--- a/Utilities/Sphinx/apply_qthelp_css_workaround.cmake
+++ b/Utilities/Sphinx/apply_qthelp_css_workaround.cmake
@@ -1,11 +1,15 @@
file(READ "${CSS_DIR}/basic.css" BasicCssContent)
-file(READ "${CSS_DIR}/default.css" DefaultCssContent)
-string(REPLACE
- "@import url(\"basic.css\")" "${BasicCssContent}"
- DefaultCssContent "${DefaultCssContent}"
-)
+if(EXISTS "${CSS_DIR}/default.css")
+ file(READ "${CSS_DIR}/default.css" DefaultCssContent)
+ string(REPLACE
+ "@import url(\"basic.css\")" "${BasicCssContent}"
+ DefaultCssContent "${DefaultCssContent}"
+ )
+else()
+ set(DefaultCssContent "${BasicCssContent}")
+endif()
file(READ "${CSS_DIR}/cmake.css" CMakeCssContent)
string(REPLACE
diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py
index edc7667..6f273f9 100644
--- a/Utilities/Sphinx/cmake.py
+++ b/Utilities/Sphinx/cmake.py
@@ -46,7 +46,7 @@ from sphinx.directives import ObjectDescription
from sphinx.domains import Domain, ObjType
from sphinx.roles import XRefRole
from sphinx.util.nodes import make_refnode
-from sphinx import addnodes
+from sphinx import addnodes, version_info
class CMakeModule(Directive):
required_arguments = 1
@@ -123,7 +123,11 @@ class _cmake_index_entry:
self.desc = desc
def __call__(self, title, targetid, main = 'main'):
- return ('pair', u'%s ; %s' % (self.desc, title), targetid, main)
+ # See https://github.com/sphinx-doc/sphinx/issues/2673
+ if version_info < (1, 4):
+ return ('pair', u'%s ; %s' % (self.desc, title), targetid, main)
+ else:
+ return ('pair', u'%s ; %s' % (self.desc, title), targetid, main, None)
_cmake_index_objs = {
'command': _cmake_index_entry('command'),
diff --git a/Utilities/Sphinx/templates/layout.html b/Utilities/Sphinx/templates/layout.html
index 177e044..be2660c 100644
--- a/Utilities/Sphinx/templates/layout.html
+++ b/Utilities/Sphinx/templates/layout.html
@@ -8,10 +8,22 @@
<a href="https://cmake.org/">CMake</a>{{ reldelim1 }}
</li>
<li>
+ {%- if versionswitch is defined %}
+ <span class="version_switch">{{ release }}</span>
+ <a href="{{ pathto(master_doc) }}">{% trans %}Documentation{% endtrans %}</a>{{ reldelim1 }}
+ {%- else %}
<a href="{{ pathto(master_doc) }}">{{ shorttitle|e }}</a>{{ reldelim1 }}
+ {%- endif %}
</li>
{% endblock %}
+{% block extrahead %}
+ {% if versionswitch is defined %}
+ <script type="text/javascript" src="{{ pathto('../version_switch.js', 1) }}"></script>
+ {% endif %}
+{{ super() }}
+{% endblock %}
+
{# Put some context in the html title element. Workaround for #}
{# https://bitbucket.org/birkenfeld/sphinx/issue/1492/qthelp-generate-html-title-element-should #}
{% block htmltitle %}