Browse Source

refactor(shortcodes/external): normalize handling of whitespace

Josh Habdas 11 months ago
parent
commit
951940121a
Signed by: Josh Habdas <jhabdas@protonmail.com> GPG Key ID: B148B31154C75A74
1 changed files with 16 additions and 16 deletions
  1. 16
    16
      layouts/shortcodes/external.html

+ 16
- 16
layouts/shortcodes/external.html View File

@@ -1,19 +1,19 @@
1
-{{ $href := .Get "href" | default nil }}
2
-{{ $body := .Get "text" | default .Inner }}
3
-{{ $class := .Get "class" }}
4
-{{ $referrerpolicy := .Get "referrerpolicy" }}
5
-{{ $target := .Get "target" }}
6
-{{ $title := .Get "title" }}
7
-{{ $type := .Get "type" }}
8
-{{ $rel := .Get "rel" }}
9
-{{ $itemtype := .Get "itemtype" }}
10
-{{ if .IsNamedParams }}
11
-  {{- partial "shortcode/external.html" (dict "href" $href "body" $body "class" $class "referrerpolicy" $referrerpolicy "target" $target "type" $type "title" $title "rel" $rel "itemtype" $itemtype "suppress_external" (and .Inner (eq (len (findRE "external" $rel)) 0))) -}}
12
-{{ else if gt (len .Params) 1 }}
13
-  {{- partial "shortcode/external.html" (dict "href" (.Get 0) "body" (.Get 1)) -}}
14
-{{ else }}
15
-  {{- partial "shortcode/external.html" (dict "href" (.Get 0)) -}}
16
-{{ end -}}
1
+{{ $href := .Get "href" | default nil -}}
2
+{{ $body := .Get "text" | default .Inner -}}
3
+{{ $class := .Get "class" -}}
4
+{{ $referrerpolicy := .Get "referrerpolicy" -}}
5
+{{ $target := .Get "target" -}}
6
+{{ $title := .Get "title" -}}
7
+{{ $type := .Get "type" -}}
8
+{{ $rel := .Get "rel" -}}
9
+{{ $itemtype := .Get "itemtype" -}}
10
+{{- if .IsNamedParams -}}
11
+  {{ partial "shortcode/external.html" (dict "href" $href "body" $body "class" $class "referrerpolicy" $referrerpolicy "target" $target "type" $type "title" $title "rel" $rel "itemtype" $itemtype "suppress_external" (and .Inner (eq (len (findRE "external" $rel)) 0))) }}
12
+{{- else if gt (len .Params) 1 -}}
13
+  {{ partial "shortcode/external.html" (dict "href" (.Get 0) "body" (.Get 1)) }}
14
+{{- else -}}
15
+  {{ partial "shortcode/external.html" (dict "href" (.Get 0)) }}
16
+{{- end -}}
17 17
 {{- if or (and .IsNamedParams (eq $href nil)) (and (eq .IsNamedParams false) (eq (.Get 0) nil)) }}
18 18
   <p>{{ partial "components/alert.html" (dict "type" "error" "body" (errorf "Invalid use of external shortcode. Please provide a URL.")) }}</p>
19 19
 {{ end -}}

Loading…
Cancel
Save