Compare commits

...

2 commits

Author SHA1 Message Date
c972ba9776 report broken links 2025-04-21 12:27:03 +02:00
4eb19e8b3e styling 2025-04-21 12:26:56 +02:00
2 changed files with 19 additions and 14 deletions

View file

@ -4,24 +4,26 @@
{{- $u := urls.Parse $destination -}} {{- $u := urls.Parse $destination -}}
{{- if not $u.Scheme -}} {{- if not $u.Scheme -}}
{{- with site.GetPage .Destination -}} {{- $page := site.GetPage $destination -}}
{{- $backlinks := .Store.Get "backlinks" | default slice -}} {{- if $page -}}
{{- $backlinks := $page.Store.Get "backlinks" | default slice -}}
{{- $backlinks := $backlinks|append $currentPage.RelPermalink -}} {{- $backlinks := $backlinks|append $currentPage.RelPermalink -}}
{{- .Store.Set "backlinks" ($backlinks|uniq) -}} {{- $page.Store.Set "backlinks" ($backlinks|uniq) -}}
{{- if not $text -}} {{- if not $text -}}
{{- $text = .LinkTitle -}} {{- $text = $page.LinkTitle -}}
{{- end -}} {{- end -}}
<span class="supt">{{- .Section -}}</span><a href="{{- .RelPermalink -}}" {{- with .Title }} title="{{ . }}"{{ end -}}>{{- $text -}}</a> <span class="supt">{{- $page.Section -}}</span><a href="{{- $page.RelPermalink -}}" {{- with $page.Title }} title="{{ . }}"{{ end -}}>{{- $text -}}</a>
{{- end -}} {{- else if hasPrefix $destination "/library" -}}
{{- if hasPrefix $destination "/library" -}}
{{- $bib := strings.TrimPrefix "/library/" $destination -}} {{- $bib := strings.TrimPrefix "/library/" $destination -}}
{{- $b := index site.Data.books.catalog $bib -}} {{- $b := index site.Data.books.catalog $bib -}}
{{- if not $text -}} {{- if not $text -}}
{{- $text = $b.title|default "" -}} {{- $text = $b.title|default "" -}}
{{- end -}} {{- end -}}
<span class="supt">library</span><a href="/library/BROWSE_LIBRARY.html#/books/{{- $bib -}}">{{- $text -}}</a> <span class="supt">library</span><a href="/library/BROWSE_LIBRARY.html#/books/{{- $bib -}}">{{- $text -}}</a>
{{- else -}}
{{- warnf "In %s broken link: %s" $currentPage.RelPermalink $destination -}}
{{- end -}} {{- end -}}
{{- else -}} {{- else -}}
<span class="supt">www</span><a href="{{ .Destination | safeURL }}"{{- with .Title }} title="{{ . }}"{{ end -}}{{- if $u.IsAbs }} rel="external"{{ end -}}>{{- with .Text }}{{ . }}{{- end -}}</a> <span class="supt">www</span><a href="{{ .Destination | safeURL }}"{{- with .Title }} title="{{ . }}"{{ end -}}{{- if $u.IsAbs }} rel="external"{{ end -}}>{{- if .Text }}{{ .Text }}{{- else -}}{{- .Destination -}}{{- end -}}</a>
{{- end -}} {{- end -}}
{{- /* chomp trailing newline */ -}} {{- /* chomp trailing newline */ -}}

View file

@ -373,7 +373,7 @@ blockquote {
padding-left: 3rem; padding-left: 3rem;
padding-right: 10rem; padding-right: 10rem;
width: 100%; width: 100%;
max-width: 720px; max-width: 800px;
padding-top: 0.5rem; padding-top: 0.5rem;
font-size: 1.4rem; font-size: 1.4rem;
@ -395,10 +395,9 @@ blockquote {
display: grid; display: grid;
grid-template-rows: auto auto 1fr; grid-template-rows: auto auto 1fr;
grid-template-areas: "title" "menu" "article"; grid-template-areas: "title" "menu" "article";
margin-top: 4rem;
padding-left: 3rem; padding-left: 3rem;
padding-right: 10rem; padding-right: 10rem;
max-width: 720px; max-width: 800px;
} }
.title { .title {
@ -406,7 +405,7 @@ blockquote {
margin-top: 4rem; margin-top: 4rem;
font-style: italic; font-style: italic;
font-size: 2rem; font-size: 2rem;
margin-bottom: 4rem; margin-bottom: 6rem;
} }
.supt { .supt {
@ -428,7 +427,7 @@ blockquote {
grid-area: menu; grid-area: menu;
margin-bottom: 2rem; margin-bottom: 2rem;
display: grid; display: grid;
grid-template-columns: 1fr 1fr; grid-template-columns: minmax(0, auto) minmax(0, auto);
} }
.toc { .toc {
@ -438,6 +437,10 @@ blockquote {
position: relative; position: relative;
} }
.toc:empty + .graph-menus {
grid-column: 1/-1;
}
#TableOfContents { #TableOfContents {
margin-left: -2rem; margin-left: -2rem;
margin-top: -1.5rem; margin-top: -1.5rem;
@ -466,7 +469,7 @@ nav#TableOfContents ol li a:hover {
} }
.graph-menu { .graph-menu {
display: inline-grid; display: flex;
grid-auto-rows: max-content; grid-auto-rows: max-content;
font-size: 1.4rem; font-size: 1.4rem;
font-style: italic; font-style: italic;