Compare commits
3 Commits
20217e0b97
...
0d1e2e80eb
| Author | SHA1 | Date | |
|---|---|---|---|
| 0d1e2e80eb | |||
| 19550ef1b2 | |||
| 2032e1cdc2 |
@@ -1,4 +1,4 @@
|
||||
{{- .Page.Scratch.SetInMap "definedSections" (printf "#%s" .Anchor) true -}}
|
||||
{{- .Page.Store.SetInMap "definedSections" (printf "#%s" .Anchor) true -}}
|
||||
<a href="#{{ .Anchor }}">
|
||||
<h{{ .Level }} id="{{ .Anchor }}">
|
||||
{{- .Text | safeHTML -}}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
{{- if $isSamePage -}}
|
||||
{{- $class = "same-page-link" -}}
|
||||
{{- if index (.Page.Scratch.Get "definedSections") .Destination -}}
|
||||
{{- if index (.Page.Store.Get "definedSections") .Destination -}}
|
||||
{{- $icon = "arrow-up" -}}
|
||||
{{- else -}}
|
||||
{{- /* Do not render "down" links because don't know how to distinguish unseen titles from paragraph links. */ -}}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
<link rel="preload" href="{{ .url }}" as="style" onload="this.onload=null;this.rel='stylesheet'" {{ .extra | safeHTMLAttr }}>
|
||||
<noscript><link rel="stylesheet" href="{{ .url }}"></noscript>
|
||||
<link rel="preload" href="{{ .url }}" as="style" onload="this.onload=null;this.rel='stylesheet'"{{ with .integrity }} integrity="{{ . }}"{{ end }}{{ with .extra }} {{ . | safeHTMLAttr }}{{ end }}>
|
||||
<noscript><link rel="stylesheet" href="{{ .url }}"{{ with .integrity }} integrity="{{ . }}"{{ end }}></noscript>
|
||||
|
||||
@@ -1,27 +1,26 @@
|
||||
{{- $siteSourceUrl := site.Params.siteSourceUrl -}}
|
||||
{{- $submoduleLinks := site.Data.submodules -}}
|
||||
{{- $hostData := site.Data.hosts -}}
|
||||
{{- $scratch := .scratch -}}
|
||||
{{- $submoduleLinks := hugo.Data.submodules -}}
|
||||
{{- $hostData := hugo.Data.hosts -}}
|
||||
{{- $lines := .lines -}}
|
||||
{{- $scratch.Set "bestLength" -1 -}}
|
||||
{{- $scratch.Set "bestUrl" (printf "%s/code/%s" $siteSourceUrl .path) -}}
|
||||
{{- $scratch.Set "bestPath" "" -}}
|
||||
{{- $bestLength := -1 -}}
|
||||
{{- $bestUrl := printf "%s/code/%s" $siteSourceUrl .path -}}
|
||||
{{- $bestPath := "" -}}
|
||||
{{- $filePath := .path -}}
|
||||
{{- range $path, $url := $submoduleLinks -}}
|
||||
{{- $bestLength := $scratch.Get "bestLength" -}}
|
||||
{{- if and (le $bestLength (len $path)) (hasPrefix $filePath $path) -}}
|
||||
{{- $scratch.Set "bestLength" (len $path) -}}
|
||||
{{- $scratch.Set "bestPath" $path -}}
|
||||
{{- $scratch.Set "bestUrl" (printf "%s%s" $url (strings.TrimPrefix $path $filePath)) -}}
|
||||
{{- $bestLength = len $path -}}
|
||||
{{- $bestPath = $path -}}
|
||||
{{- $bestUrl = printf "%s%s" $url (strings.TrimPrefix $path $filePath) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if .lines -}}
|
||||
{{- /* If the user provided a line range, see if we can tack it on to the end of the link. */ -}}
|
||||
{{- range $host, $data := $hostData -}}
|
||||
{{- if hasPrefix ($scratch.Get "bestUrl") $host -}}
|
||||
{{- if hasPrefix $bestUrl $host -}}
|
||||
{{- with $data.linesSuffix -}}
|
||||
{{- $scratch.Add "bestUrl" (printf . (index $lines 0) (index $lines 1)) -}}
|
||||
{{- $bestUrl = add $bestUrl (printf . (index $lines 0) (index $lines 1)) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- return (dict "url" $bestUrl "basePath" $bestPath) -}}
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
<!-- Fonts -->
|
||||
{{ if not (.Site.Params.noCss) }}
|
||||
{{ $fonts := resources.Get "scss/fonts.scss" | css.Sass | resources.Minify }}
|
||||
<link rel="stylesheet" href="{{ $fonts.Permalink }}" media="screen">
|
||||
{{ $fonts := resources.Get "scss/fonts.scss" | css.Sass | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $fonts.Permalink }}" integrity="{{ $fonts.Data.Integrity }}" media="screen">
|
||||
{{ end }}
|
||||
|
||||
<!-- External CSS (normalize and KaTeX -->
|
||||
@@ -30,22 +30,25 @@
|
||||
{{ end -}}
|
||||
|
||||
<!-- In-house CSS -->
|
||||
{{ $style := resources.Get "scss/style.scss" | css.Sass | resources.Minify }}
|
||||
{{ $sidenotes := resources.Get "scss/sidenotes.scss" | css.Sass | resources.Minify }}
|
||||
{{ $code := resources.Get "scss/code.scss" | css.Sass | resources.Minify }}
|
||||
{{ $icon := resources.Get "img/favicon.png" }}
|
||||
{{ $style := resources.Get "scss/style.scss" | css.Sass | resources.Minify | resources.Fingerprint }}
|
||||
{{ $sidenotes := resources.Get "scss/sidenotes.scss" | css.Sass | resources.Minify | resources.Fingerprint }}
|
||||
{{ $code := resources.Get "scss/code.scss" | css.Sass | resources.Minify | resources.Fingerprint }}
|
||||
{{ $icon := resources.Get "img/favicon.png" | resources.Fingerprint }}
|
||||
<style>.feather { display: inline !important; width: 10px; height: 10px; }</style>
|
||||
<style>img { max-width: 70%; }</style>
|
||||
{{ if not (.Site.Params.noCss) }}
|
||||
<link rel="stylesheet" href="{{ $style.Permalink }}">
|
||||
{{ partial "defercss.html" (dict "url" $sidenotes.Permalink "extra" "") }}
|
||||
{{ partial "defercss.html" (dict "url" $code.Permalink "extra" "") }}
|
||||
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">
|
||||
{{ partial "defercss.html" (dict "url" $sidenotes.Permalink "integrity" $sidenotes.Data.Integrity "extra" "") }}
|
||||
{{ partial "defercss.html" (dict "url" $code.Permalink "integrity" $code.Data.Integrity "extra" "") }}
|
||||
{{ end }}
|
||||
<link rel="icon" type="image/png" href="{{ $icon.Permalink }}">
|
||||
<link rel="icon" type="image/png" href="{{ $icon.Permalink }}" integrity="{{ $icon.Data.Integrity }}">
|
||||
|
||||
{{ if .Params.custom_js }}
|
||||
{{ range $customJs := .Params.custom_js }}
|
||||
<script src="{{ page.Resources.Get $customJs }}"></script>
|
||||
{{ with page.Resources.Get $customJs }}
|
||||
{{ $customJsResource := . | resources.Fingerprint }}
|
||||
<script src="{{ $customJsResource.Permalink }}" integrity="{{ $customJsResource.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
@@ -66,14 +69,14 @@
|
||||
<meta name="needs-latex">
|
||||
<!-- Code to support the Bergamot JS widget -->
|
||||
<script defer src="{{ .Site.Params.katexJsUrl }}" crossorigin="anonymous"></script>
|
||||
{{ $katexComponentJs := resources.Get "js/katex-component.js" | resources.Minify }}
|
||||
<script defer src="{{ $katexComponentJs.Permalink }}"></script>
|
||||
{{ $katexComponentJs := resources.Get "js/katex-component.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $katexComponentJs.Permalink }}" integrity="{{ $katexComponentJs.Data.Integrity }}"></script>
|
||||
<script defer src="{{ .Site.Params.bergamotJsUrl }}"></script>
|
||||
<script defer src="{{ .Site.Params.bergamotObjectLanguageJsUrl }}"></script>
|
||||
{{ $bergamotHelpers := resources.Get "js/bergamot-helpers.js" | resources.Minify }}
|
||||
<script defer src="{{ $bergamotHelpers.Permalink }}"></script>
|
||||
{{ $bergamotStyle := resources.Get "scss/bergamot.scss" | css.Sass | resources.Minify }}
|
||||
{{ partial "defercss.html" (dict "url" $bergamotStyle.Permalink "extra" "") }}
|
||||
{{ $bergamotHelpers := resources.Get "js/bergamot-helpers.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $bergamotHelpers.Permalink }}" integrity="{{ $bergamotHelpers.Data.Integrity }}"></script>
|
||||
{{ $bergamotStyle := resources.Get "scss/bergamot.scss" | css.Sass | resources.Minify | resources.Fingerprint }}
|
||||
{{ partial "defercss.html" (dict "url" $bergamotStyle.Permalink "integrity" $bergamotStyle.Data.Integrity "extra" "") }}
|
||||
{{ if .Params.bergamot.render_presets }}
|
||||
{{ range $name, $rulefile := .Params.bergamot.render_presets }}
|
||||
{{ $file := default (resources.Get $rulefile) (page.Resources.Get $rulefile) }}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{{ if eq .from .to }}
|
||||
{{ .scratch.Set "comment" (printf ", line %d" .from) }}
|
||||
{{ else }}
|
||||
{{ if eq .from 0 }}
|
||||
{{ .scratch.Set "comment" (printf ", around line %d" .to) }}
|
||||
{{ else }}
|
||||
{{ .scratch.Set "comment" (printf ", lines %d through %d" .from .to) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- $comment := "" -}}
|
||||
{{- if eq .from .to -}}
|
||||
{{- $comment = printf ", line %d" .from -}}
|
||||
{{- else if eq .from 0 -}}
|
||||
{{- $comment = printf ", around line %d" .to -}}
|
||||
{{- else -}}
|
||||
{{- $comment = printf ", lines %d through %d" .from .to -}}
|
||||
{{- end -}}
|
||||
{{- return $comment -}}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{- $term := index (.page.GetTerms "series") 0 -}}
|
||||
{{- $divider := $term.Params.divider -}}
|
||||
{{- $name := .page.Title -}}
|
||||
{{- if (and $divider (strings.Contains .page.Title $divider)) -}}
|
||||
{{- $rest := after 1 (split .page.Title $divider) -}}
|
||||
{{- .scratch.Set "name" (delimit $rest $divider) -}}
|
||||
{{- else -}}
|
||||
{{- .scratch.Set "name" .page.Title -}}
|
||||
{{- $name = delimit $rest $divider -}}
|
||||
{{- end -}}
|
||||
{{- return $name -}}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<li>
|
||||
{{- $scratch := newScratch -}}
|
||||
{{- $name := .page.Title -}}
|
||||
{{- if .seriesName -}}
|
||||
{{- partial "nameinseries" (dict "page" .page "scratch" $scratch) -}}
|
||||
{{- else -}}
|
||||
{{- $scratch.Set "name" (.page.Title) -}}
|
||||
{{- $name = partial "nameinseries" (dict "page" .page) -}}
|
||||
{{- end -}}
|
||||
<a href="{{ .page.Permalink }}" class="post-title">{{ if .page.Params.favorite }}{{ partial "icon.html" "star" }}{{ end }} {{ $scratch.Get "name" }}</a>
|
||||
<a href="{{ .page.Permalink }}" class="post-title">{{ if .page.Params.favorite }}{{ partial "icon.html" "star" }}{{ end }} {{ $name }}</a>
|
||||
{{ if (not (eq .page.WordCount 0)) }}
|
||||
<p class="post-wordcount">{{ i18n "nWords" .page.WordCount }}, {{ i18n "nMinutesToRead" .page.ReadingTime }}.</p>
|
||||
{{ end }}
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
{{ if eq .direction "previous" }}{{ partial "icon.html" "chevrons-left" }}{{ end }}
|
||||
<div class="title-subtitle">
|
||||
{{ title .direction }} in Series
|
||||
{{ $scratch := newScratch -}}
|
||||
{{- partial "nameinseries.html" (dict "page" .page "scratch" $scratch) -}}
|
||||
<div class="title">{{ $scratch.Get "name" }}</div>
|
||||
<div class="title">{{ partial "nameinseries.html" (dict "page" .page) }}</div>
|
||||
</div>
|
||||
{{ if eq .direction "next" }}{{ partial "icon.html" "chevrons-right" }}{{ end }}
|
||||
</a>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{{- $scratch := .scratch -}}
|
||||
{{- $scratch.Set "pages" slice -}}
|
||||
{{- $pages := slice -}}
|
||||
{{- $tmpScratch := newScratch -}}
|
||||
{{- range $post := (where (where site.Pages.ByDate.Reverse "Section" "blog") ".Kind" "!=" "section") -}}
|
||||
{{- $term := index ($post.GetTerms "series") 0 -}}
|
||||
{{- if (and $term (not ($term.Param "donotunique"))) -}}
|
||||
{{- if not ($tmpScratch.Get $term.Permalink) -}}
|
||||
{{- $tmpScratch.Set $term.Permalink true -}}
|
||||
{{- $scratch.Add "pages" $post -}}
|
||||
{{- $pages = $pages | append $post -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $scratch.Add "pages" $post -}}
|
||||
{{- $pages = $pages | append $post -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- return $pages -}}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
{{- $scratch := newScratch -}}
|
||||
{{- partial "geturl.html" (dict "scratch" $scratch "path" (.Get 1)) -}}
|
||||
{{- $url := partial "geturl.html" (dict "path" (.Get 1)) -}}
|
||||
{{- $groupconfig := dict
|
||||
"url" ($scratch.Get "bestUrl")
|
||||
"basePath" ($scratch.Get "bestPath")
|
||||
"url" $url.url
|
||||
"basePath" $url.basePath
|
||||
"path" (.Get 1)
|
||||
"comment" ", entire file"
|
||||
"code" (readFile (printf "code/%s" (.Get 1)))
|
||||
|
||||
@@ -35,17 +35,17 @@
|
||||
{{- $joinedLines = delimit $lines "\n" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- partial "geturl.html" (dict "scratch" $scratch "path" (.Get 1) "lines" (slice (.Get 2) (.Get 3))) -}}
|
||||
{{- partial "linerangestr.html" (dict "scratch" $scratch "from" (.Get 2) "to" (.Get 3)) -}}
|
||||
{{- $url := partial "geturl.html" (dict "path" (.Get 1) "lines" (slice (.Get 2) (.Get 3))) -}}
|
||||
{{- $comment := partial "linerangestr.html" (dict "from" (.Get 2) "to" (.Get 3)) -}}
|
||||
|
||||
{{- with ($scratch.Get "hidden") -}}
|
||||
<details><summary>{{- . | markdownify -}}</summary>
|
||||
{{- end -}}
|
||||
{{- $groupconfig := dict
|
||||
"url" ($scratch.Get "bestUrl")
|
||||
"basePath" ($scratch.Get "bestPath")
|
||||
"url" $url.url
|
||||
"basePath" $url.basePath
|
||||
"path" (.Get 1)
|
||||
"comment" ($scratch.Get "comment")
|
||||
"comment" $comment
|
||||
"code" $joinedLines
|
||||
"firstLine" (int (.Get 2))
|
||||
"lastLine" (int (.Get 3))
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
{{- $scratch := newScratch -}}
|
||||
{{- partial "geturl.html" (dict "scratch" $scratch "path" (.Get 0)) -}}
|
||||
{{- $scratch.Get "bestUrl" -}}
|
||||
{{- $url := partial "geturl.html" (dict "path" (.Get 0)) -}}
|
||||
{{- $url.url -}}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
{{- $line := .Get 4 -}}
|
||||
{{- $lines := split (trim .Inner "\n") "\n" -}}
|
||||
|
||||
{{- $scratch := newScratch -}}
|
||||
{{- $url := printf "https://github.com/%s/blob/%s/%s#L%d" $repo $commit $file $line -}}
|
||||
{{- partial "linerangestr.html" (dict "scratch" $scratch "from" 0 "to" $line) -}}
|
||||
{{- partial "highlightgroup.html" (dict "url" $url "path" $file "comment" ($scratch.Get "comment") "code" (trim .Inner "\n") "language" $lang) -}}
|
||||
{{- $comment := partial "linerangestr.html" (dict "from" 0 "to" $line) -}}
|
||||
{{- partial "highlightgroup.html" (dict "url" $url "path" $file "comment" $comment "code" (trim .Inner "\n") "language" $lang) -}}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{{- $name := .Get 0 -}}
|
||||
{{- $number := 1 -}}
|
||||
{{- with .Page.Scratch.Get "internal-ref-counter" -}}
|
||||
{{- with .Page.Store.Get "internal-ref-counter" -}}
|
||||
{{- $number = add . 1 }}
|
||||
{{- end -}}
|
||||
{{- .Page.Scratch.Set "internal-ref-counter" $number -}}
|
||||
{{- .Page.Scratch.SetInMap "internal-ref" $name $number -}}
|
||||
{{- .Page.Store.Set "internal-ref-counter" $number -}}
|
||||
{{- .Page.Store.SetInMap "internal-ref" $name $number -}}
|
||||
|
||||
<span class="internal-ref" id="internal-ref-{{ $name }}">
|
||||
{{ .Inner }}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{- $name := .Get 0 -}}
|
||||
{{- $number := index (.Page.Scratch.Get "internal-ref") $name -}}
|
||||
{{- $number := index (.Page.Store.Get "internal-ref") $name -}}
|
||||
|
||||
<a href="#internal-ref-{{ $name }}">
|
||||
{{ .Inner }}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
{{- $scratch := newScratch -}}
|
||||
{{- partial "geturl.html" (dict "scratch" $scratch "path" (.Get 0) "siteSourceUrl" .Site.Params.siteSourceUrl "submoduleLinks" hugo.Data.submodules) -}}
|
||||
{{- $url := partial "geturl.html" (dict "path" (.Get 0)) -}}
|
||||
{{- $groupconfig := dict
|
||||
"url" ($scratch.Get "bestUrl")
|
||||
"basePath" ($scratch.Get "bestPath")
|
||||
"url" $url.url
|
||||
"basePath" $url.basePath
|
||||
"path" (.Get 0)
|
||||
"comment" ", entire file"
|
||||
"content" (safeHTML (printf "<pre><code>%s</code></pre>" (htmlEscape (readFile (printf "code/%s" (.Get 0))))))
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
{{ .Content }}
|
||||
|
||||
{{ i18n "recentPosts" }}:
|
||||
{{ partial "uniquebyseries.html" (dict "scratch" .Scratch) }}
|
||||
{{ $pages := partial "uniquebyseries.html" . }}
|
||||
<ul class="post-list">
|
||||
{{ range first 10 (.Scratch.Get "pages") }}
|
||||
{{ range first 10 $pages }}
|
||||
{{ partial "post.html" (dict "page" . "linkSeries" true) }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<h2>{{ .Title }} </h2>
|
||||
{{ .Content }}
|
||||
|
||||
{{ $search := resources.Get "scss/search.scss" | css.Sass | resources.Minify }}
|
||||
<link rel="stylesheet" href="{{ $search.Permalink }}" media="screen">
|
||||
{{ $search := resources.Get "scss/search.scss" | css.Sass | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $search.Permalink }}" integrity="{{ $search.Data.Integrity }}" media="screen">
|
||||
|
||||
<div class="stork-wrapper">
|
||||
<div class="stork-input-wrapper">
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
<head>
|
||||
{{- partial "head.html" . -}}
|
||||
|
||||
{{ $writingcss := resources.Get "scss/writing.scss" | css.Sass | resources.Minify }}
|
||||
<link rel="stylesheet" href="{{ $writingcss.Permalink }}">
|
||||
{{ $writingcss := resources.Get "scss/writing.scss" | css.Sass | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $writingcss.Permalink }}" integrity="{{ $writingcss.Data.Integrity }}">
|
||||
|
||||
{{ if .Params.custom_css }}
|
||||
{{ range $customCss := .Params.custom_css }}
|
||||
{{ $renderedCustomCss := page.Resources.Get $customCss | css.Sass (dict "includePaths" (slice "themes/vanilla/assets/scss")) | resources.Minify }}
|
||||
<link rel="stylesheet" href="{{ $renderedCustomCss.Permalink }}">
|
||||
{{ $renderedCustomCss := page.Resources.Get $customCss | css.Sass (dict "includePaths" (slice "themes/vanilla/assets/scss")) | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $renderedCustomCss.Permalink }}" integrity="{{ $renderedCustomCss.Data.Integrity }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user