Sphinx: Add support for collapsible sections

This commit is contained in:
Shati Patel
2019-09-16 15:13:45 +01:00
parent 23087672bf
commit 7aefb839a7
2 changed files with 30 additions and 1 deletions

View File

@@ -446,4 +446,19 @@ blockquote.pull-quote > :last-child {
div.embed iframe {
height:100%;
}
}
}
/* -- COLLAPSIBLE SECTIONS --------------------------------------------------------------------------------- */
.toggle .name {
display: block;
clear: both;
}
.toggle .name:after {
content: " ▶";
}
.toggle .name.open:after {
content: " ▼";
}

View File

@@ -4,6 +4,8 @@
This header (including the SVG logo) is copied from the Semmle
documentation home page at help.semmle.com.
It also adds some JavaScript (in the footer) to allow collapsible sections.
The source for the default Alabaster stylesheet can be found at:
https://github.com/bitprophet/alabaster/blob/master/alabaster/layout.html
#}
@@ -108,6 +110,18 @@
{% endblock %}
{% block footer %}
<script type="text/javascript">
$(document).ready(function() {
$(".toggle > *").hide();
$(".toggle .name").show();
$(".toggle .name").click(function() {
$(this).parent().children().not(".name").toggle(400);
$(this).parent().children(".name").toggleClass("open");
})
});
</script>
{% endblock %}