Skip to content

Commit

Permalink
Ensure that spec_status shortcode fails softly (#5556)
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin authored Nov 8, 2024
1 parent e7c30e9 commit 6a6ce10
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions layouts/shortcodes/spec_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{ end -}}
{{ $page := .Site.GetPage $pageRef -}}
{{ if not $page -}}
{{ errorf "spec_status: Can't find page at '%s'." $pageRef -}}
{{ warnf "spec_status: Can't find page at '%s'." $pageRef -}}
{{ end -}}

{{ $_match := .Get 2 | default "Status" -}}
Expand All @@ -17,7 +17,7 @@
{{/* Note that content is in HTML. */ -}}
{{ $statusLine = index . 0 -}}
{{ else -}}
{{ errorf "%s: page '%s' does not contain a line matching '%s'." $err $pageRef $_match -}}
{{ warnf "%s: page '%s' does not contain a line matching '%s'." $err $pageRef $_match -}}
{{ end -}}

{{ $status := "" -}}
Expand All @@ -30,7 +30,8 @@
{{ with findRE $statusRE $statusLine -}}
{{ $status = index . 0 -}}
{{ else -}}
{{ errorf "%s: '%s' value did not match one of '%s' in file '%s': matched line is '%s'" $err $_match $statusValueRE $pageRef $statusLine -}}
{{ warnf "%s: '%s' value did not match one of '%s' in file '%s': matched line is '%s'" $err $_match $statusValueRE $pageRef $statusLine -}}
{{ $status = "[STATUS ACCESS FAILURE DURING SITE BUILD]" -}}
{{ end -}}

**[{{ $label }}]({{ $page.RelPermalink }}):** {{ lower $status -}}

0 comments on commit 6a6ce10

Please sign in to comment.