Skip to content

Commit 6b78314

Browse files
authored
Merge pull request github#1962 from shati-patel/sphinx/collapse
Approved by jf205
2 parents 3a51e02 + 2956cb7 commit 6b78314

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

docs/language/global-sphinx-files/_static/custom.css_t

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,4 +446,23 @@ blockquote.pull-quote > :last-child {
446446
div.embed iframe {
447447
height:100%;
448448
}
449-
}
449+
}
450+
451+
/* -- COLLAPSIBLE SECTIONS --------------------------------------------------------------------------------- */
452+
453+
.toggle .name {
454+
display: block;
455+
clear: both;
456+
}
457+
458+
.toggle .name:hover {
459+
cursor: pointer;
460+
}
461+
462+
.toggle .name:after {
463+
content: " ▶";
464+
}
465+
466+
.toggle .name.open:after {
467+
content: " ▼";
468+
}

docs/language/global-sphinx-files/_templates/layout.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
This header (including the SVG logo) is copied from the Semmle
55
documentation home page at help.semmle.com.
66

7+
It also adds some JavaScript (in the footer) to allow collapsible sections.
8+
79
The source for the default Alabaster stylesheet can be found at:
810
https://github.com/bitprophet/alabaster/blob/master/alabaster/layout.html
911
#}
@@ -108,6 +110,18 @@ <h4>Contents</h4>
108110

109111
{% endblock %}
110112

113+
{% block footer %}
114+
<script type="text/javascript">
115+
$(document).ready(function() {
116+
$(".toggle > *").hide();
117+
$(".toggle .name").show();
118+
$(".toggle .name").click(function() {
119+
$(this).parent().children().not(".name").toggle(400);
120+
$(this).parent().children(".name").toggleClass("open");
121+
})
122+
});
123+
</script>
124+
{% endblock %}
111125

112126

113127

0 commit comments

Comments
 (0)