1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2025-02-17 12:20:06 +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, figure,
p { :not(li) > p {
contain: inline-size layout; contain: inline-size layout;
} }
@ -333,6 +333,7 @@ html {
contain: content; contain: content;
display: inline-block; display: inline-block;
padding: .75em .5em; padding: .75em .5em;
margin-top: -1em;
} }
/* skip link: make it invisible until focused, and put it on the top. */ /* 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. Add heading to footnotes, remove unused class.
Requires Goldmark v1.4.12 or higher, since that version switched 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"> {{- $referencesWithoutHeading := `(<div class="footnotes" role="doc-endnotes">
<hr />)` -}} <hr />)` -}}
@ -43,16 +44,19 @@
{{- $tocHeadingInside := `<nav id="TableOfContents" role="doc-toc" aria-labelledby="toc-hd" tabindex="-1"> {{- $tocHeadingInside := `<nav id="TableOfContents" role="doc-toc" aria-labelledby="toc-hd" tabindex="-1">
<h2 id="toc-hd">Table of Contents</h2>` -}} <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"(?:[^>]*)?)>([^<]*)` -}} Give footnote backlinks accessible names.
{{- $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>` -}} 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. 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. 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"(?:[^>]*)?)>([^<]*)` -}} {{- $repeatedFootnoteBacklinksBad := ` ?<a href="#fnref([0-9]):([0-9]*)"(.*role="doc-backlink"(?:[^>]*)?)>([^<]*)<a></p>` -}}
{{- $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>` -}} {{- $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.--> <!--Make endnotes focusable by ATs. Necessary for VoiceOver compatibility.-->
{{- $endNotesNotFocusable := `<li id="fn:([0-9]*)">` -}} {{- $endNotesNotFocusable := `<li id="fn:([0-9]*)">` -}}