remove .rej file

This commit is contained in:
Junyi Hou 2024-03-06 13:27:42 +08:00
parent 3d600a74c3
commit 4655d3e4ac

View File

@ -1,28 +0,0 @@
diff a/layouts/partials/toc.html b/layouts/partials/toc.html (rejected hunks)
@@ -1,10 +1,21 @@
-{{ $toc := and ($.Site.Params.toc) (ge .WordCount $.Site.Params.tocWordCount) }} {{ if isset .Params "toc" }} {{ $toc = .Params.toc }} {{ end }} {{ if $toc }}
-<details class="toc noselect">
- <summary>Table of Contents</summary>
- <div class="inner">{{ .TableOfContents }}</div>
-</details>
+{{ $toc := and ($.Site.Params.toc) (ge .WordCount $.Site.Params.tocWordCount) }}
+{{ if isset .Params "toc" }}
+ {{ $toc = .Params.toc }}
+{{ end }}
+
+
+{{ if $toc }}
+ {{ $tocContent := .TableOfContents }}
+ {{ if findRE "<li>" $tocContent }}
+ <!-- we show the toc only if we have element in .TableOfContents -->
+ <details class="toc noselect">
+ <summary>Table of Contents</summary>
+ <div class="inner">{{ .TableOfContents }}</div>
+ </details>
+ {{ end }}
{{ end }}
+
<script>
document.querySelector(".toc").addEventListener("click", function () {
if (event.target.tagName !== "A") {