diff options
| author | Arne Rief <riearn@proton.me> | 2025-09-22 18:04:09 +0200 |
|---|---|---|
| committer | Arne Rief <riearn@proton.me> | 2025-09-22 18:04:09 +0200 |
| commit | 6b5ac43b0eb9f799220783e98b5961192666b755 (patch) | |
| tree | ea39cc2c610ee033613efe3500866494c4bd0778 | |
| parent | a57a8f991a2a5960fc886aa8bfcfca9719cecfda (diff) | |
| -rw-r--r-- | assets/css/main.css | 17 | ||||
| -rw-r--r-- | layouts/_shortcodes/descrlist.html | 20 | ||||
| -rw-r--r-- | layouts/_shortcodes/newtab.html | 7 |
3 files changed, 43 insertions, 1 deletions
diff --git a/assets/css/main.css b/assets/css/main.css index 10d7493..4aadd74 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -116,7 +116,7 @@ blockquote { } dl { - margin-left: 1rem; + margin: var(--gap-large) 0; dt { color: var(--link-color); @@ -180,6 +180,7 @@ time { color: var(--bg-main); } +/* SPECIAL ELEMENTS */ /* Code block */ .highlight { margin: 1rem auto; @@ -197,6 +198,15 @@ time { } } +/* Description list centered with borders */ +.dl-borders-centered { + border-bottom: 2px dotted var(--link-color); + border-top: 2px dotted var(--link-color); + margin: var(--gap-large) auto; + padding: var(--gap-default) 0; + width: fit-content; +} + /* HEADER */ .site__header { display: flex; @@ -364,6 +374,11 @@ time { position: relative; /* Needed for post__scroll-top */ } +.post__content ol > li, +.post__content ul > li { + margin-bottom: var(--gap-default); +} + .post__header { margin-bottom: var(--gap-large); } diff --git a/layouts/_shortcodes/descrlist.html b/layouts/_shortcodes/descrlist.html new file mode 100644 index 0000000..99517c3 --- /dev/null +++ b/layouts/_shortcodes/descrlist.html @@ -0,0 +1,20 @@ +{{- /* + Description list for a dynamic number of term-details pairs + + @context {string} class: CSS class name + @context {string} entries: semicolon-separated pairs of "title=description" + + @example: {{< descrlist class="dl-borders-centered" entries="Author=William Shakespeare;Title=Macbeth;Year of Publication=1606" >}} +*/ -}} +<dl{{ with .Get "class" }} class="{{ . }}" {{ end }}> +{{- $pairs := split (.Get "entries") ";" -}} + {{- range $pairs -}} + {{- $currentPairSplit := split . "=" -}} + <dt> + {{ index $currentPairSplit 0 }} + </dt> + <dd> + {{ index $currentPairSplit 1 }} + </dd> + {{- end -}} +</dl> diff --git a/layouts/_shortcodes/newtab.html b/layouts/_shortcodes/newtab.html index b06fb2d..3f3fe75 100644 --- a/layouts/_shortcodes/newtab.html +++ b/layouts/_shortcodes/newtab.html @@ -1,3 +1,10 @@ +{{- /* + Link that opens a new tab; protects current window & hides referrer URL + + @context {string} href: target URL + + @example: {{< newtab href="https://some-site.com" >}}Some text to be displayed{{< /newtab >}} +*/ -}} <a href="{{ .Get "href" }}" target="_blank" rel="noopener noreferrer"> {{ .Inner }} </a> |
