chipzoller / hugo-clarity

A theme for Hugo based on VMware Clarity
Other
582 stars 267 forks source link

unexpected unclosed action in parenthesized pipeline #282

Closed gary094 closed 2 years ago

gary094 commented 2 years ago

I have checked all the prerequisites below and I'm yet experiencing a problem

Describe the bug

Just tried to update the submodule and rebuilt my static site however I receive the following error immediately while building.

Error: add site dependencies: load resources: loading templates: "/home/user/hugo/blog/themes/hugo-clarity/layouts/_default/_markup/render-image.html:60:1": parse failed: template: _default/_markup/render-image.html:60: unexpected unclosed action in parenthesized pipeline

This can be reproduced using the commands in the README

hugo new site yourSiteName
cd yourSiteName
git init
git submodule add https://github.com/chipzoller/hugo-clarity themes/hugo-clarity
cp -a themes/hugo-clarity/exampleSite/* .

Avoid long-winded descriptions

Desktop (please complete the following information):

rootwork commented 2 years ago

@gary094 Those Hugo versions are pretty old, can you try with something more recent? https://github.com/gohugoio/hugo/releases

We have been working on that file recently so it's possible there is a bug, just want to rule out Hugo version issues.

gary094 commented 2 years ago

I finally came around to my arch linux box and yes indeed with hugo version v0.96.0+extended the site can be build just fine.

Since version v0.80.0 is present in the most recent debian 11 maybe it would be good to take a look into this issue?

rootwork commented 2 years ago

I confirmed that 0.80.0 doesn't compile the site. I can fix "unexpected unclosed action in parenthesized pipeline" by making the code less readable, changing this:

{{- partial "figure" (
  dict
    "file" $file
    "image" $image
    "diskPath" $.Page.File.Dir
    "webPath" $.Page.RelPermalink
    "alt" $alt
    "cap" $cap
    "classes" ($scratch.Get "classes")
    "bundle" $bundle
) -}}

to this:

{{- partial "figure" (dict "file" $file "image" $image "diskPath" $.Page.File.Dir "webPath" $.Page.RelPermalink "alt" $alt "cap" $cap "classes" ($scratch.Get "classes") "bundle" $bundle) -}}

in two files (render-image.html and image.html). But then 0.80.0 also fails on {{- $image = resources.GetRemote $file -}}, which we use in both places to allow people to pull in remote images and use them as local images. The GetRemote method wasn't added to the resources function until 0.91.0 (and not documented until 0.93).

So supporting v0.80.0 would mean ripping that part out.

I'm sympathetic to supporting older versions -- I'm on Linux Mint (Ubuntu/Debian) and the default that gets installed from my repo is 0.68! (Incidentally it looks like the Arch repo is now installing 0.98.0.) But since users of Hugo Clarity already need to make sure they're installing the extended version, I don't think it would be unreasonable to also give them a minimum version.

So ultimately I think I'm going to mark this as invalid (really wontfix), but I'll leave it open for a bit for any further feedback.

gary094 commented 2 years ago

Thanks for looking into this!

For me it is perfectly fine to leave it as it is, since I have the possibility to just compile my website on arch and copy /public over to my webserver.

onweru commented 2 years ago

@rootwork, maybe we should update the min version to 0.91 https://github.com/chipzoller/hugo-clarity/blob/616b44986438752406ac579e620e35b1bab1cd50/theme.toml#L9.

rootwork commented 2 years ago

D'oh. I'll add that to #307 ... done.

onweru commented 2 years ago

D'oh. I'll add that to #307.

Just saw that earlier. Thank you 😄