|
1 | 1 | <!-- Get the current buildcondition from the config and lowercase it -->
|
2 |
| -{{ $condition := lower $.Site.Params.buildCondition }} |
| 2 | +{{- $condition := lower $.Site.Params.buildCondition -}} |
3 | 3 |
|
4 |
| -{{ if ne $condition "" }} |
| 4 | +{{- if ne $condition "" -}} |
5 | 5 |
|
6 | 6 | <!-- Get the parameters from the shortcode invocation and lowercase them.
|
7 | 7 | TODO: to enable multiple conditions, we could accept comma-separated lists and split them -->
|
8 |
| - {{ $include_if := lower (.Get "include-if") }} |
9 |
| - {{ $exclude_if := lower (.Get "exclude-if") }} |
| 8 | + {{- $include_if := lower (.Get "include-if") -}} |
| 9 | + {{- $exclude_if := lower (.Get "exclude-if") -}} |
10 | 10 |
|
11 |
| - {{ if and (in $include_if $condition) (in $exclude_if $condition) }} |
| 11 | + {{- if and (in $include_if $condition) (in $exclude_if $condition) -}} |
12 | 12 | <!-- condition appears in both parameters -->
|
13 | 13 | {{- errorf "Build condition %q appears in both include-if and exclude-if parameters of conditional-txt shortcode on page %s" $condition .Position -}}
|
14 |
| - {{ end }} |
| 14 | + {{- end -}} |
15 | 15 |
|
16 |
| - {{ if isset $.Params "include-if" }} |
| 16 | + {{- if isset $.Params "include-if" -}} |
17 | 17 | <!-- WARNING substring matches are matches as well! That means, if include-if="foobar", and buildcondition is "foo", you have a match!-->
|
18 |
| - {{ if in $include_if $condition }} |
| 18 | + {{- if in $include_if $condition -}} |
19 | 19 | <!-- Do not indent the next Inner line, because the inner becomes a blockquote if the conditional-text is nested in another shortcode -->
|
20 |
| -{{ .Inner }} |
21 |
| - {{ else }} |
22 |
| - {{ end }} |
23 |
| - {{ else }} |
| 20 | +{{- .Inner -}} |
| 21 | + {{- else -}} |
| 22 | + {{- end -}} |
| 23 | + {{- else -}} |
24 | 24 |
|
25 |
| - {{ if isset $.Params "exclude-if" }} |
| 25 | + {{- if isset $.Params "exclude-if" -}} |
26 | 26 | <!-- WARNING substring matches are matches as well! That means, if exclude-if="foobar", and buildcondition is "foo", you have a match!-->
|
27 |
| - {{ if in $exclude_if $condition }} |
28 |
| - {{ else }} |
| 27 | + {{- if in $exclude_if $condition -}} |
| 28 | + {{- else -}} |
29 | 29 | <!-- Do not indent the next Inner line, because the inner becomes a blockquote if the conditional-text is nested in another shortcode -->
|
30 |
| -{{ .Inner }} |
31 |
| - {{ end }} |
32 |
| - {{ end }} |
| 30 | +{{- .Inner -}} |
| 31 | + {{- end -}} |
| 32 | + {{- end -}} |
33 | 33 |
|
34 |
| - {{ end }} |
| 34 | + {{- end -}} |
35 | 35 |
|
36 |
| -{{ end }} |
| 36 | +{{- end -}} |
0 commit comments