From 04f48def04e0d78fde88476158d102320ffbf067 Mon Sep 17 00:00:00 2001 From: colin Date: Sun, 29 May 2022 15:56:17 -0700 Subject: [PATCH] blog: style: replace the funky h2 backgrounds with SVGs --- sass/static/style.scss | 83 +++++++++++++++++++++++++++++++++--------- templates/base.html | 5 --- 2 files changed, 65 insertions(+), 23 deletions(-) diff --git a/sass/static/style.scss b/sass/static/style.scss index fd85159..fd0cf63 100644 --- a/sass/static/style.scss +++ b/sass/static/style.scss @@ -14,6 +14,41 @@ @return $string; } +// @source https://gist.github.com/B-iggy/14da053d2cebf92e1930 +// @author B-iggy +@function url-encode($string) { + $map: ( + "%": "%25", + "<": "%3C", + ">": "%3E", + " ": "%20", + "!": "%21", + "*": "%2A", + "'": "%27", + '"': "%22", + "(": "%28", + ")": "%29", + ";": "%3B", + ":": "%3A", + "@": "%40", + "&": "%26", + "=": "%3D", + "+": "%2B", + "$": "%24", + ",": "%2C", + "/": "%2F", + "?": "%3F", + "#": "%23", + "[": "%5B", + "]": "%5D" + ); + $new: $string; + @each $search, $replace in $map { + $new: str-replace($new, $search, $replace); + } + @return $new; +} + /// declare a cross-browser @font-face. /// note that Firefox is very picky about the syntax here: experimentation shows that /// the eot MUST come first (even if FF doesn't load it), and the other formats MUST @@ -90,6 +125,34 @@ $icon_bootstrap_arrow_return_right: url('data:image/svg+xml; utf8, '); // MIT; source: https://icon-sets.iconify.design/bi/arrow-bar-right/ $icon_bootstrap_arrow_bar_right: url('data:image/svg+xml; utf8, '); +// @author colin +// made in Inkscape +$icon_h2_slash_svg: ' + +'; +$icon_h2_slash: url("data:image/svg+xml; utf8, #{url-encode($icon_h2_slash_svg)}"); + $marker_title: $icon_bootstrap_arrow_return_right; $marker_section: $icon_bootstrap_arrow_right; @@ -135,16 +198,6 @@ h1, h2, h3, header margin-right: 0; } -// some element which should not ever be displayed. -// TODO: probably want to inline this to prevent any early rendering. -.hide -{ - height: 0; - overflow: hidden; - margin: 0; - padding: 0; -} - body { background-color: $color_bg; @@ -168,13 +221,6 @@ body flex-grow: 1000; } -#tile-slash -{ - font-size: 1.6rem; - // opacity: 50%; - color: $color_cream_5; -} - .portal { max-width: 40rem; @@ -325,7 +371,8 @@ body } h2::after { - background: -moz-element(#tile-slash) center; + background-image: $icon_h2_slash; + background-repeat: repeat-x; } // TODO colin: numbers are slightly wrong because of scrollbar width. diff --git a/templates/base.html b/templates/base.html index dcb03a0..b2f8e5b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -32,11 +32,6 @@ {% block content %} {% endblock %} - - -
- / -