Skip to content

Commit 3440ed5

Browse files
committed
WIP: Implement remaining shortcodes. Handle note content
1 parent 4510f60 commit 3440ed5

File tree

8 files changed

+86
-22
lines changed

8 files changed

+86
-22
lines changed

assets/css/v2/style.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,8 +1091,7 @@ blockquote.note {
10911091
}
10921092

10931093
blockquote.note:before {
1094-
content: "Note";
1095-
text-transform: uppercase;
1094+
content: attr(data-title);
10961095
font-size: 1rem;
10971096
font-weight: 600;
10981097
font-variation-settings: "wght" 600;

exampleSite/content/test-product/call-out/all-callouts.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,23 @@ This is a Warning callout with a custom title. There was previously a bug with *
6565
{{</call-out>}}
6666

6767

68+
69+
70+
## Old "plain" callouts
71+
The following will not have special styling, but are pre-existing shortcodes.
72+
6873
{{<note>}}
69-
This is a note. In oldframe it should have `note:` in bold, at the start.
70-
{{</note>}}
74+
This is `<note>`. In oldframe it should have `note:` in bold, at the start.
75+
{{</note>}}
76+
77+
{{<tip>}}
78+
This is `<tip>`. In oldframe it should have `tip:` in bold, at the start.
79+
{{</tip>}}
80+
81+
{{<before-you-begin>}}
82+
This is `<before-you-begin>`.
83+
{{</before-you-begin>}}
84+
85+
{{<see-also>}}
86+
This is `<see-also>`.
87+
{{</see-also>}}

layouts/partials/callout.html

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
{{ errorf "Invalid parameter 'inline'='%s' passed to blockquote partial from '%s'. Allowed values: true, false" $inlineParam .Page.Path }}
99
{{ end }}
1010

11+
{{/* Figure out inline/side and set class accordingly */}}
1112
{{ $inline := eq $inlineParam "true" }}
1213
{{ $sideOption := "side-callout" }}
1314
{{ $inlineOption := "inline-callout" }}
@@ -18,6 +19,11 @@
1819
{{ $class = printf "%s %s" $class $inlineOption }}
1920
{{ end }}
2021

22+
{{/* Render a different block, if "loud" callouts are used */}}
23+
{{ $specialTitles := slice "Caution" "Warning" "Deprecated" "Important" }}
24+
{{ $isSpecialTitle := in $specialTitles $title }}
25+
26+
{{/* Old frame callout */}}
2127
<blockquote class="{{ $class }}" data-mf="false">
2228
<div>
2329
{{ with $icon }}
@@ -28,14 +34,37 @@
2834
</div>
2935
</blockquote>
3036

31-
<blockquote class="{{ $class }}" data-mf="true" style="display: none;">
37+
38+
{{ if $isSpecialTitle }}
39+
{{/* Loud callouts */}}
40+
<blockquote class="{{ $class }}" data-mf="true" style="display: none;">
41+
<div>
42+
{{ with $icon }}
43+
<i class="{{ . }}"></i>
44+
{{ end }}
45+
<div class="special-header">
46+
<h3>{{ $title }}</h3>
47+
</div>
48+
<div class="special-content">
49+
I AM THE SPECIAL CALLOUT - NOT FINISHED YET
50+
{{ .content | markdownify }}
51+
</div>
52+
</div>
53+
</blockquote>
54+
55+
{{ else }}
56+
57+
{{/* "Generic" mf callout */}}
58+
59+
{{ $cleanTitle := strings.TrimSuffix ":" $title}}
60+
61+
<blockquote class="{{ $class }} note" data-mf="true" style="display: none;" data-title="{{ $cleanTitle }}">
3262
<div>
3363
{{ with $icon }}
3464
<i class="{{ . }}"></i>
3565
{{ end }}
36-
{{ with $title }}
37-
<h2 class="callout-title">{{ $title }}</h2>
38-
{{ end }}
3966
{{ .content | markdownify }}
4067
</div>
41-
</blockquote>
68+
</blockquote>
69+
70+
{{ end }}

layouts/shortcodes/before-you-begin.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"inline" "false"
66
"content" .Inner
77
) }}
8-
{{ warnf "'before-you-begin' is being deprecated. Use generic 'call-out' shortcode instead."}}
8+
{{ warnf "'<before-you-begin></before-you-begin>' is being deprecated. Use generic 'call-out' shortcode instead."}}

layouts/shortcodes/note.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
<blockquote class="note">
2-
<div><strong>Note:</strong><br/> {{ .Inner | markdownify }}</div>
3-
</blockquote>
1+
{{ partial "callout.html" (dict
2+
"class" "note"
3+
"title" "Note:"
4+
"icon" ""
5+
"inline" "false"
6+
"content" .Inner
7+
) }}
8+
{{ warnf "'<note></note>' is being deprecated. Use generic 'call-out' shortcode instead."}}

layouts/shortcodes/see-also.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
<blockquote class="tip">
2-
<div><strong>See Also:</strong><br/> {{ .Inner | markdownify }}</div>
3-
</blockquote>
1+
{{ partial "callout.html" (dict
2+
"class" "tip"
3+
"title" "See Also:"
4+
"icon" ""
5+
"inline" "false"
6+
"content" .Inner
7+
) }}
8+
{{ warnf "'<see-also></see-also>' is being deprecated. Use generic 'call-out' shortcode instead."}}

layouts/shortcodes/tip.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
<blockquote class="tip">
2-
<div><strong>Tip:</strong><br/> {{ .Inner | markdownify }}</div>
3-
</blockquote>
1+
{{ partial "callout.html" (dict
2+
"class" "tip"
3+
"title" "Tip:"
4+
"icon" ""
5+
"inline" "false"
6+
"content" .Inner
7+
) }}
8+
{{ warnf "'<tip></tip>' is being deprecated. Use generic 'call-out' shortcode instead."}}

layouts/shortcodes/warning.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
<blockquote class="warning call-out">
2-
<div><strong class="call-out-type">Warning</strong><br/> {{ .Inner | markdownify }}</div>
3-
</blockquote>
1+
{{ partial "callout.html" (dict
2+
"class" "warning call-out"
3+
"title" "Warning"
4+
"icon" ""
5+
"inline" "false"
6+
"content" .Inner
7+
) }}

0 commit comments

Comments
 (0)