|
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 }}
|
|
34 | 34 |
|
35 | 35 |
|
36 | 36 | {{/* Render a different block, if "loud" callouts are used */}}
|
| 37 | +{{ $type := (index (split $class " ") 0) | strings.FirstUpper }} |
37 | 38 | {{ $specialTitles := slice "Caution" "Warning" "Deprecated" "Important" }}
|
38 | 39 | {{ $specialTitleIcons := dict
|
39 | 40 | "Caution" "alert-triangle"
|
40 | 41 | "Warning" "alert-octagon"
|
41 | 42 | "Deprecated" "alert-octagon"
|
42 | 43 | "Important" "arrow-right-circle"
|
43 | 44 | }}
|
44 |
| -{{ $icon := index $specialTitleIcons $title | default "" }} |
| 45 | +{{ $icon := index $specialTitleIcons $type | default "" }} |
45 | 46 |
|
46 |
| -{{ $isSpecialTitle := in $specialTitles $title }} |
| 47 | +{{ $isSpecialTitle := in $specialTitles $type }} |
47 | 48 | {{ if $isSpecialTitle }}
|
48 |
| - {{/* Loud callouts */}} |
| 49 | +{{/* Loud callouts */}} |
| 50 | +<blockquote class="{{ $class }}" data-mf="true" style="display: none;"> |
49 | 51 | <div>
|
50 |
| - <blockquote class="{{ $class }}" data-mf="true" style="display: none;"> |
51 |
| - <div> |
52 |
| - <div class="call-out-type"> |
53 |
| - {{ partial "feather" (dict "context" . "icon" $icon) .}} |
54 |
| - {{ $title }} |
55 |
| - </div> |
56 |
| - <div class="callout-content"> |
57 |
| - {{ .content | markdownify }} |
58 |
| - </div> |
| 52 | + <div class="call-out-type"> |
| 53 | + {{ partial "feather" (dict "context" . "icon" $icon) .}} |
| 54 | + {{ $title }} |
59 | 55 | </div>
|
60 |
| - </blockquote> |
61 |
| -</div> |
| 56 | + <div class="callout-content"> |
| 57 | + {{ .content | markdownify }} |
| 58 | + </div> |
| 59 | + </div> |
| 60 | +</blockquote> |
62 | 61 |
|
63 | 62 | {{ else }}
|
64 | 63 |
|
|
0 commit comments