File tree 1 file changed +16
-5
lines changed
1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 15
15
{{ with partialCached "tnd-netlifycms/private/import" . . }}
16
16
{{ end }}
17
17
*/}}
18
- {{/* regex101.com > https://regex101.com/r/TFA6WQ /1 */}}
19
- {{ $pattern := "^([a-zA-Z]*) ([a-zA-Z/_-]*)$"}}
20
- {{ $string_pattern := "^import ([a-zA-Z]*) ([a-zA-Z/_-]*)$" }}
18
+ {{/* regex101.com > https://regex101.com/r/mIrmn0 /1 */}}
19
+ {{ $pattern := "^([a-zA-Z]*) ([. a-zA-Z/_-]*)$"}}
20
+ {{ $string_pattern := "^import ([a-zA-Z]*) ([. a-zA-Z/_-]*)$" }}
21
21
{{/* Return variable, by default, will be the passed context */}}
22
22
{{ $return := . }}
23
23
{{ $type := false }}
59
59
{{ if and $type $file }}
60
60
{{/* We look for the matching data file located in `data/netlifycms/{Type}/{File}.yaml` */}}
61
61
{{ with index site.Data.netlifycms (pluralize $type) }}
62
- {{ with index . $file }}
62
+ {{ $with := index . $file }}
63
+ {{ $file_split := split $file "." }}
64
+ {{ if eq (len $file_split) 2 }}
65
+ {{ $with = index . (index $file_split 0) (index $file_split 1) }}
66
+ {{ end }}
67
+ {{ with $with }}
63
68
{{ $return = . }}
64
69
{{ with $extend }}
65
70
{{ $return = merge $return . }}
66
71
{{ end }}
67
72
{{ else }}
68
- {{ partial "tnd-netlifycms/warn" (printf "We couldn't find %s/%s" $type $file) }}
73
+ {{ $message := printf "We couldn't find %s/%s" $type $file }}
74
+ {{ with split $file "." }}
75
+ {{ if gt . 2 }}
76
+ {{ $message = print $message " because object depth is limited to 2" }}
77
+ {{ end }}
78
+ {{ end }}
79
+ {{ partial "tnd-netlifycms/warn" $message }}
69
80
{{ end }}
70
81
{{ else }}
71
82
{{ partial "tnd-netlifycms/warn" (printf "We couldn't find Type %s" $type) }}
You can’t perform that action at this time.
0 commit comments