Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docsy theme #28

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions assets/js/code-copy.js

This file was deleted.

36 changes: 4 additions & 32 deletions assets/scss/site.scss → assets/scss/_styles_project.scss
Original file line number Diff line number Diff line change
@@ -1,43 +1,15 @@
/* import variables from docsy */
@import 'variables';

.alert-info{
background: #dbe6eb;
background: #dbe6eb;
}

.alert-warning{
background: #ffe4c9;
background: #ffe4c9;
}

.alert-danger{
background: #ffb5b5;
}

/* copy button */
.highlight {
position: relative;
}
.highlight pre {
padding-right: 75px;
}
.highlight-copy-btn {
position: absolute;
bottom: 7px;
right: 7px;
border: 0;
border-radius: 4px;
padding: 1px;
font-size: 0.7em;
line-height: 1.8;
color: $white;
background-color: $gray-600;
min-width: 55px;
text-align: center;
}
.highlight-copy-btn:hover {
background-color: $gray-700;
}

/* details elements */
details {
border: 1px solid $gray-200;
Expand Down Expand Up @@ -118,7 +90,7 @@ details[open].normalmode > summary{


/* pdf styling */

.pdf-title p{
text-align: center;
font-size: xx-large;
Expand All @@ -142,7 +114,7 @@ details[open].normalmode > summary{
text-align: right;
font-size: smaller;
}

.pdf-keep-together {
page-break-inside: avoid;
display:block;
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/acend/docsy-plus
go 1.18

require (
github.com/google/docsy v0.4.0 // indirect
github.com/google/docsy/dependencies v0.4.0 // indirect
github.com/google/docsy v0.9.1 // indirect
github.com/google/docsy/dependencies v0.7.2 // indirect
)
13 changes: 7 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
github.com/FortAwesome/Font-Awesome v0.0.0-20210804190922-7d3d774145ac/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
github.com/google/docsy v0.4.0 h1:Eyt2aiDC1fnw/Qq/9xnIqUU5n5Yyk4c8gX3nBDdTv/4=
github.com/google/docsy v0.4.0/go.mod h1:vJjGkHNaw9bO42gpFTWwAUzHZWZEVlK46Kx7ikY5c7Y=
github.com/google/docsy/dependencies v0.4.0 h1:FXwyjtuFfPIPBauU2t7uIAgS6VYfJf+OD5pzxGvkQsQ=
github.com/google/docsy/dependencies v0.4.0/go.mod h1:2zZxHF+2qvkyXhLZtsbnqMotxMukJXLaf8fAZER48oo=
github.com/twbs/bootstrap v4.6.1+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
github.com/google/docsy v0.9.1 h1:+jqges1YCd+yHeuZ1BUvD8V8mEGVtPxULg5j/vaJ984=
github.com/google/docsy v0.9.1/go.mod h1:saOqKEUOn07Bc0orM/JdIF3VkOanHta9LU5Y53bwN2U=
github.com/google/docsy/dependencies v0.7.2 h1:+t5ufoADQAj4XneFphz4A+UU0ICAxmNaRHVWtMYXPSI=
github.com/google/docsy/dependencies v0.7.2/go.mod h1:gihhs5gmgeO+wuoay4FwOzob+jYJVyQbNaQOh788lD4=
github.com/twbs/bootstrap v5.2.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
File renamed without changes.
22 changes: 10 additions & 12 deletions layouts/_default/content.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
{{/* Copied and adapted from themes/docsy/layouts/_default/content.html */}}
<div class="td-content">
{{- if site.Params.automaticSectionNumbers -}}
{{- $sectionnumbers := partial "sectionnumber.html" . -}}
{{- $sectionnumbers := partialCached "sectionnumber.html" . .File.Path -}}
<h1>{{ $sectionnumbers.Get .File.Path }} {{ .Title }}</h1>
{{- else -}}
<h1>{{ .Title }}</h1>
{{- end -}}
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
<header class="article-meta">
{{ partial "taxonomy_terms_article_wrapper.html" . }}
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) }}
{{ partial "reading-time.html" . }}
{{ end }}
{{ partial "taxonomy_terms_article_wrapper.html" . -}}
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) -}}
{{ partial "reading-time.html" . -}}
{{ end -}}
</header>
{{ .Content }}
<div class="text-muted mt-5 pt-3">{{ partial "prevnextlinks.html" . }}</div>
{{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) }}
{{ partial "feedback.html" .Site.Params.ui.feedback }}
{{ partial "feedback.html" . -}}
{{ if (.Site.Params.DisqusShortname) -}}
<br />
{{ end }}
{{ if (.Site.Params.DisqusShortname) }}
<br />
{{ partial "disqus-comment.html" . }}
{{ end }}
{{- partial "disqus-comment.html" . -}}
{{ end -}}
{{ partial "page-meta-lastmod.html" . }}
</div>
{{/**/ -}}
29 changes: 13 additions & 16 deletions layouts/docs/list.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
{{ define "main" }}
<div class="td-content">
{{- if site.Params.automaticSectionNumbers -}}
{{- $sectionnumbers := partialCached "sectionnumber.html" . -}}
{{- $sectionnumbers := partialCached "sectionnumber.html" . .File.Path -}}
<h1>{{ $sectionnumbers.Get .File.Path }} {{ .Title }}</h1>
{{- else -}}
<h1>{{ .Title }}</h1>
{{- end -}}
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
<header class="article-meta">
{{ partial "taxonomy_terms_article_wrapper.html" . }}
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) }}
{{ partial "reading-time.html" . }}
{{ end }}
{{ partial "taxonomy_terms_article_wrapper.html" . -}}
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) -}}
{{ partial "reading-time.html" . -}}
{{ end -}}
</header>
{{ .Content }}
{{ partial "section-index.html" . }}
<div>{{ partial "prevnextlinks.html" . }}</div>
{{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) }}
{{ partial "feedback.html" .Site.Params.ui.feedback }}
{{ partial "section-index.html" . -}}
<div>{{ partial "prevnextlinks.html" . }}</div>
{{ partial "feedback.html" . -}}
{{ if (.Site.Config.Services.Disqus.Shortname) -}}
<br />
{{ end }}
{{ if (.Site.DisqusShortname) }}
<br />
{{ partial "disqus-comment.html" . }}
{{ end }}
{{ partial "page-meta-lastmod.html" . }}
{{- partial "disqus-comment.html" . -}}
{{ end -}}
{{ partial "page-meta-lastmod.html" . -}}
</div>
{{ end }}
{{ end -}}
17 changes: 9 additions & 8 deletions layouts/partials/hooks/body-end.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{ $jsCodeCopy := resources.Get "js/code-copy.js" }}
{{ $jsLibs := slice $jsCodeCopy }}
{{ $jsLibs := slice }}

{{ if .Site.Params.ModeSwitcher }}
{{ $jsModeSwitcher := resources.Get "js/mode-switcher.js" }}
Expand All @@ -12,14 +11,16 @@
{{ $jsLibs = $jsLibs | append $jsReplaceContent }}
{{ end }}

{{ $jsSite := $jsLibs | resources.Concat "js/site.js" }}
{{ if $jsLibs }}
{{ $jsSite := $jsLibs | resources.Concat "js/site.js" }}

{{ if not .Site.IsServer }}
{{ $jsSite = $jsSite | minify }}
{{ end }}
{{ $jsSite = $jsSite | fingerprint }}
{{ if not .Site.IsServer }}
{{ $jsSite = $jsSite | minify }}
{{ end }}
{{ $jsSite = $jsSite | fingerprint }}

<script src="{{ $jsSite.Permalink }}" integrity="{{ $jsSite.Data.Integrity }}" crossorigin="anonymous"></script>
<script src="{{ $jsSite.Permalink }}" integrity="{{ $jsSite.Data.Integrity }}" crossorigin="anonymous"></script>
{{ end }}

{{/* Allow trainings to add more Javascript */}}
{{ partial "hooks/body-end-custom.html" . }}
1 change: 0 additions & 1 deletion layouts/partials/hooks/head-end-custom.html

This file was deleted.

13 changes: 0 additions & 13 deletions layouts/partials/hooks/head-end.html

This file was deleted.

30 changes: 16 additions & 14 deletions layouts/partials/section-index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{{/* Copied and adapted from themes/docsy/layouts/partials/section-index.html */}}
{{- $sectionnumbers := partialCached "sectionnumber.html" . -}}
{{- $sectionnumbers := partialCached "sectionnumber.html" . .File.Path -}}
<div class="section-index">
{{ $parent := .Page }}
{{ $pages := (where .Site.Pages "Section" .Section).ByWeight }}
{{ $parent := .Page -}}
{{ $pages := (where .Site.Pages "Section" .Section).ByWeight -}}
{{ $pages = (where $pages "Type" "!=" "search") }}
{{ $pages = (where $pages ".Params.hide_summary" "!=" true) }}
{{ $pages = (where $pages ".Parent" "!=" nil) }}
{{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) }}
{{ $pages = (where $pages ".Params.hide_summary" "!=" true) -}}
{{ $pages = (where $pages ".Parent" "!=" nil) -}}
{{ if and .Parent .Parent.File -}}
{{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) }}
{{ end -}}

{{/* Get all pages where onlyWhen is set */}}
{{ $pagesOnlyWhen := where $pages ".Params.onlyWhen" "in" site.Params.enabledModule }}
Expand All @@ -23,22 +25,22 @@

{{ if or $parent.Params.no_list (eq (len $pages) 0) }}
{{/* If no_list is true or we don't have subpages we don't show a list of subpages */}}
{{ else if $parent.Params.simple_list }}
{{ else if $parent.Params.simple_list -}}
{{/* If simple_list is true we show a bulleted list of subpages */}}
<ul>
{{ range $pages }}
{{ range $pages -}}
{{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }}
{{- $title := .Title -}}
{{- if site.Params.automaticSectionNumbers -}}
{{- $title = printf "%s %s" ($sectionnumbers.Get .File.Path) .Title -}}
{{- end -}}
<li><a href="{{ $manualLink }}"{{ with .Params.manualLinkTitle }} title="{{ . }}"{{ end }}{{ with .Params.manualLinkTarget }} target="{{ . }}"{{ if eq . "_blank" }} rel="noopener"{{ end }}{{ end }}>{{- $title -}}</a></li>
{{ end }}
{{ end -}}
</ul>
{{ else }}
{{ else -}}
{{/* Otherwise we show a nice formatted list of subpages with page descriptions */}}
<hr class="panel-line">
{{ range $pages }}
{{ range $pages -}}
{{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }}
<div class="entry">
<h5>
Expand All @@ -48,8 +50,8 @@ <h5>
{{- end -}}
<a href="{{ $manualLink }}"{{ with .Params.manualLinkTitle }} title="{{ . }}"{{ end }}{{ with .Params.manualLinkTarget }} target="{{ . }}"{{ if eq . "_blank" }} rel="noopener"{{ end }}{{ end }}>{{- $title -}}</a>
</h5>
<p>{{ .Description | markdownify }}</p>
<p>{{ .Description | markdownify -}}</p>
</div>
{{ end }}
{{ end }}
{{ end -}}
{{ end -}}
</div>
9 changes: 6 additions & 3 deletions layouts/partials/sectionnumber.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{{ if not (in .Site.Params.enabledModule "base") }}
{{ warnf "Section numbers do not work correctly unless 'base' is in params.enabledModule" }}
{{ end }}

{{ $navRoot := cond (and (ne .Params.toc_root true) (eq .Site.Home.Type "docs")) .Site.Home .FirstSection -}}
{{ $data := $navRoot.Scratch }}
{{/* partialCached does not work here. The Scratch is sometimes empty and only contains data when content is modified */}}
{{/* Check if the current page was already evaluated */}}
{{ if not ($data.Get .File.Path) }}
{{ $data = partial "sectionnumber-nested" (dict "page" . "section" $navRoot "data" $data) . $navRoot }}
{{ $data = partialCached "sectionnumber-nested" (dict "page" . "section" $navRoot "data" $data) $navRoot.File.Path }}
{{ end }}
{{ return $data }}

Expand All @@ -23,7 +26,7 @@
{{ if (not (and (eq $s $p.Site.Home) (eq .Params.toc_root true))) -}}
{{ $count = add $count 1 }}
{{ $newSectionNr := printf "%s%d." $sectionNr $count }}
{{ $d = partial "sectionnumber-nested" (dict "page" $p "section" . "sectionNr" $newSectionNr "data" $d) }}
{{ $d = partialCached "sectionnumber-nested" (dict "page" $p "section" . "sectionNr" $newSectionNr "data" $d) .File.Path }}
{{- end }}
{{- end }}
{{- end }}
Expand Down
Loading