18 Commits

Author SHA1 Message Date
72b5479472 bruh
it's not variable font
2023-01-22 20:25:20 -06:00
4d1a0d6be2 Jost 2023-01-22 20:01:33 -06:00
ac580e1995 WIP 2023-01-22 18:57:52 -06:00
cee1cd3a82 WIP 2023-01-22 18:57:52 -06:00
3fae019148 Finish support for list page subtitle
Fixes #27 (as long as I didn't miss anything)
2023-01-22 16:43:09 -06:00
8ef1e3840a Change color when hovering over share buttons 2023-01-22 16:31:08 -06:00
629b3758b9 Change print button to an <a> to match the rest of the buttons
Also makes it have pointer cursor
2023-01-22 16:28:24 -06:00
9412906b4f Make the left bar of blockquote lined up with rest of text 2023-01-22 16:26:43 -06:00
f8cfad647f Fix contrast of code block Copy button 2023-01-22 16:23:03 -06:00
b200623dca Fix keyboard accessibility of code block copy button 2023-01-22 16:22:51 -06:00
80f5994d96 Improve code block copy text
- Use JS to get it directly from the code block instead of needing a
  separate `pre.code-raw` to get it from. That makes it possible to:
- bashsession: Don't copy prompt or command output
2023-01-22 00:09:34 -06:00
342710a755 Reduce gap between elements in subsections list 2023-01-21 23:34:34 -06:00
8eb642dbc8 Remove <hr> separator before footer 2023-01-21 23:32:32 -06:00
a4be8b395b Remove video and add remote-figure shortcodes 2023-01-21 21:32:02 -06:00
47d6d02186 Add copy to clipboard to code blocks 2023-01-20 17:14:18 -06:00
a26ea62b60 Refresh the code block design 2023-01-20 16:25:28 -06:00
7cff045cb3 Website header title should not be h1 2023-01-07 20:50:01 -06:00
9f080377e7 Allow adding descriptions to taxonomies 2023-01-07 20:40:46 -06:00
32 changed files with 301 additions and 63 deletions

View File

@ -1,4 +1,6 @@
/* bobatheme is available under the MIT license at /* vim: foldmethod=marker
*
* bobatheme is available under the MIT license at
* https://github.com/BBaoVanC/bobatheme. * https://github.com/BBaoVanC/bobatheme.
*/ */
@ -46,6 +48,7 @@
--text-gray-1: #919191; /* lch(60, 0, X) */ --text-gray-1: #919191; /* lch(60, 0, X) */
--link-0: #3a94fb; /* lch(60, 60, 270) */ --link-0: #3a94fb; /* lch(60, 60, 270) */
--link-1: #4ea1ff; /* lch(65, 60, 270) -- out of sRGB */
--figure-border: #1f5593; /* lch(35, 40, 270) */ --figure-border: #1f5593; /* lch(35, 40, 270) */
@ -116,6 +119,166 @@
/* Fonts */
/* Open Sans {{{ */
/* cyrillic-ext */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
font-stretch: 100%;
font-display: swap;
src: url(/font/opensans/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4taVIGxA.woff2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
font-stretch: 100%;
font-display: swap;
src: url(/font/opensans/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4kaVIGxA.woff2) format('woff2');
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
font-stretch: 100%;
font-display: swap;
src: url(/font/opensans/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4saVIGxA.woff2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
font-stretch: 100%;
font-display: swap;
src: url(/font/opensans/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4jaVIGxA.woff2) format('woff2');
unicode-range: U+0370-03FF;
}
/* hebrew */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
font-stretch: 100%;
font-display: swap;
src: url(/font/opensans/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4iaVIGxA.woff2) format('woff2');
unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
/* vietnamese */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
font-stretch: 100%;
font-display: swap;
src: url(/font/opensans/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4vaVIGxA.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
font-stretch: 100%;
font-display: swap;
src: url(/font/opensans/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4uaVIGxA.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
font-stretch: 100%;
font-display: swap;
src: url(/font/opensans/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4gaVI.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* }}} */
/* JetBrains Mono {{{ */
/* cyrillic-ext */
@font-face {
font-family: 'JetBrains Mono';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(/font/jetbrainsmono/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTN1OVgaY.woff2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'JetBrains Mono';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(/font/jetbrainsmono/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTPlOVgaY.woff2) format('woff2');
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek */
@font-face {
font-family: 'JetBrains Mono';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(/font/jetbrainsmono/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOVOVgaY.woff2) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'JetBrains Mono';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(/font/jetbrainsmono/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNVOVgaY.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'JetBrains Mono';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(/font/jetbrainsmono/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTNFOVgaY.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'JetBrains Mono';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(/font/jetbrainsmono/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOlOV.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* }}} */
:root {
--font-sans: "Open Sans", "Noto Sans", sans-serif;
--font-mono: "JetBrains Mono", monospace;
}
html {
font-family: var(--font-sans);
}
pre, code, kbd, samp {
font-family: var(--font-mono);
font-size: 0.75em;
}
pre > code {
/* otherwise it ends up being 0.75^2 em */
font-size: unset;
}
/* Post layout (in list pages) */ /* Post layout (in list pages) */
.list-page-content { .list-page-content {
display: flex; display: flex;
@ -272,7 +435,7 @@
.sections { .sections {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 40px; gap: 10px;
} }
.section { .section {
@ -314,14 +477,11 @@
margin: 16px 0; margin: 16px 0;
} }
.header h1 {
font-size: 1.5em;
font-weight: bold;
}
.header a, .header a,
.section-header a { .section-header a {
color: inherit; color: inherit;
font-size: 1.5em;
font-weight: bold;
} }
.section-header-link svg { .section-header-link svg {
@ -426,16 +586,15 @@
justify-content: center; justify-content: center;
} }
.share-buttons button,
.share-buttons a { .share-buttons a {
background-color: var(--background-2); background-color: var(--background-2);
color: var(--text-2); color: var(--text-2);
padding: 4px; padding: 4px;
border-radius: 8px; border-radius: 8px;
} }
.share-buttons a:hover {
.share-buttons button { background-color: var(--background-3);
border: none; color: var(--text-3);
} }
.share-buttons svg { .share-buttons svg {
@ -573,7 +732,6 @@ html {
body { body {
background-color: var(--background-0); background-color: var(--background-0);
color: var(--text-0); color: var(--text-0);
font-family: "Open Sans", "Noto Sans", sans-serif;
margin: 20px; margin: 20px;
max-width: 720px; max-width: 720px;
overflow-wrap: break-word; overflow-wrap: break-word;
@ -586,6 +744,7 @@ body {
} }
footer { footer {
margin-top: 20px;
text-align: center; text-align: center;
} }
@ -633,6 +792,7 @@ a:hover {
blockquote { blockquote {
border-left: 5px solid var(--background-2); border-left: 5px solid var(--background-2);
padding-left: 15px; padding-left: 15px;
margin-left: 0;
} }
hr { hr {
@ -685,13 +845,44 @@ table.markdown {
/* Code blocks */ /* Code blocks */
.highlight > .chroma { .code-block {
display: flex;
flex-direction: column;
margin: 16px 0; margin: 16px 0;
overflow: auto; background-color: var(--background-1);
border-radius: 8px;
}
.code-block > .code-header {
display: flex;
flex-direction: row;
justify-content: space-between;
background-color: var(--background-2);
padding: 4px 8px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
}
.code-block > .code-header > .code-type {
border-top-left-radius: 8px;
margin: auto 0;
}
/* TODO: make the code copy button prettier */
.code-block > .code-header > .code-copy-button {
color: var(--link-1);
}
.code-block > .code-header > .code-copy-button:hover {
cursor: pointer;
}
.code-block > .highlight {
margin: 8px 4px;
} }
.highlight > .chroma {
overflow: auto;
}
.chroma { .chroma {
background-color: var(--background-1) !important; /* the syntax highlight CSS adds a border */
background-color: transparent !important;
margin: 0;
} }
.chroma .gp { .chroma .gp {
@ -712,6 +903,7 @@ table.markdown {
overflow-wrap: break-word; overflow-wrap: break-word;
} }
.code-block > .code-header > .code-type,
code { code {
border-radius: 5px; border-radius: 5px;
} }

View File

@ -1,8 +0,0 @@
const backToTop = document.getElementById("back-to-top");
window.onscroll = function() {
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
backToTop.style.display = "block";
} else {
backToTop.style.display = "none";
}
}

35
assets/js/bobatheme.js Normal file
View File

@ -0,0 +1,35 @@
// back to top
const backToTop = document.getElementById("back-to-top");
window.onscroll = function() {
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
backToTop.style.display = "block";
} else {
backToTop.style.display = "none";
}
}
// code block copy to clipboard
window.onload = () => {
document.querySelectorAll(".code-block").forEach(codeBlock => {
const button = codeBlock.querySelector(".code-header > .code-copy-button");
// lang will not be unset because we default it to text
// clone it so it doesn't change the actual DOM element
const codeElem = codeBlock.querySelector("code[data-lang]").cloneNode(true);
// bashsession: remove command output lines
codeElem.querySelectorAll(".go").forEach(e => e.parentNode.removeChild(e));
// bashsession: remove prompt symbol
codeElem.querySelectorAll(".gp").forEach(e => e.parentNode.removeChild(e));
const rawCode = codeElem.innerText;
const originalCopyText = button.innerHTML;
button.onclick = event => {
navigator.clipboard.writeText(rawCode);
// TODO: maybe we could add a fancier indicator, like a flash or something
event.target.innerHTML = "Copied!";
setTimeout(() => {
event.target.innerHTML = originalCopyText;
}, 3000);
}
});
}

View File

@ -14,6 +14,9 @@ latest_posts:
see_also: see_also:
other: "SEE ALSO:" other: "SEE ALSO:"
copy_to_clipboard:
other: "Copy"
# Meta items # Meta items
long_date: long_date:

View File

@ -14,6 +14,9 @@ latest_posts:
see_also: see_also:
other: "Véase también:" other: "Véase también:"
copy_to_clipboard:
other: "Copiar"
# Meta items # Meta items
long_date: long_date:

View File

@ -0,0 +1,15 @@
{{ $type := "text" }}
{{ with .Type }}
{{ $type = . }}
{{ end }}
<div class="code-block">
<div class="code-header">
<pre class="code-type">{{ $type }}</pre>
<a href="javascript:void(0)" class="code-copy-button">
{{ i18n "copy_to_clipboard" }}
</a>
</div>
{{/* a div.highlight is already created by highlight function */}}
{{ highlight .Inner $type }}
</div>

View File

@ -21,7 +21,6 @@
</main> </main>
{{ if or .Site.Copyright .Site.Params.footer }} {{ if or .Site.Copyright .Site.Params.footer }}
<hr>
<footer> <footer>
<small> <small>
{{ with .Site.Copyright }} {{ with .Site.Copyright }}

View File

@ -5,6 +5,10 @@
{{ partial "rss-link.html" . }} {{ partial "rss-link.html" . }}
</h1> </h1>
{{ with .Content }}
{{ . }}
{{ end }}
<div class="list-page-content"> <div class="list-page-content">
{{ with .Sections }} {{ with .Sections }}
<div class="sections"> <div class="sections">

View File

@ -4,6 +4,10 @@
{{ .Title | markdownify }} {{ .Title | markdownify }}
</h1> </h1>
{{ with .Content }}
{{ . }}
{{ end }}
<div class="page-list"> <div class="page-list">
{{ with .Paginator.Pages }} {{ with .Paginator.Pages }}
{{ range . }} {{ range . }}

View File

@ -13,7 +13,7 @@
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"> <link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{ end }} {{ end }}
{{ with resources.Get "js/back-to-top.js" | fingerprint "sha512" }} {{ with resources.Get "js/bobatheme.js" | fingerprint "sha512" }}
<script defer src="{{ .Permalink }}" type="text/javascript" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script> <script defer src="{{ .Permalink }}" type="text/javascript" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
{{ end }} {{ end }}
{{ with resources.Get "js/share-event.js" | fingerprint "sha512" }} {{ with resources.Get "js/share-event.js" | fingerprint "sha512" }}

View File

@ -54,9 +54,10 @@
*/}} */}}
{{ if .Site.Params.shareButtons.print }} {{ if .Site.Params.shareButtons.print }}
<button class="print-share" <a class="print-share"
href="javascript:void(0)"
onclick="window.print(); share_event('Print');"> onclick="window.print(); share_event('Print');">
{{- partial "icon.html" "printer" -}} {{- partial "icon.html" "printer" -}}
</button> </a>
{{ end }} {{ end }}
</div> </div>

View File

@ -1,9 +1,7 @@
<header class="header"> <header class="header">
<h1> <a href="{{ .Site.Home.Permalink | absLangURL }}">
<a href="{{ .Site.Home.Permalink | absLangURL }}"> {{ .Site.Title | markdownify }}
{{ .Site.Title | markdownify }} </a>
</a>
</h1>
</header> </header>
<div class="topbar"> <div class="topbar">

View File

@ -4,6 +4,10 @@
{{ .Title | markdownify }} {{ .Title | markdownify }}
</h1> </h1>
{{ with .Content }}
{{ . }}
{{ end }}
<div class="series-taxonomy-list"> <div class="series-taxonomy-list">
{{ with .Pages }} {{ with .Pages }}
{{ range . }} {{ range . }}

View File

@ -1,9 +1,4 @@
{{ $resource := "" }} {{ $resource := .Page.Resources.GetMatch (.Get "src") }}
{{ if .IsNamedParams }}
{{ $resource = $.Page.Resources.GetMatch (.Get "src") }}
{{ else }}
{{ $resource = $.Page.Resources.GetMatch (.Get 0) }}
{{ end }}
{{ $noborder := false }} {{ $noborder := false }}
{{ if .Get "noborder" }} {{ if .Get "noborder" }}

View File

@ -9,5 +9,5 @@
{{ end }} {{ end }}
<p> <p>
{{ partial "remote_figure.html" (dict "src" (.Get "src") "border" $border "hidecaption" $hidecaption "type" "image" "alt" (.Get "alt")) }} {{ partial "remote_figure.html" (dict "src" (.Get "src") "border" $border "hidecaption" $hidecaption "type" (.Get "type") "alt" (.Get "alt")) }}
</p> </p>

View File

@ -1,13 +0,0 @@
{{ $border := false }}
{{ if .Get "border" }}
{{ $border = true }}
{{ end }}
{{ $hidecaption := false }}
{{ if .Get "hidecaption" }}
{{ $hidecaption = true }}
{{ end }}
<p>
{{ partial "remote_figure.html" (dict "src" (.Get "src") "border" $border "hidecaption" $hidecaption "type" "video" "alt" (.Get "alt")) }}
</p>

View File

@ -1,15 +1,21 @@
{{ define "main" }} {{ define "main" }}
<h1> <div class="post-title">
{{ if eq .Data.Singular "tag" }} <h1>
{{ partial "icon.html" "tag" }} {{ if eq .Data.Singular "tag" }}
{{ else if eq .Data.Singular "category" }} {{ partial "icon.html" "tag" }}
{{ partial "icon.html" "folder" }} {{ else if eq .Data.Singular "category" }}
{{ else }} {{ partial "icon.html" "folder" }}
{{ partial "icon.html" "filter" }} {{ else }}
{{ end }} {{ partial "icon.html" "filter" }}
{{ end }}
{{ .Title | markdownify }} {{ .Title | markdownify }}
</h1> </h1>
</div>
{{ with .Content }}
{{ . }}
{{ end }}
<div class="taxonomy-list"> <div class="taxonomy-list">
{{ with .Data.Terms.Alphabetical }} {{ with .Data.Terms.Alphabetical }}

View File

@ -8,7 +8,7 @@ description = "Simple Hugo theme for boba.best and bbaovanc.com"
homepage = "https://bbaovanc.com" homepage = "https://bbaovanc.com"
tags = [] tags = []
features = [] features = []
min_version = "0.80.0" min_version = "0.93.0"
[author] [author]
name = "bbaovanc" name = "bbaovanc"