mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-01-18 02:40:24 +00:00
details: add shortcode #957
This commit is contained in:
parent
16d4de84be
commit
66f4fbf5f0
5 changed files with 40 additions and 2 deletions
13
exampleSite/content/introduction/releasenotes/7/3.en.md
Normal file
13
exampleSite/content/introduction/releasenotes/7/3.en.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
+++
|
||||
disableToc = false
|
||||
hidden = true
|
||||
title = "Version 7.3"
|
||||
type = "releasenotes"
|
||||
weight = -3
|
||||
+++
|
||||
|
||||
## 7.3.0 (XXXX-XX-XX) {#7-3-0}
|
||||
|
||||
### New
|
||||
|
||||
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} Support for Hugo’s built-in [`details` shortcode](https://gohugo.io/content-management/shortcodes/#details) by mapping it to the theme's [`expand` shortcode](shortcodes/expand).
|
|
@ -62,6 +62,8 @@ That's some more text with a footnote.[^someid]
|
|||
|
||||
The [`notice` shortcode](shortcodes/notice) is also capable of displaying expandable/collapsible sections of text but with additional parameter for color and additional icons.
|
||||
|
||||
The theme supports Hugo’s built-in [`details` shortcode](https://gohugo.io/content-management/shortcodes/#details) by mapping the parameter to the theme's `expand` shortcode.
|
||||
|
||||
### Parameter
|
||||
|
||||
| Name | Position | Default | Notes |
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
{{- partial "shortcodes/notice.html" (dict
|
||||
"page" .Page
|
||||
"content" $text
|
||||
"expanded" (cond (eq $alertsign "+") true (cond (eq $alertsign "-") false ""))
|
||||
"style" $alerttype
|
||||
"title" $alerttitle
|
||||
"expanded" (cond (eq $alertsign "+") true (cond (eq $alertsign "-") false ""))
|
||||
) }}
|
||||
{{ else -}}
|
||||
<blockquote>
|
||||
|
|
|
@ -1 +1 @@
|
|||
7.2.1
|
||||
7.2.1+16d4de84becfa2d2e6bdb2394a2f4fa411bc0007
|
23
layouts/shortcodes/details.html
Normal file
23
layouts/shortcodes/details.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
{{- $summary := (.Get "summary") | default (T "Details") }}
|
||||
{{- $open := false }}
|
||||
{{- if in (slice "false" false 0) (.Get "open") }}
|
||||
{{- $open = false }}
|
||||
{{- else if in (slice "true" true 1) (.Get "open")}}
|
||||
{{- $open = true }}
|
||||
{{- end }}
|
||||
{{- $params := dict }}
|
||||
{{- with (.Get "class") }}
|
||||
{{- $params = $params | merge (dict "class" .) }}
|
||||
{{- end }}
|
||||
{{- with (.Get "title") }}
|
||||
{{- $params = $params | merge (dict "title" .) }}
|
||||
{{- end }}
|
||||
{{- partial "shortcodes/notice.html" (dict
|
||||
"page" .Page
|
||||
"content" .Inner
|
||||
"expanded" $open
|
||||
"groupid" (.Get "name")
|
||||
"params" $params
|
||||
"style" "transparent"
|
||||
"title" $summary
|
||||
) }}
|
Loading…
Reference in a new issue