Unexpected unclosed action in parenthesized pipeline

Hi everyone!
Got to a project, trying to make it work locally to change some layout.
Get such an error while starting wich comand hugo or hugo serve:

Error: add site dependencies: load resources: loading templates: ".../themes/docsy/layouts/shortcodes/readfile.html:27:1": parse failed: template: shortcodes/readfile.html:27: unexpected unclosed action in parenthesized pipeline

line 27-28 is

{{- highlight ($.Scratch.Get "filepath" | readFile | htmlUnescape | 
    safeHTML ) (.Get "lang") "" -}}

After a reserach I as far as I understood it is not correct to change anything in provided template. Can somebody, please, help how to cope with this issue?

Here is the whole shortcodes/readfile.htm

{{/* Handle the "file" named parameter or a single unnamed parameter as the file
path */}}
{{ if .IsNamedParams }}
	{{ $.Scratch.Set "fparameter" ( .Get "file" ) }}
{{ else }}
	{{ $.Scratch.Set "fparameter" ( .Get 0 ) }}
{{ end }}


{{/* If the first character is "/", the path is absolute from the site's
`baseURL`. Otherwise, construct an absolute path using the current directory */}}

{{ if eq (.Scratch.Get "fparameter" | printf "%.1s") "/" }}
  {{ $.Scratch.Set "filepath" ($.Scratch.Get "fparameter") }}
{{ else }}
  {{ $.Scratch.Set "filepath" "/" }}
  {{ $.Scratch.Add "filepath" $.Page.File.Dir }}
  {{ $.Scratch.Add "filepath" ($.Scratch.Get "fparameter") }}
{{ end }}


{{/* If the file exists, read it and highlight it if it's code. Throw an error
if the file is not found */}}

{{ if fileExists ($.Scratch.Get "filepath") }}
  {{ if eq (.Get "code") "true" }}
    {{- highlight ($.Scratch.Get "filepath" | readFile | htmlUnescape | 
    safeHTML ) (.Get "lang") "" -}}
  {{ else }}
    {{- $.Scratch.Get "filepath" | readFile | htmlUnescape | safeHTML -}}
  {{ end }}
{{ else }}

<p style="color: #D74848"><b><i>The file <code>{{ $.Scratch.Get "filepath" }}</code> was not found.</i></b></p>

{{ end }}

($.Scratch.Get "filepath"
You need to add a trailing parens to the above.

1 Like

Thank you!
There came up a couple of more mistakes.
After updating Hugo to the latest version all issues were gone.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.