mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2025-02-17 12:20:06 +00:00
Goldmark 1.4.12, switch to good unminified output
- Goldmark 1.4.12 switches footnotes from a <section> to a <div>; update regexes and stylesheet to account for this. - Goldmark 1.4.12 allows multiple footnotes with the same reference; use that. - Clean up templates for unminified output. Also delete an unused class. - Switch to unminified output by default.
This commit is contained in:
parent
f23b4f1975
commit
eb8ca07b9f
7 changed files with 40 additions and 36 deletions
2
Makefile
2
Makefile
|
@ -3,7 +3,7 @@ DEVSERVER_URL="http://localhost:1313/"
|
||||||
|
|
||||||
DOMAIN = seirdy.one
|
DOMAIN = seirdy.one
|
||||||
HUGO_BASEURL = "https://$(DOMAIN)/"
|
HUGO_BASEURL = "https://$(DOMAIN)/"
|
||||||
HUGO_FLAGS = --gc --minify --ignoreCache
|
HUGO_FLAGS = --gc --ignoreCache
|
||||||
USER = deploy@$(DOMAIN)
|
USER = deploy@$(DOMAIN)
|
||||||
WWW_ROOT = /var/www/$(DOMAIN)
|
WWW_ROOT = /var/www/$(DOMAIN)
|
||||||
GEMINI_ROOT = /srv/gemini/$(DOMAIN)
|
GEMINI_ROOT = /srv/gemini/$(DOMAIN)
|
||||||
|
|
|
@ -182,7 +182,7 @@ img:not(.u-photo) {
|
||||||
* Also use "content-visibility: auto" to improve performance by
|
* Also use "content-visibility: auto" to improve performance by
|
||||||
* reducing the number of DOM nodes rendered at once. */
|
* reducing the number of DOM nodes rendered at once. */
|
||||||
footer,
|
footer,
|
||||||
section[role="doc-endnotes"] {
|
div[role="doc-endnotes"] {
|
||||||
border-top: 1px solid;
|
border-top: 1px solid;
|
||||||
content-visibility: auto;
|
content-visibility: auto;
|
||||||
}
|
}
|
||||||
|
|
|
@ -701,7 +701,7 @@ Color schemes should also look good to users who apply gamma adjustments. Most o
|
||||||
In defense of link under­lines {#in-defense-of-link-underlines}
|
In defense of link under­lines {#in-defense-of-link-underlines}
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
Some typographers insist that [underlined on-screen text is obsolete](https://practicaltypography.com/underlining.html), and hyperlinks are no exception. I disagree.
|
Some typographers insist that [underlined on-screen text is obsolete](https://practicaltypography.com/underlining.html)[^12], and that hyperlinks are no exception. I disagree.
|
||||||
|
|
||||||
One reason is that underlines make it easy to separate multiple consecutive inline links:
|
One reason is that underlines make it easy to separate multiple consecutive inline links:
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
{{ $contents := .Inner | htmlEscape }}
|
{{ $contents := .Inner | htmlEscape -}}
|
||||||
{{ $samp := false }}
|
{{- $samp := false -}}
|
||||||
{{ with .Attributes }}
|
{{- with .Attributes -}}
|
||||||
{{ range $k, $v := . }}
|
{{- range $k, $v := . -}}
|
||||||
{{ if strings.HasPrefix $k "var" }}
|
{{- if strings.HasPrefix $k "var" -}}
|
||||||
{{ $after := printf `<var translate="yes">%s</var>` $v }}
|
{{- $after := printf `<var translate="yes">%s</var>` $v -}}
|
||||||
{{ $contents = $contents | replaceRE $v $after }}
|
{{- $contents = $contents | replaceRE $v $after -}}
|
||||||
{{ else if strings.HasPrefix $k "str" }}
|
{{- else if strings.HasPrefix $k "str" -}}
|
||||||
{{ $after := printf `<strong translate="yes">%s</strong>` $v }}
|
{{- $after := printf `<strong translate="yes">%s</strong>` $v -}}
|
||||||
{{ $contents = $contents | replaceRE $v $after }}
|
{{- $contents = $contents | replaceRE $v $after -}}
|
||||||
{{ else if and (eq $k "samp")}}
|
{{- else if and (eq $k "samp")}}
|
||||||
{{ $samp = $v }}
|
{{- $samp = $v -}}
|
||||||
{{ end }}
|
{{- end -}}
|
||||||
{{ end }}
|
{{- end -}}
|
||||||
{{ end }}
|
{{- end -}}
|
||||||
<pre tabindex="0">
|
<pre tabindex="0">
|
||||||
{{- if $samp -}}
|
{{- if $samp -}}
|
||||||
<samp itemprop="text">
|
<samp itemprop="text">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div itemprop="blogPost mainEntity" itemscope itemtype="https://schema.org/BlogPosting">
|
<div itemprop="blogPost mainEntity" itemscope itemtype="https://schema.org/BlogPosting">
|
||||||
<article class="h-entry hentry">
|
<article class="h-entry hentry">
|
||||||
<header id="post-header">
|
<header>
|
||||||
<h1 itemprop="name headline" class="p-name entry-title">{{ .Title }}</h1>
|
<h1 itemprop="name headline" class="p-name entry-title">{{ .Title }}</h1>
|
||||||
<span class="dateline">
|
<span class="dateline">
|
||||||
Posted <time itemprop="datePublished" class="dt-published published" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" title="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>
|
Posted <time itemprop="datePublished" class="dt-published published" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" title="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
{{ if lt .Date .Lastmod -}}
|
{{ if lt .Date .Lastmod -}}
|
||||||
<br>
|
<br>
|
||||||
Last updated <time itemprop="dateModified" class="dt-updated updated" datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}" title="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>. <a href="{{ .Site.Params.logUrlPrefix }}content/{{ .File.Path }}">Changelog</a>.
|
Last updated <time itemprop="dateModified" class="dt-updated updated" datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}" title="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>. <a href="{{ .Site.Params.logUrlPrefix }}content/{{ .File.Path }}">Changelog</a>.
|
||||||
{{ end }}
|
{{- end }}
|
||||||
<br>
|
<br>
|
||||||
<small>
|
<small>
|
||||||
<span itemprop="wordCount">{{ .WordCount }}</span> words, a <span itemprop="timeRequired" content="PT{{ .ReadingTime }}M">{{ .ReadingTime }} minute</span> read
|
<span itemprop="wordCount">{{ .WordCount }}</span> words, a <span itemprop="timeRequired" content="PT{{ .ReadingTime }}M">{{ .ReadingTime }} minute</span> read
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
{{ $footnote_heading := printf "Footnotes" -}}
|
{{- $footnote_heading := printf "Footnotes" -}}
|
||||||
{{ if .Params.footnote_heading -}}
|
{{- if .Params.footnote_heading -}}
|
||||||
{{ $footnote_heading = .Params.footnote_heading -}}
|
{{- $footnote_heading = .Params.footnote_heading -}}
|
||||||
{{end}}
|
{{- end -}}
|
||||||
|
|
||||||
<!--Add heading to footnotes, remove unused class-->
|
<!--
|
||||||
{{ $referencesWithoutHeading := `(<(section|div) class="footnotes" role="doc-endnotes">
|
Add heading to footnotes, remove unused class.
|
||||||
|
Requires Goldmark v1.4.12 or higher, since that version switched
|
||||||
|
endnotes from a <section> to a <div>.
|
||||||
|
-->
|
||||||
|
{{- $referencesWithoutHeading := `(<div class="footnotes" role="doc-endnotes">
|
||||||
<hr>)` -}}
|
<hr>)` -}}
|
||||||
{{ $referencesWithHeading := printf `<section role="doc-endnotes" aria-labelledby="note-hd">
|
{{- $referencesWithHeading := printf `<div role="doc-endnotes" aria-labelledby="note-hd">
|
||||||
<h2 id="note-hd">%s</h2>` ($footnote_heading) -}}
|
<h2 id="note-hd">%s</h2>` ($footnote_heading) -}}
|
||||||
|
|
||||||
<!--Remove deprecated DPUB-ARIA role and unused classes-->
|
<!--Remove deprecated DPUB-ARIA role and unused classes-->
|
||||||
{{ $endnote := `(role="doc-endnote"|class="footnote-(back)?ref")` }}
|
{{- $endnote := `(role="doc-endnote"|class="footnote-(back)?ref")` -}}
|
||||||
{{ $noEndnote := printf "" }}
|
{{- $noEndnote := printf "" -}}
|
||||||
|
|
||||||
<!--Move the Table of Contents heading *inside* the <nav> element-->
|
<!--Move the Table of Contents heading *inside* the <nav> element-->
|
||||||
{{ $tocHeadingOutside := `<h2>Table of Contents</h2><nav(?:.*)>` }}
|
{{- $tocHeadingOutside := `<h2>Table of Contents</h2><nav(?:.*)>` -}}
|
||||||
{{ $tocHeadingInside := `<nav id=TableOfContents role="doc-toc"><h2 id="toc-hd">Table of Contents</h2>` }}
|
{{- $tocHeadingInside := `<nav id=TableOfContents role="doc-toc"><h2 id="toc-hd">Table of Contents</h2>` -}}
|
||||||
|
|
||||||
<!--Give footnote backlinks accessible names-->
|
<!--Give footnote backlinks accessible names-->
|
||||||
{{ $footnoteBacklinksBad := `<a href="#fnref:([0-9]*)"(.*role="doc-backlink"(?:.*)?)>` }}
|
{{- $footnoteBacklinksBad := `<a href="#fnref:([0-9]*)"(.*role="doc-backlink"(?:.*)?)>` -}}
|
||||||
{{ $footnoteBacklinksGood := `<a href="#fnref:${1}" title="back to reference ${1}" aria-label="back to reference ${1}"${2}>` }}
|
{{- $footnoteBacklinksGood := `<a href="#fnref:${1}" title="back to reference ${1}" aria-label="back to reference ${1}"${2}>` -}}
|
||||||
|
|
||||||
{{ .Content | replaceRE $referencesWithoutHeading $referencesWithHeading | replaceRE $endnote $noEndnote | replaceRE $tocHeadingOutside $tocHeadingInside | replaceRE $footnoteBacklinksBad $footnoteBacklinksGood | safeHTML -}}
|
{{- .Content | replaceRE $referencesWithoutHeading $referencesWithHeading | replaceRE $endnote $noEndnote | replaceRE $tocHeadingOutside $tocHeadingInside | replaceRE $footnoteBacklinksBad $footnoteBacklinksGood | safeHTML -}}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{{ .Scratch.Set "codeIndex" 1 }}
|
{{ .Scratch.Set "codeIndex" 1 }}
|
||||||
<div itemprop="blogPost mainEntity" itemscope itemtype="https://schema.org/BlogPosting">
|
<div itemprop="blogPost mainEntity" itemscope itemtype="https://schema.org/BlogPosting">
|
||||||
<article class="h-entry hentry">
|
<article class="h-entry hentry">
|
||||||
<header id="post-header">
|
<header>
|
||||||
<h1 itemprop="name headline" class="p-name entry-title">{{ .Title }}</h1>
|
<h1 itemprop="name headline" class="p-name entry-title">{{ .Title }}</h1>
|
||||||
<span class="dateline">
|
<span class="dateline">
|
||||||
Posted <time itemprop="dateCreated datePublished" class="dt-published published" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" title="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>
|
Posted <time itemprop="dateCreated datePublished" class="dt-published published" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" title="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
{{ if lt .Date .Lastmod -}}
|
{{ if lt .Date .Lastmod -}}
|
||||||
<br>
|
<br>
|
||||||
Last updated <time itemprop="dateModified" class="dt-updated updated" datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}" title="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>. <a href="{{ .Site.Params.logUrlPrefix }}content/{{ .File.Path }}">Changelog</a>.
|
Last updated <time itemprop="dateModified" class="dt-updated updated" datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}" title="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>. <a href="{{ .Site.Params.logUrlPrefix }}content/{{ .File.Path }}">Changelog</a>.
|
||||||
{{ end }}
|
{{- end }}
|
||||||
<br>
|
<br>
|
||||||
<small>
|
<small>
|
||||||
<span itemprop="wordCount">{{ .WordCount }}</span> words, a <span itemprop="timeRequired" content="PT{{ .ReadingTime }}M">{{ .ReadingTime }} minute</span> read
|
<span itemprop="wordCount">{{ .WordCount }}</span> words, a <span itemprop="timeRequired" content="PT{{ .ReadingTime }}M">{{ .ReadingTime }} minute</span> read
|
||||||
|
|
Loading…
Add table
Reference in a new issue