render links adds to mentioned in
This commit is contained in:
parent
b64d06b942
commit
8e1bb2652c
6 changed files with 56 additions and 16 deletions
|
@ -25,6 +25,6 @@
|
|||
{{ end }}
|
||||
{{end}}
|
||||
|
||||
<h{{ add 1 .Level }} id="{{ .Anchor | safeURL }}" class="hx css-{{ .Page.File.UniqueID }}-h{{ add 1 .Level }}"><span class="counters">{{ $counter }} </span>{{ .Text | safeHTML }}<a class="hpar" href="#{{ .Anchor | safeURL }}">¶</a> {{ .Page.Store.Get "level" }}</h{{ add 1 .Level }}>
|
||||
<h{{ add 1 .Level }} id="{{ .Anchor | safeURL }}" class="hx css-{{ .Page.File.UniqueID }}-h{{ add 1 .Level }}"><span class="counters">{{ $counter }} </span>{{ .Text | safeHTML }}<a class="hpar" href="#{{ .Anchor | safeURL }}"></a> {{ .Page.Store.Get "level" }}</h{{ add 1 .Level }}>
|
||||
|
||||
{{ .Page.Store.Set "previousLevel" .Level }}
|
||||
|
|
|
@ -1,16 +1,27 @@
|
|||
{{- $currentPage := .Page -}}
|
||||
{{- $u := urls.Parse .Destination -}}
|
||||
{{- $text := .Text -}}
|
||||
{{- $destination := .Destination -}}
|
||||
|
||||
{{- $u := urls.Parse $destination -}}
|
||||
{{- if not $u.Scheme -}}
|
||||
{{- with site.GetPage .Destination -}}
|
||||
{{- $backlinks := .Store.Get "backlinks" | default slice -}}
|
||||
{{- $backlinks := $backlinks|append $currentPage.RelPermalink -}}
|
||||
{{- .Store.Set "backlinks" ($backlinks|uniq) -}}
|
||||
{{- if not $text -}}
|
||||
{{- $text = .LinkTitle -}}
|
||||
{{- end -}}
|
||||
<span class="supt">{{- .Section -}}⁄</span><a href="{{- .RelPermalink -}}" {{- with .Title }} title="{{ . }}"{{ end -}}>{{- $text -}}</a>
|
||||
{{- end -}}
|
||||
{{- if hasPrefix $destination "/library" -}}
|
||||
{{- $bib := strings.TrimPrefix "/library/" $destination -}}
|
||||
{{- $b := index site.Data.books.catalog $bib -}}
|
||||
{{- if not $text -}}
|
||||
{{- $text = $b.title|default "" -}}
|
||||
{{- end -}}
|
||||
<span class="supt">library⁄</span><a href="/library/BROWSE_LIBRARY.html#/books/{{- $bib -}}">{{- $text -}}</a>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<span class="supt">www⁄</span><a href="{{ .Destination | safeURL }}"{{- with .Title }} title="{{ . }}"{{ end -}}{{- if $u.IsAbs }} rel="external"{{ end -}}>{{- with .Text }}{{ . }}{{- end -}}</a>
|
||||
{{- end -}}
|
||||
<a href="{{ .Destination | safeURL }}"
|
||||
{{- with .Title }} title="{{ . }}"{{ end -}}
|
||||
{{- if $u.IsAbs }} rel="external"{{ end -}}
|
||||
>
|
||||
{{- with .Text }}{{ . }}{{ end -}}
|
||||
</a>
|
||||
{{- /* chomp trailing newline */ -}}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{{ $currentPage := . }}
|
||||
{{ $currentPageGraph := $currentPage.Store.Get "graph"}}
|
||||
|
||||
{{ $data := (dict "allPages" site.AllPages "currentPage" $currentPage)}}
|
||||
{{- with (templates.Defer (dict "data" $data)) -}}
|
||||
{{ range $page := .allPages }}
|
||||
|
@ -18,6 +17,15 @@
|
|||
{{- $mentionedInPage.Store.Set "mentioned_in" ($mentionedIn|uniq) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- partial "menu_isin.html" (dict "currentPage" .currentPage "isin" (.currentPage.Store.Get "isin")) -}}
|
||||
{{- partial "menu_mentioned_in.html" (dict "currentPage" .currentPage "mentioned_in" (.currentPage.Store.Get "mentioned_in")) -}}
|
||||
{{- $isin := .currentPage.Store.Get "isin" -}}
|
||||
{{- $backreferences := union (.currentPage.Store.Get "mentioned_in") (.currentPage.Store.Get "backlinks") -}}
|
||||
{{- $complement := slice -}}
|
||||
{{- with $backreferences -}}
|
||||
{{- $complement = $backreferences -}}
|
||||
{{- with $isin -}}
|
||||
{{- $complement = complement $isin $backreferences -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- partial "menu_isin.html" (dict "currentPage" .currentPage "isin" $isin) -}}
|
||||
{{- partial "menu_mentioned_in.html" (dict "currentPage" .currentPage "mentioned_in" $complement) -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -4,7 +4,11 @@
|
|||
<div class="graph-menu">
|
||||
<div class="graph-inline-cursive">
|
||||
{{- with $cursiveMenuPrefix -}}{{- . -}} {{- end -}}
|
||||
{{- partial "GetPluralSectionName.html" $menuSection -}}⁄
|
||||
{{- if gt ($pagePaths|len) 1 -}}
|
||||
{{- partial "GetPluralSectionName.html" $menuSection -}}
|
||||
{{- else -}}
|
||||
{{- $menuSection -}}
|
||||
{{- end -}}⁄
|
||||
</div>
|
||||
<div class="graph-inline-link">
|
||||
{{- range $pagePaths -}}
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
{{- $mentioned_in := .mentioned_in -}}
|
||||
{{- range $menuSection, $pagePaths := partial "GetSectionsWithPagePaths.html" $mentioned_in -}}
|
||||
{{- if eq $menuSection "sections" -}}{{- continue -}}{{- end -}}
|
||||
{{- partial "graph-menu.html" (dict "cursiveMenuPrefix" "mentioned in" "menuSection" $menuSection "pagePaths" $pagePaths) -}}
|
||||
{{- partial "graph-menu.html" (dict "cursiveMenuPrefix" "in" "menuSection" $menuSection "pagePaths" $pagePaths) -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -16,7 +16,6 @@ hr {
|
|||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
|
@ -347,6 +346,22 @@ a:hover {
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-weight: 500;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
border-left: 1px red solid;
|
||||
margin-left: 1rem;
|
||||
margin-right: 2rem;
|
||||
padding-left: 1rem;
|
||||
padding-right: 2rem;
|
||||
padding-top: 0.1rem;
|
||||
padding-bottom: 0.1rem;
|
||||
background-color: #fff9f9;
|
||||
}
|
||||
|
||||
.header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
|
@ -361,7 +376,8 @@ a:hover {
|
|||
max-width: 720px;
|
||||
|
||||
padding-top: 0.5rem;
|
||||
font-size: 1.1rem;
|
||||
font-size: 1.4rem;
|
||||
font-style: italic;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
|
@ -401,7 +417,8 @@ a:hover {
|
|||
cursive;
|
||||
font-size: 0.9em;
|
||||
font-style: normal;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
/* color: rgba(0, 0, 0, 0.8); */
|
||||
color: red;
|
||||
vertical-align: baseline;
|
||||
position: relative;
|
||||
top: -0.3em;
|
||||
|
|
Loading…
Add table
Reference in a new issue