Skip to content

Commit 5350bc5

Browse files
committed
Fix extra spacing on pages with no sections
1 parent 5331a4b commit 5350bc5

15 files changed

+271
-254
lines changed

assets/js/handlebars/helpers.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ Handlebars.registerHelper('isNonEmptyArray', function (entry, options) {
5454
}
5555
})
5656

57+
Handlebars.registerHelper('isEmptyArray', function (entry, options) {
58+
if (Array.isArray(entry) && entry.length === 0) {
59+
return options.fn(this)
60+
} else {
61+
return options.inverse(this)
62+
}
63+
})
64+
5765
Handlebars.registerHelper('isLocal', function (nodeId, options) {
5866
const pathSuffix = window.location.pathname.split('/').pop()
5967
const nodePage = nodeId + '.html'

assets/js/handlebars/templates/sidebar-items.handlebars

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,24 @@
1616
{{else}}
1717
{{{node.title}}}
1818
{{/if}}
19-
<span class="icon-expand"></span>
19+
{{#isEmptyArray node.headers}}
20+
{{else}}
21+
<span class="icon-expand"></span>
22+
{{/isEmptyArray}}
2023
</a>
2124

22-
<ul>
23-
{{#isArray node.headers}}
24-
{{#each node.headers}}
25-
<li>
26-
<a href="{{node.id}}.html#{{{anchor}}}">{{{id}}}</a>
27-
</li>
28-
{{/each}}
29-
{{else}}
25+
{{#isArray node.headers}}
26+
{{#isNonEmptyArray node.headers}}
27+
<ul>
28+
{{#each node.headers}}
29+
<li>
30+
<a href="{{node.id}}.html#{{{anchor}}}">{{{id}}}</a>
31+
</li>
32+
{{/each}}
33+
</ul>
34+
{{/isNonEmptyArray}}
35+
{{else}}
36+
<ul>
3037
{{#showSections node}}
3138
<li class="docs {{#isLocal node.id}}open{{/isLocal}}">
3239
<a href="{{node.id}}.html#content" class="expand">
@@ -62,7 +69,7 @@
6269
</ul>
6370
</li>
6471
{{/each}}
65-
{{/isArray}}
6672
</ul>
73+
{{/isArray}}
6774
</li>
6875
{{/each}}

formatters/epub/dist/epub-elixir-3VL772VM.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)