|
2 | 2 | {{ $class := .class | default "" }}
|
3 | 3 | {{ $title := .title | default "" }}
|
4 | 4 | {{ $icon := .icon | default "" }}
|
5 |
| -{{ $inlineParam := .inline | default "false" | lower }} |
| 5 | +{{ $sidelineParam := .sideline | default "false" | lower }} |
6 | 6 |
|
7 |
| -{{ if not (in (slice "true" "false") $inlineParam) }} |
8 |
| - {{ errorf "Invalid parameter 'inline'='%s' passed to blockquote partial from '%s'. Allowed values: true, false" $inlineParam .Page.Path }} |
| 7 | +{{ if not (in (slice "true" "false") $sidelineParam) }} |
| 8 | + {{ errorf "Invalid parameter 'sideline'='%s' passed to blockquote partial from '%s'. Allowed values: true, false" $sidelineParam .Page.Path }} |
9 | 9 | {{ end }}
|
10 | 10 |
|
11 | 11 | {{/* Figure out inline/side and set class accordingly */}}
|
12 |
| -{{ $inline := eq $inlineParam "true" }} |
| 12 | +{{ $sideline := eq $sidelineParam "true" }} |
13 | 13 | {{ $sideOption := "side-callout" }}
|
14 | 14 | {{ $inlineOption := "inline-callout" }}
|
15 | 15 |
|
16 |
| -{{ if $inline }} |
| 16 | +{{ if $sideline }} |
17 | 17 | {{ $class = printf "%s %s" $class $sideOption }}
|
18 | 18 | {{ else }}
|
19 | 19 | {{ $class = printf "%s %s" $class $inlineOption }}
|
20 | 20 | {{ end }}
|
21 | 21 |
|
22 | 22 | {{/* Render a different block, if "loud" callouts are used */}}
|
| 23 | +{{ $type := (index (split $class " ") 0) | strings.FirstUpper }} |
23 | 24 | {{ $specialTitles := slice "Caution" "Warning" "Deprecated" "Important" }}
|
24 | 25 | {{ $specialTitleIcons := dict
|
25 | 26 | "Caution" "alert-triangle"
|
26 | 27 | "Warning" "alert-octagon"
|
27 | 28 | "Deprecated" "alert-octagon"
|
28 | 29 | "Important" "arrow-right-circle"
|
29 | 30 | }}
|
30 |
| -{{ $icon := index $specialTitleIcons $title | default "" }} |
| 31 | +{{ $icon := index $specialTitleIcons $type | default "" }} |
31 | 32 |
|
32 |
| -{{ $isSpecialTitle := in $specialTitles $title }} |
| 33 | +{{ $isSpecialTitle := in $specialTitles $type }} |
33 | 34 | {{ if $isSpecialTitle }}
|
34 |
| - {{/* Loud callouts */}} |
| 35 | +{{/* Loud callouts */}} |
| 36 | +<blockquote class="{{ $class }}"> |
35 | 37 | <div>
|
36 |
| - <blockquote class="{{ $class }}"> |
37 |
| - <div> |
38 |
| - <div class="call-out-type"> |
39 |
| - {{ partial "feather" (dict "context" . "icon" $icon) .}} |
40 |
| - {{ $title }} |
41 |
| - </div> |
42 |
| - <div class="callout-content"> |
43 |
| - {{ .content | markdownify }} |
44 |
| - </div> |
| 38 | + <div class="call-out-type"> |
| 39 | + {{ partial "feather" (dict "context" . "icon" $icon) .}} |
| 40 | + {{ $title }} |
45 | 41 | </div>
|
46 |
| - </blockquote> |
47 |
| -</div> |
| 42 | + <div class="callout-content"> |
| 43 | + {{ .content | markdownify }} |
| 44 | + </div> |
| 45 | + </div> |
| 46 | +</blockquote> |
48 | 47 |
|
49 | 48 | {{ else }}
|
50 | 49 |
|
|
0 commit comments