diff options
author | rmaguiar <rmaguiar@tuta.io> | 2020-07-18 22:50:17 +0300 |
---|---|---|
committer | rmaguiar <rmaguiar@tuta.io> | 2020-07-18 22:50:17 +0300 |
commit | 2bb302af15de5877cec0b113ddd46050bb4721cd (patch) | |
tree | f4e88caf6701f3a6ebd9e26b441aab61f3642b5d /layouts/_default/single.html | |
parent | e48e3b4f03e5af5675099c7136633e49012169a8 (diff) |
Use SVG files as inline elements and minor changes
* Change: Use SVG files as inline elements
* Improve assets organization
* Improve accessibility on search layout
* Reduce Scratch usage by using a data file
and dict function
* Other minor changes
Diffstat (limited to 'layouts/_default/single.html')
-rw-r--r-- | layouts/_default/single.html | 64 |
1 files changed, 14 insertions, 50 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 39d48d0..9f7593b 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -47,58 +47,22 @@ </details> {{ end }} - <!-- - For some reason, Chrome will ignore some elements when using TAB - (while Firefox will not). Since Chrome is used by the majority, - I feel like I need to "fix" this. - - For now, I'll be using "tabindex=0" (but then it makes Firefox - complain about accessibility). OH, THIS GONNA BE GREAT. - - Also, sorry for my REGEX skills. - --> - - <!-- i18n --> - {{ $references := (printf "${1}<h2>%s</h2>" (T "references")) }} - {{ $seeFootnotes := (printf "${1} title=\"%s\"" (T "see_footnotes")) }} - {{ $returnToText := (printf "${1} title=\"%s\"" (T "return_to_text")) }} - - <!-- More i18n and also a11y, kind of --> - {{ $highlightCodeBlockLabel := (printf "${1} aria-label=\"%s\" tabindex=0${2}" (T "box_containing_code")) }} - {{ $indentedCodeBlockLabel := (printf "${1} aria-label=\"%s\" tabindex=0>${2}" (T "box_containing_code")) }} - - <!-- Wrap tables to make use of overflow-x property (plus the tabindex thing) --> - {{ $improvedTable := printf "<section class=scroll tabindex=0> ${1} </section>" }} - - <!-- Replace the footnote return links with a text label --> - {{ $footnoteReturnLink := (printf "${1}%s${2}" (T "return")) }} - - <!-- Replace the inline "padding:0" if not using the custom Chroma --> - {{ $highlightPadding := (printf "${1}padding: var(--il-pad)") }} - - <!-- OR replace the footnote return links with a SVG icon --> - {{ if .Site.Params.Style.hasIconAsFootnoteReturnLink }} - {{ $footnoteReturnLink = (printf "${1}<svg transform=\"rotate(180) translate(0 -1)\" aria-hidden=\"true\" ><use xlink:href=\"%s#caret-down\"/></svg>${2}" $icons) }} - {{ end }} - - <!-- - This is doing 4 things right now (or is it): - - * Adding "tabindex=0" to native table and code fences; - * Making tables scrollable; - * Localizing some text; - * Adding a "h2" to footnotes; - * Changing the default inline style for default Chroma. - --> - - <!-- - For some reason, I don't seem to be able to capture the "↩" (not even using \x{21A9}). - To bypass this, I basically captured everything but the "↩"... - --> - - {{ .Content | replaceRE "(<table>(?:.|\n)+?</table>)" $improvedTable | replaceRE "(<div class=\"highlight\"><(?:pre|div) class=\"chroma\")(>)" $highlightCodeBlockLabel | replaceRE "(<pre)>(<code>)" $indentedCodeBlockLabel | replaceRE "(class=\"footnote-ref\")" $seeFootnotes | replaceRE "(class=\"footnote-backref\")" $returnToText | replaceRE "(<section class=\"footnotes\" role=\"doc-endnotes\">)" $references | replaceRE "(<a (?:.*) class=\"footnote-backref\" (?:.*)>)(?:.*)(</a>)" $footnoteReturnLink | replaceRE "(?:(<div class=\"highlight\">(?:.|\n)+?<table (?:.*?))(?:padding:0))" $highlightPadding | safeHTML }} + {{ partial "processed-content" . }} </article> </main> {{ end }} + +{{ define "svg-extra" }} + <symbol viewBox="0 0 448 512" id="hashtag"> + <path d="M440.667 182.109l7.143-40c1.313-7.355-4.342-14.109-11.813-14.109h-74.81l14.623-81.891C377.123 38.754 371.468 32 363.997 32h-40.632a12 12 0 0 0-11.813 9.891L296.175 128H197.54l14.623-81.891C213.477 38.754 207.822 32 200.35 32h-40.632a12 12 0 0 0-11.813 9.891L132.528 128H53.432a12 12 0 0 0-11.813 9.891l-7.143 40C33.163 185.246 38.818 192 46.289 192h74.81L98.242 320H19.146a12 12 0 0 0-11.813 9.891l-7.143 40C-1.123 377.246 4.532 384 12.003 384h74.81L72.19 465.891C70.877 473.246 76.532 480 84.003 480h40.632a12 12 0 0 0 11.813-9.891L151.826 384h98.634l-14.623 81.891C234.523 473.246 240.178 480 247.65 480h40.632a12 12 0 0 0 11.813-9.891L315.472 384h79.096a12 12 0 0 0 11.813-9.891l7.143-40c1.313-7.355-4.342-14.109-11.813-14.109h-74.81l22.857-128h79.096a12 12 0 0 0 11.813-9.891zM261.889 320h-98.634l22.857-128h98.634l-22.857 128z"/> + </symbol> + + {{ if .Site.Params.Style.hasIconAsFootnoteReturnLink }} + <symbol viewBox="0 0 320 512" id="caret-down"> + <path d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"/> + </symbol> + {{ end }} + +{{ end }}
\ No newline at end of file |