mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-27 14:12:09 +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
|
||||
HUGO_BASEURL = "https://$(DOMAIN)/"
|
||||
HUGO_FLAGS = --gc --minify --ignoreCache
|
||||
HUGO_FLAGS = --gc --ignoreCache
|
||||
USER = deploy@$(DOMAIN)
|
||||
WWW_ROOT = /var/www/$(DOMAIN)
|
||||
GEMINI_ROOT = /srv/gemini/$(DOMAIN)
|
||||
|
|
|
@ -182,7 +182,7 @@ img:not(.u-photo) {
|
|||
* Also use "content-visibility: auto" to improve performance by
|
||||
* reducing the number of DOM nodes rendered at once. */
|
||||
footer,
|
||||
section[role="doc-endnotes"] {
|
||||
div[role="doc-endnotes"] {
|
||||
border-top: 1px solid;
|
||||
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}
|
||||
----------------------------------
|
||||
|
||||
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:
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
{{ $contents := .Inner | htmlEscape }}
|
||||
{{ $samp := false }}
|
||||
{{ with .Attributes }}
|
||||
{{ range $k, $v := . }}
|
||||
{{ if strings.HasPrefix $k "var" }}
|
||||
{{ $after := printf `<var translate="yes">%s</var>` $v }}
|
||||
{{ $contents = $contents | replaceRE $v $after }}
|
||||
{{ else if strings.HasPrefix $k "str" }}
|
||||
{{ $after := printf `<strong translate="yes">%s</strong>` $v }}
|
||||
{{ $contents = $contents | replaceRE $v $after }}
|
||||
{{ else if and (eq $k "samp")}}
|
||||
{{ $samp = $v }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $contents := .Inner | htmlEscape -}}
|
||||
{{- $samp := false -}}
|
||||
{{- with .Attributes -}}
|
||||
{{- range $k, $v := . -}}
|
||||
{{- if strings.HasPrefix $k "var" -}}
|
||||
{{- $after := printf `<var translate="yes">%s</var>` $v -}}
|
||||
{{- $contents = $contents | replaceRE $v $after -}}
|
||||
{{- else if strings.HasPrefix $k "str" -}}
|
||||
{{- $after := printf `<strong translate="yes">%s</strong>` $v -}}
|
||||
{{- $contents = $contents | replaceRE $v $after -}}
|
||||
{{- else if and (eq $k "samp")}}
|
||||
{{- $samp = $v -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
<pre tabindex="0">
|
||||
{{- if $samp -}}
|
||||
<samp itemprop="text">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{{ define "main" }}
|
||||
<div itemprop="blogPost mainEntity" itemscope itemtype="https://schema.org/BlogPosting">
|
||||
<article class="h-entry hentry">
|
||||
<header id="post-header">
|
||||
<header>
|
||||
<h1 itemprop="name headline" class="p-name entry-title">{{ .Title }}</h1>
|
||||
<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>
|
||||
|
@ -10,7 +10,7 @@
|
|||
{{ if lt .Date .Lastmod -}}
|
||||
<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>.
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
<br>
|
||||
<small>
|
||||
<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" -}}
|
||||
{{ if .Params.footnote_heading -}}
|
||||
{{ $footnote_heading = .Params.footnote_heading -}}
|
||||
{{end}}
|
||||
{{- $footnote_heading := printf "Footnotes" -}}
|
||||
{{- if .Params.footnote_heading -}}
|
||||
{{- $footnote_heading = .Params.footnote_heading -}}
|
||||
{{- 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>)` -}}
|
||||
{{ $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) -}}
|
||||
|
||||
<!--Remove deprecated DPUB-ARIA role and unused classes-->
|
||||
{{ $endnote := `(role="doc-endnote"|class="footnote-(back)?ref")` }}
|
||||
{{ $noEndnote := printf "" }}
|
||||
{{- $endnote := `(role="doc-endnote"|class="footnote-(back)?ref")` -}}
|
||||
{{- $noEndnote := printf "" -}}
|
||||
|
||||
<!--Move the Table of Contents heading *inside* the <nav> element-->
|
||||
{{ $tocHeadingOutside := `<h2>Table of Contents</h2><nav(?:.*)>` }}
|
||||
{{ $tocHeadingInside := `<nav id=TableOfContents role="doc-toc"><h2 id="toc-hd">Table of Contents</h2>` }}
|
||||
{{- $tocHeadingOutside := `<h2>Table of Contents</h2><nav(?:.*)>` -}}
|
||||
{{- $tocHeadingInside := `<nav id=TableOfContents role="doc-toc"><h2 id="toc-hd">Table of Contents</h2>` -}}
|
||||
|
||||
<!--Give footnote backlinks accessible names-->
|
||||
{{ $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}>` }}
|
||||
{{- $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}>` -}}
|
||||
|
||||
{{ .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 }}
|
||||
<div itemprop="blogPost mainEntity" itemscope itemtype="https://schema.org/BlogPosting">
|
||||
<article class="h-entry hentry">
|
||||
<header id="post-header">
|
||||
<header>
|
||||
<h1 itemprop="name headline" class="p-name entry-title">{{ .Title }}</h1>
|
||||
<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>
|
||||
|
@ -11,7 +11,7 @@
|
|||
{{ if lt .Date .Lastmod -}}
|
||||
<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>.
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
<br>
|
||||
<small>
|
||||
<span itemprop="wordCount">{{ .WordCount }}</span> words, a <span itemprop="timeRequired" content="PT{{ .ReadingTime }}M">{{ .ReadingTime }} minute</span> read
|
||||
|
|
Loading…
Reference in a new issue