0.119 regression in html parsing

I noticed with that 0.119 update my site stopped building, and while I’ve downgraded to 0.118.2 to get it working, I thought I’d try and produce a minimal example.

I am using arrow.js in my site to enable reactive frontend content (which I’ve removed from the example for simplicity), which itself makes use of javasript html template. This list.html is parsed just fine:

{{ define "main" }}

<script type="module">
  const posts = [];
  const card_template = html`<div>${() => posts.map(post => html``)}</div>`
</script>

<h1>{{ .Title }}</h1>

{{ end }}

However, theHTML below fails and reports html/template:_default/list.html:17:11: {{.Title}} appears in a JS template literal

The only difference between the two snippets is the presence of the nested literal <p></p> section, but for some reason this seems to be triggering Hugo to believe that the rest of the page is inside a template literal.

{{ define "main" }}

<script type="module">
  const posts = [];
  const card_template = html`<div>${() => posts.map(post => html`<p></p>`)}</div>`
</script>

<h1>{{ .Title }}</h1>

{{ end }}

I think this is a regression and not just me being stupid, so I’ll raise it as an issue on the github page after checking with the community here to see if there’s something obvious I’ve missed

Please create an issue, noting that this makes no difference in site config:

[security.goTemplates]
allowActionJSTmpl = true

Also, please reference:
https://go-review.googlesource.com/c/go/+/507995

Not implemented, but will be soonish.

1 Like

Done! Hugo 0.119 no longer builds - issue with js html template parsing · Issue #11507 · gohugoio/hugo · GitHub

Cheers mate