1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-23 21:02:09 +00:00

Replace unnecessary use of <br> with something simpler

This commit is contained in:
Rohan Kumar 2022-08-08 17:30:43 -07:00
parent afd5689d38
commit 6f9d418285
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
2 changed files with 12 additions and 7 deletions

View file

@ -205,7 +205,7 @@ html {
}
figure,
p {
:not(li) > p {
contain: inline-size layout;
}
@ -333,6 +333,7 @@ html {
contain: content;
display: inline-block;
padding: .75em .5em;
margin-top: -1em;
}
/* skip link: make it invisible until focused, and put it on the top. */

View file

@ -6,7 +6,8 @@
<!--
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>.
endnotes from a <section> to a <div>. This switches them back to a section,
since doc-endnotes inherits a <section> role.
-->
{{- $referencesWithoutHeading := `(<div class="footnotes" role="doc-endnotes">
<hr />)` -}}
@ -43,16 +44,19 @@
{{- $tocHeadingInside := `<nav id="TableOfContents" role="doc-toc" aria-labelledby="toc-hd" tabindex="-1">
<h2 id="toc-hd">Table of Contents</h2>` -}}
<!--Give footnote backlinks accessible names-->
{{- $footnoteBacklinksBad := `<a href="#fnref:([0-9]*)" class="footnote-backref"(.*role="doc-backlink"(?:[^>]*)?)>([^<]*)` -}}
{{- $footnoteBacklinksGood := `<br /><a href="#fnref:${1}" aria-labelledby="bl1-${1} bl2-${1}"${2}><span id="bl1-${1}">Back</span><span id="bl2-${1}" hidden=""> to reference ${1}</span>` -}}
<!--
Give footnote backlinks accessible names.
The backlinks should be located *outside* the footnote paragraphs.
-->
{{- $footnoteBacklinksBad := ` ?<a href="#fnref:([0-9]*)" class="footnote-backref"(.*role="doc-backlink"(?:[^>]*)?)>([^<]*)</a></p>` -}}
{{- $footnoteBacklinksGood := `</p><a href="#fnref:${1}" aria-labelledby="bl1-${1} bl2-${1}"${2}><span id="bl1-${1}">Back</span><span id="bl2-${1}" hidden=""> to reference ${1}</span></a>` -}}
<!--
If two backlinks exist, give them different names.
I currently don't have any triple backlinks; if I ever do, I'll implement this properly with a loop.
-->
{{- $repeatedFootnoteBacklinksBad := `<a href="#fnref([0-9]):([0-9]*)"(.*role="doc-backlink"(?:[^>]*)?)>([^<]*)` -}}
{{- $repeatedFootnoteBacklinksGood := `<br /><a href="#fnref${1}:${2}" aria-labelledby="bl1-${2}-2 bl2-${2}-2"${3}><span id="bl1-${2}-2">Back</span><span id="bl2-${2}-2" hidden=""> to reference ${2}, instance 2</span>` -}}
{{- $repeatedFootnoteBacklinksBad := ` ?<a href="#fnref([0-9]):([0-9]*)"(.*role="doc-backlink"(?:[^>]*)?)>([^<]*)<a></p>` -}}
{{- $repeatedFootnoteBacklinksGood := `</p><a href="#fnref${1}:${2}" aria-labelledby="bl1-${2}-2 bl2-${2}-2"${3}><span id="bl1-${2}-2">Back</span><span id="bl2-${2}-2" hidden=""> to reference ${2}, instance 2</span></a>` -}}
<!--Make endnotes focusable by ATs. Necessary for VoiceOver compatibility.-->
{{- $endNotesNotFocusable := `<li id="fn:([0-9]*)">` -}}