-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
126 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!-- toc.html --> | ||
<!-- ignore empty links with + --> | ||
{{ $headers := findRE "<h[1-4].*?>(.|\n])+?</h[1-4]>" .Content }} | ||
<!-- at least one header to link to --> | ||
{{ if ge (len $headers) 1 }} | ||
{{ $h1_n := len (findRE "(.|\n])+?" .Content) }} | ||
{{ $re := (cond (eq $h1_n 0) "<h[2-4]" "<h[1-4]") }} | ||
{{ $renum := (cond (eq $h1_n 0) "[2-4]" "[1-4]") }} | ||
|
||
<!--Scrollspy--> | ||
<div class="toc"> | ||
|
||
<div class="page-header"><strong>- CATALOG -</strong></div> | ||
|
||
<div id="page-scrollspy" class="toc-nav"> | ||
|
||
{{ range $headers }} | ||
{{ $header := . }} | ||
{{ range first 1 (findRE $re $header 1) }} | ||
{{ range findRE $renum . 1 }} | ||
{{ $next_heading := (cond (eq $h1_n 0) (sub (int .) 1 ) (int . ) ) }} | ||
{{ range seq $next_heading }} | ||
<ul class="nav"> | ||
{{end}} | ||
{{ $anchorId := (replaceRE ".* id=\"(.*?)\".*" "$1" $header ) }} | ||
<li class="nav-item"> | ||
<a class="nav-link text-left" href="#{{ $anchorId }}"> | ||
{{ $header | plainify | htmlUnescape }} | ||
</a> | ||
</li> | ||
<!-- close list --> | ||
{{ range seq $next_heading }} | ||
</ul> | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
|
||
</div> | ||
|
||
</div> | ||
<!--Scrollspy--> | ||
|
||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{{ define "main" }} | ||
<main> | ||
<article> | ||
<header> | ||
<h1>{{ .Title }}</h1> | ||
</header> | ||
{{ .Content }} | ||
</article> | ||
<aside> | ||
{{ .TableOfContents }} | ||
</aside> | ||
</main> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* toc style */ | ||
.toc { | ||
position: fixed; | ||
top: 50%; | ||
right: 10%; | ||
width: 10%; | ||
transform: translateY(-50%); | ||
/*background-color: #f6f6f6;*/ | ||
/*border: solid 1px #c9c9c9;*/ | ||
border-radius: 5px; | ||
padding-bottom: 1rem; | ||
} | ||
|
||
.toc .page-header { | ||
margin-top: 1rem; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.toc-nav ul { | ||
overflow: hidden; | ||
white-space: nowrap; | ||
line-height: 1rem; | ||
} | ||
|
||
/* ignore h1 header */ | ||
.toc-nav ul ul ul { | ||
margin-left: 2rem; | ||
} | ||
|
||
.toc-nav .nav-link { | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
color: #333; | ||
} | ||
|
||
.toc-nav li.active .nav-link { | ||
background-color: #f6f6f6; | ||
color: var(--accent); | ||
border-left: solid 2px var(--accent); | ||
} | ||
|
||
/* Media Queries */ | ||
@media (max-width: 1080px) { | ||
main { | ||
max-width: 100%; | ||
} | ||
|
||
.toc { | ||
display: none; | ||
} | ||
} |
Binary file not shown.