Compare commits

..

1 Commits

Author SHA1 Message Date
868be30118 Adjust summaries to account for Hugo breaking changes
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2025-03-02 18:53:48 -08:00
20 changed files with 247 additions and 414 deletions

View File

@@ -43,23 +43,3 @@
@include font-raleway(400); @include font-raleway(400);
@include font-raleway(700); @include font-raleway(700);
@include font-stixgeneral(); @include font-stixgeneral();
/* Generated from chatgpt-adjust-fallback.py */
@font-face {
font-family: "Raleway Fallback";
src: local("Arial");
size-adjust: 100.09%;
ascent-override: 94.00%;
descent-override: 23.40%;
line-gap-override: 0.00%;
}
@font-face {
font-family: "Lora Fallback";
src: local("Times New Roman");
size-adjust: 111.79%;
ascent-override: 100.60%;
descent-override: 27.40%;
line-gap-override: 0.00%;
}

View File

@@ -67,20 +67,12 @@ p {
} }
} }
.tag-list { .button, input[type="submit"] {
display: flex;
flex-wrap: wrap;
gap: 0.5rem 0.25rem;
justify-content: center;
}
.tag {
@include var(color, text-color); @include var(color, text-color);
padding: 0.5rem; padding: 0.5rem;
border: 1px solid $primary-color; border: 1px solid $primary-color;
transition: color 0.25s, background-color 0.25s; transition: color 0.25s, background-color 0.25s;
text-align: left; text-align: left;
display: block;
&:focus { &:focus {
outline: none; outline: none;
@@ -338,7 +330,8 @@ figure {
That's because firefox reader mode doesn't play nice with them, and That's because firefox reader mode doesn't play nice with them, and
it seems to ignore all styles in <head>. Then, the inline style it seems to ignore all styles in <head>. Then, the inline style
in <head> uses !important to restore the display of icons, but provides in <head> uses !important to restore the display of icons, but provides
limited styling. Here, we finally apply the full extent of the feather styles. limited styling. Here, we finally apply the full extent of the feather
styles.
*/ */
.feather { .feather {
width: 1rem; width: 1rem;
@@ -409,6 +402,7 @@ figure {
} }
} }
a, .ongoing-placeholder { a, .ongoing-placeholder {
@include bordered-block; @include bordered-block;
padding: 0.5em 1em 0.5em 1em; padding: 0.5em 1em 0.5em 1em;

View File

@@ -9,8 +9,8 @@ $background-color-dark: #1b1d1f;
$standard-border-width: .075rem; $standard-border-width: .075rem;
$standard-border: $standard-border-width solid $border-color; $standard-border: $standard-border-width solid $border-color;
$font-heading: "Lora", "Lora Fallback", serif; $font-heading: "Lora", serif;
$font-body: "Raleway", "Raleway Fallback", sans-serif; $font-body: "Raleway", serif;
$font-code: "Inconsolata", monospace, "STIXGeneral"; $font-code: "Inconsolata", monospace, "STIXGeneral";
$warning-background-color: #ffee99; $warning-background-color: #ffee99;
@@ -23,7 +23,7 @@ $target-background-color-dark: #55511c;
$code-color: #f0f0f0; $code-color: #f0f0f0;
$code-color-dark: lighten($background-color-dark, 10%); $code-color-dark: lighten($background-color-dark, 10%);
$code-token-color: darken($primary-color, 25%); $code-token-color: black;
$code-token-color-dark: $primary-color; $code-token-color-dark: $primary-color;
$code-highlight-color: #fffd99; $code-highlight-color: #fffd99;
$code-highlight-color-dark: #555538; $code-highlight-color-dark: #555538;

View File

@@ -1,90 +0,0 @@
"""
Generate @font-face settings to help make the fallback font look similar
to the non-fallback font.
Genererated by ChatGTP 5.2-instant. Not human-modified.
"""
from fontTools.ttLib import TTFont
USE_TYPO_METRICS = 1 << 7
def get_metrics(path):
font = TTFont(path)
head = font["head"]
os2 = font["OS/2"]
hhea = font["hhea"]
use_typo = bool(os2.fsSelection & USE_TYPO_METRICS)
if use_typo:
asc = os2.sTypoAscender
desc = os2.sTypoDescender
gap = os2.sTypoLineGap
source = "OS/2.sTypo*"
else:
asc = hhea.ascent
desc = -hhea.descent
gap = hhea.lineGap
source = "hhea.*"
# x-height ALWAYS comes from OS/2
if not hasattr(os2, "sxHeight") or os2.sxHeight <= 0:
raise ValueError(f"{path} has no usable sxHeight")
x_height = os2.sxHeight
print("Source", path, source)
return {
"unitsPerEm": head.unitsPerEm,
"ascender": asc,
"descender": desc,
"lineGap": gap,
"xHeight": x_height,
}
def compute_overrides(target, fallback):
# size-adjust: match x-height
size_adjust = (
(target["xHeight"] / target["unitsPerEm"]) /
(fallback["xHeight"] / fallback["unitsPerEm"])
)
# overrides: force target vertical metrics
ascent_override = target["ascender"] / target["unitsPerEm"]
descent_override = abs(target["descender"]) / target["unitsPerEm"]
line_gap_override = target["lineGap"] / target["unitsPerEm"]
return {
"size_adjust": size_adjust * 100,
"ascent_override": ascent_override * 100,
"descent_override": descent_override * 100,
"line_gap_override": line_gap_override * 100,
}
def emit_css(family_name, local_name, values):
return f"""
@font-face {{
font-family: "{family_name}";
src: local("{local_name}");
size-adjust: {values['size_adjust']:.2f}%;
ascent-override: {values['ascent_override']:.2f}%;
descent-override: {values['descent_override']:.2f}%;
line-gap-override: {values['line_gap_override']:.2f}%;
}}
""".strip()
# ---- Example usage ----
target = get_metrics("static/fonts/gen/Lora-Regular.woff2")
fallback = get_metrics("/System/Library/Fonts/Supplemental/Times New Roman.ttf")
values = compute_overrides(target, fallback)
print(emit_css(
family_name="Lora Fallback",
local_name="Times New Roman",
values=values,
))

View File

@@ -1,9 +0,0 @@
{{ if and (eq .Type "alert") (eq .AlertType "todo") -}}
<div style="background-color: tomato; color: white; padding: 10px;">
<em>TODO: </em>{{- .Text | plainify -}}
</div>
{{- else -}}
<blockquote {{- with .Attributes.id }} id="{{ . }}"{{ end }}>
{{ .Text -}}
</blockquote>
{{- end }}

View File

@@ -1,25 +1,24 @@
{{- $class := "" -}} {{- $scratch := newScratch -}}
{{- $icon := "" -}}
{{- $absoluteDest := absLangURL .Destination -}} {{- $absoluteDest := absLangURL .Destination -}}
{{- $siteRootUrl := absLangURL "" -}} {{- $siteRootUrl := absLangURL "" -}}
{{- $isExternal := not (hasPrefix $absoluteDest $siteRootUrl) -}} {{- $isExternal := not (hasPrefix $absoluteDest $siteRootUrl) -}}
{{- $isSamePage := hasPrefix .Destination "#" -}} {{- $isSamePage := hasPrefix .Destination "#" -}}
{{- if $isSamePage -}} {{- if $isSamePage -}}
{{- $class = "same-page-link" -}} {{- $scratch.Set "class" "same-page-link" -}}
{{- if index (.Page.Scratch.Get "definedSections") .Destination -}} {{- if index (.Page.Scratch.Get "definedSections") .Destination -}}
{{- $icon = "arrow-up" -}} {{- $scratch.Set "icon" "arrow-up" -}}
{{- else -}} {{- else -}}
{{- /* Do not render "down" links because don't know how to distinguish unseen titles from paragraph links. */ -}} {{- /* Do not render "down" links because don't know how to distinguish unseen titles from paragraph links. */ -}}
{{- /* $icon = "arrow-down" */ -}} {{- /* $scratch.Set "icon" "arrow-down" */ -}}
{{- end -}} {{- end -}}
{{- else if $isExternal -}} {{- else if $isExternal -}}
{{- $class = "external-link" -}} {{- $scratch.Set "class" "external-link" -}}
{{- $icon = "external-link" -}} {{- $scratch.Set "icon" "external-link" -}}
{{- end -}} {{- end -}}
<a href="{{ .Destination | safeURL }}" <a href="{{ .Destination | safeURL }}"
{{- with .Title }} title="{{ . }}"{{ end -}} {{- with .Title }} title="{{ . }}"{{ end -}}
{{- with $class -}} {{- with $scratch.Get "class" -}}
class="{{ . }}" class="{{ . }}"
{{- end -}} {{- end -}}
{{- if (and site.Params.externalLinksInNewTab $isExternal) -}} {{- if (and site.Params.externalLinksInNewTab $isExternal) -}}
@@ -27,6 +26,6 @@
{{- end -}} {{- end -}}
> >
{{- with .Text | safeHTML }}{{ . }}{{ end -}} {{- with .Text | safeHTML }}{{ . }}{{ end -}}
{{- with $icon -}}{{- partial "icon.html" . -}}{{- end -}} {{- with $scratch.Get "icon" -}}{{- partial "icon.html" . -}}{{- end -}}
</a> </a>
{{- /* chomp trailing newline */ -}} {{- /* chomp trailing newline */ -}}

View File

@@ -1,8 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ .Site.Language.Lang }}"> <html lang="{{ .Site.Language.Lang }}">
<head>
{{- partial "head.html" . -}} {{- partial "head.html" . -}}
</head>
<body> <body>
{{- partial "header.html" . -}} {{- partial "header.html" . -}}
<div class="container"><hr class="header-divider"></div> <div class="container"><hr class="header-divider"></div>

View File

@@ -1,9 +1,9 @@
{{ define "main" }} {{ define "main" }}
<h2>{{ .Title }}</h2> <h2>{{ .Title }}</h2>
<div class="post-subscript"> <div class="post-subscript">
<p class="tag-list"> <p>
{{- range (.GetTerms "tags") -}} {{- range (.GetTerms "tags") -}}
<a class="tag" href="{{ .Permalink }}">{{ .Title }}</a> <a class="button" href="{{ .Permalink }}">{{ .Title }}</a>
{{ end -}} {{ end -}}
</p> </p>
<p>{{ i18n "postedOn" (.Date.Format "January 2, 2006") }}.</p> <p>{{ i18n "postedOn" (.Date.Format "January 2, 2006") }}.</p>

View File

@@ -1,3 +1,4 @@
<head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#1dc868"> <meta name="theme-color" content="#1dc868">
@@ -57,8 +58,6 @@
{{ end }} {{ end }}
{{ if .Params.bergamot }} {{ if .Params.bergamot }}
<!-- Ensure later scripts keep the KaTeX CSS even if the page has no LaTeX !-->
<meta name="needs-latex">
<!-- Code to support the Bergamot JS widget --> <!-- Code to support the Bergamot JS widget -->
<script defer src="{{ .Site.Params.katexJsUrl }}" crossorigin="anonymous"></script> <script defer src="{{ .Site.Params.katexJsUrl }}" crossorigin="anonymous"></script>
{{ $katexComponentJs := resources.Get "js/katex-component.js" | resources.Minify }} {{ $katexComponentJs := resources.Get "js/katex-component.js" | resources.Minify }}
@@ -97,3 +96,4 @@
{{ end }} {{ end }}
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
</head>

View File

@@ -1,11 +1,12 @@
{{- $highlightGroupAttrs := (printf "data-base-path=\"%s\" data-file-path=\"%v\"" .basePath .path) -}} {{- $scratch := newScratch -}}
{{- $scratch.Set "highlightGroupAttrs" (printf "data-base-path=\"%s\" data-file-path=\"%v\"" .basePath .path) -}}
{{- if (or .firstLine .lastLine) -}} {{- if (or .firstLine .lastLine) -}}
{{- $highlightGroupAttrs = add $highlightGroupAttrs (printf " data-first-line=\"%v\" data-last-line=\"%v\"" .firstLine .lastLine) -}} {{- $scratch.Add "highlightGroupAttrs" (printf " data-first-line=\"%v\" data-last-line=\"%v\"" .firstLine .lastLine) -}}
{{- end -}} {{- end -}}
{{- if eq (lower .language) "agda" -}} {{- if eq (lower .language) "agda" -}}
{{- $highlightGroupAttrs = add $highlightGroupAttrs " data-agda-block" -}} {{- $scratch.Add "highlightGroupAttrs" " data-agda-block" -}}
{{- end -}} {{- end -}}
{{- with .offset -}} {{- with .offset -}}
{{- $highlightGroupAttrs = add $highlightGroupAttrs (printf " data-source-offset=\"%v\"" .) -}} {{- $scratch.Add "highlightGroupAttrs" (printf " data-source-offset=\"%v\"" .) -}}
{{- end -}} {{- end -}}
{{ partial "group.html" (dict "url" .url "path" .path "comment" .comment "content" (highlight .code .language .opts) "attrs" $highlightGroupAttrs) }} {{ partial "group.html" (dict "url" .url "path" .path "comment" .comment "content" (highlight .code .language .opts) "attrs" ($scratch.Get "highlightGroupAttrs")) }}

View File

@@ -18,12 +18,10 @@
{{- if .linkSeries -}} {{- if .linkSeries -}}
{{- $term := index (.page.GetTerms "series") 0 -}} {{- $term := index (.page.GetTerms "series") 0 -}}
{{- with $term -}} {{- with $term -}}
{{- if (not ($term.Param "donotunique")) -}}
<div class="series-link"> <div class="series-link">
{{- partial "icon.html" "corner-down-right" -}} {{- partial "icon.html" "corner-down-right" -}}
<p>{{- i18n "latestInSeries" }} <a href="{{ $term.Permalink }}">{{ $term.Title }}</a></p> <p>{{- i18n "latestInSeries" }} <a href="{{ $term.Permalink }}">{{ $term.Title }}</a></p>
</div> </div>
{{- end -}} {{- end -}}
{{- end -}}
{{- end }} {{- end }}
</li> </li>

View File

@@ -1,5 +0,0 @@
{{- if .Params.summary -}}
{{ .Params.summary | markdownify | plainify }}
{{- else -}}
{{ .Summary | plainify | truncate 180 }}
{{- end -}}

View File

@@ -3,7 +3,7 @@
{{- $tmpScratch := newScratch -}} {{- $tmpScratch := newScratch -}}
{{- range $post := (where (where site.Pages.ByDate.Reverse "Section" "blog") ".Kind" "!=" "section") -}} {{- range $post := (where (where site.Pages.ByDate.Reverse "Section" "blog") ".Kind" "!=" "section") -}}
{{- $term := index ($post.GetTerms "series") 0 -}} {{- $term := index ($post.GetTerms "series") 0 -}}
{{- if (and $term (not ($term.Param "donotunique"))) -}} {{- if $term -}}
{{- if not ($tmpScratch.Get $term.Permalink) -}} {{- if not ($tmpScratch.Get $term.Permalink) -}}
{{- $tmpScratch.Set $term.Permalink true -}} {{- $tmpScratch.Set $term.Permalink true -}}
{{- $scratch.Add "pages" $post -}} {{- $scratch.Add "pages" $post -}}

View File

@@ -1,38 +1,39 @@
{{- $source := (readFile (printf "code/%s" (.Get 1))) -}} {{- $source := (readFile (printf "code/%s" (.Get 1))) -}}
{{- $allLines := split $source "\n" -}} {{- $allLines := split $source "\n" -}}
{{- $scratch := newScratch -}} {{- $scratch := newScratch -}}
{{- $remLines := $allLines -}}
{{- if not (eq (int (.Get 2)) 1) -}} {{- if not (eq (int (.Get 2)) 1) -}}
{{- $remLines = after (sub (int (.Get 2)) 1) $allLines -}} {{- $scratch.Set "remLines" (after (sub (int (.Get 2)) 1) $allLines) -}}
{{- else -}}
{{- $scratch.Set "remLines" $allLines -}}
{{- end -}} {{- end -}}
{{- $lines := first (add (sub (int (.Get 3)) (int (.Get 2))) 1) $remLines -}} {{- $lines := first (add (sub (int (.Get 3)) (int (.Get 2))) 1) ($scratch.Get "remLines") -}}
{{- $opts := "" -}}
{{- if (.Get 4) -}} {{- if (.Get 4) -}}
{{- $opts = printf ",%s" (.Get 4) -}} {{- $scratch.Set "opts" (printf ",%s" (.Get 4)) -}}
{{- else -}}
{{- $scratch.Set "opts" "" -}}
{{- end -}} {{- end -}}
{{- if (.Get 5) -}} {{- if (.Get 5) -}}
{{- $scratch.Set "hidden" (.Get 5) -}} {{- $scratch.Set "hidden" (.Get 5) -}}
{{- end -}} {{- end -}}
{{- $prefixLength := "" -}}
{{- $joinedLines := "" -}}
{{- if or (.Page.Params.left_align_code) (.Get 6) -}} {{- if or (.Page.Params.left_align_code) (.Get 6) -}}
{{- $prefixLength = -1 -}} {{- $scratch.Set "prefixLength" -1 -}}
{{- range $line := $lines -}} {{- range $line := $lines -}}
{{- $leading := sub (len $line) (len (strings.TrimLeft " " $line)) -}} {{- $leading := sub (len $line) (len (strings.TrimLeft " " $line)) -}}
{{- if and (ne $line "") (or (eq $prefixLength -1) (le $leading $prefixLength)) -}} {{- if and (ne $line "") (or (eq ($scratch.Get "prefixLength") -1) (le $leading ($scratch.Get "prefixLength"))) -}}
{{- $prefixLength = $leading -}} {{- $scratch.Set "prefixLength" $leading -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- $scratch.Set "joinedLines" "" -}}
{{- range $line := $lines -}} {{- range $line := $lines -}}
{{- $joinedLines = add $joinedLines (substr $line $prefixLength) -}} {{- $scratch.Add "joinedLines" (substr $line ($scratch.Get "prefixLength")) -}}
{{- $joinedLines = add $joinedLines "\n" -}} {{- $scratch.Add "joinedLines" "\n" -}}
{{- end -}} {{- end -}}
{{- else -}} {{- else -}}
{{- $joinedLines = delimit $lines "\n" -}} {{- $scratch.Set "joinedLines" (delimit $lines "\n") -}}
{{- end -}} {{- end -}}
{{- partial "geturl.html" (dict "scratch" $scratch "path" (.Get 1) "lines" (slice (.Get 2) (.Get 3))) -}} {{- partial "geturl.html" (dict "scratch" $scratch "path" (.Get 1) "lines" (slice (.Get 2) (.Get 3))) -}}
@@ -46,12 +47,12 @@
"basePath" ($scratch.Get "bestPath") "basePath" ($scratch.Get "bestPath")
"path" (.Get 1) "path" (.Get 1)
"comment" ($scratch.Get "comment") "comment" ($scratch.Get "comment")
"code" $joinedLines "code" ($scratch.Get "joinedLines")
"firstLine" (int (.Get 2)) "firstLine" (int (.Get 2))
"lastLine" (int (.Get 3)) "lastLine" (int (.Get 3))
"language" (.Get 0) "language" (.Get 0)
"offset" $prefixLength "offset" ($scratch.Get "prefixLength")
"opts" (printf "linenos=table,linenostart=%d%s" (.Get 2) $opts) "opts" (printf "linenos=table,linenostart=%d%s" (.Get 2) ($scratch.Get "opts"))
-}} -}}
{{- partial "highlightgroup.html" $groupconfig -}} {{- partial "highlightgroup.html" $groupconfig -}}
{{- with ($scratch.Get "hidden") -}} {{- with ($scratch.Get "hidden") -}}

View File

@@ -1,6 +1,5 @@
<span class="sidenote"> <span class="sidenote">
<label class="sidenote-label" for="{{- .Get 1 -}}">{{- .Get 2 | markdownify -}}</label> <label class="sidenote-label" for="{{- .Get 1 -}}">{{- .Get 2 | markdownify -}}</label>
{{- /* chomp trailing whitespace */ -}}
<input class="sidenote-checkbox" style="display: none;" type="checkbox" id="{{- .Get 1 -}}"></input> <input class="sidenote-checkbox" style="display: none;" type="checkbox" id="{{- .Get 1 -}}"></input>
{{- if $offset := .Get 3 -}} {{- if $offset := .Get 3 -}}
<span class="sidenote-content sidenote-{{- .Get 0 -}}" style="margin-top: {{- $offset -}}rem"> <span class="sidenote-content sidenote-{{- .Get 0 -}}" style="margin-top: {{- $offset -}}rem">
@@ -11,6 +10,4 @@
{{- .Inner -}} {{- .Inner -}}
<span class="sidenote-delimiter">]</span> <span class="sidenote-delimiter">]</span>
</span> </span>
{{- /* chomp trailing whitespace */ -}}
</span> </span>
{{- /* chomp trailing whitespace */ -}}

View File

@@ -0,0 +1,3 @@
<div style="background-color: tomato; color: white; padding: 10px;">
<em>TODO: </em>{{- .Inner -}}
</div>

View File

@@ -1,34 +0,0 @@
{{- /* Note: changing the baseof template because the title, tags, etc. of a regular post are still valid. */ -}}
<!DOCTYPE html>
<html lang="{{ .Site.Language.Lang }}">
<head>
{{- partial "head.html" . -}}
{{ $writingcss := resources.Get "scss/writing.scss" | css.Sass | resources.Minify }}
<link rel="stylesheet" href="{{ $writingcss.Permalink }}">
{{ 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 }}">
{{ end }}
{{ end }}
</head>
<body>
{{ with .Params.body_start_partial }}
{{ partial . $ }}
{{ end }}
{{- partial "header.html" . -}}
<div class="container"><hr class="header-divider"></div>
<main class="container">
{{- if .Draft -}}
{{- partial "warning.html" (i18n "postDraft") -}}
{{- end -}}
{{- block "main" . }}{{- end }}
</main>
{{- block "after" . }}{{- end }}
</body>
</html>