File tree Expand file tree Collapse file tree 6 files changed +88
-26
lines changed Expand file tree Collapse file tree 6 files changed +88
-26
lines changed Original file line number Diff line number Diff line change 1+ {{- /* Extract parameters with defaults and validation */ -}}
2+ {{ $class := .class | default "" }}
3+ {{ $title := .title | default "" }}
4+ {{ $icon := .icon | default "" }}
5+ {{ $inlineParam := .inline | default "false" | lower }}
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 }}
9+ {{ end }}
10+
11+ {{ $inline := eq $inlineParam "true" }}
12+ {{ $sideOption := "side-callout" }}
13+ {{ $inlineOption := "inline-callout" }}
14+
15+ {{ if $inline }}
16+ {{ $class = printf "%s %s" $class $sideOption }}
17+ {{ else }}
18+ {{ $class = printf "%s %s" $class $inlineOption }}
19+ {{ end }}
20+
21+ < blockquote class ="{{ $class }} " data-mf ="false ">
22+ < div >
23+ {{ with $icon }}
24+ < i class ="{{ . }} "> </ i >
25+ {{ end }}
26+ < strong > {{ $title }}</ strong >
27+ {{ .content | markdownify }}
28+ </ div >
29+ </ blockquote >
30+
31+ < blockquote class ="{{ $class }} " data-mf ="true " style ="display: none; ">
32+ < div >
33+ {{ with $icon }}
34+ < i class ="{{ . }} "> </ i >
35+ {{ end }}
36+ {{ with $title }}
37+ < h2 class ="callout-title "> {{ $title }}</ h2 >
38+ {{ end }}
39+ {{ .content | markdownify }}
40+ </ div >
41+ </ blockquote >
Original file line number Diff line number Diff line change 1- < blockquote class ="tip ">
2- < div > < strong > Before you begin:</ strong > < br /> {{ .Inner | markdownify }}</ div >
3- </ blockquote >
1+ {{ partial "callout.html" (dict
2+ "class" "tip"
3+ "title" "Before you begin:"
4+ "icon" ""
5+ "inline" "false"
6+ "content" .Inner
7+ ) }}
8+ {{ warnf "'before-you-begin' is being deprecated. Use generic 'call-out' shortcode instead."}}
Original file line number Diff line number Diff line change 1+ {{/*
2+
3+ Usage:
4+ {{< call-out title ="Custom title " icon ="fa fa-check-circle " inline ="true "> }}
5+ This callout uses the icon check-circle. **This should be an inline callout.**
6+ {{</ call-out > }}
7+
8+ Depends on `callout.html` partial.
9+
10+ */}}
11+
112{{ $class := .Get 0 | default (.Get "class") | default "" }}
213{{ $title := .Get 1 | default (.Get "title") | default "" }}
314{{ $icon := .Get 2 | default (.Get "icon") | default "" }}
2031 {{ $class = printf "%s %s" $class $sideOption }}
2132{{ end }}
2233
23- <!-- Blockquote element with a class that is the first parameter passed to the shortcode -->
24- < blockquote class ="{{ $class }} ">
25- < div >
26- <!-- Check if the third parameter (icon class) is provided -->
27- {{ with $icon }}
28- <!-- If the icon class is provided, render an <i> element with the given class -->
29- < i class ="{{ . }} "> </ i >
30- {{ end }}
31- <!-- Render the second parameter (title) as a strong element -->
32- < strong > {{ $title }}</ strong > < br />
33- <!-- Render the inner content of the shortcode, converting it from Markdown to HTML -->
34- {{ .Inner | markdownify }}
35- </ div >
36- </ blockquote >
34+ {{ partial "callout.html" (dict
35+ "class" $class
36+ "title" $title
37+ "icon" $icon
38+ "inline" $inline
39+ "content" .Inner
40+ ) }}
Original file line number Diff line number Diff line change 1- < blockquote class ="caution call-out ">
2- < div > < strong class ="call-out-type "> Caution</ strong > < br /> {{ .Inner | markdownify }}</ div >
3- </ blockquote >
1+ {{ partial "callout.html" (dict
2+ "class" "caution call-out"
3+ "title" "Caution"
4+ "icon" ""
5+ "inline" "false"
6+ "content" .Inner
7+ ) }}
Original file line number Diff line number Diff line change 1- < blockquote class ="warning call-out ">
2- < div > < strong class ="call-out-type "> Deprecated</ strong > < br /> {{ .Inner | markdownify }}</ div >
3- </ blockquote >
1+ {{ partial "callout.html" (dict
2+ "class" "warning call-out"
3+ "title" "Deprecated"
4+ "icon" ""
5+ "inline" "false"
6+ "content" .Inner
7+ ) }}
Original file line number Diff line number Diff line change 1- < blockquote class ="important call-out ">
2- < div > < strong class ="call-out-type "> Important</ strong > < br /> {{ .Inner | markdownify }}</ div >
3- </ blockquote >
1+ {{ partial "callout.html" (dict
2+ "class" "important call-out"
3+ "title" "Important"
4+ "icon" ""
5+ "inline" "false"
6+ "content" .Inner
7+ ) }}
You can’t perform that action at this time.
0 commit comments