Bjørn Erik Pedersen
9f978d387f
Pull in the latest code from Go's template packages ( #11771 )
...
Fixes #10707
Fixes #11507
2023-12-04 12:07:54 +01:00
Bjørn Erik Pedersen
1e9b87f760
Upgrade to Go 1.21.1
...
See https://github.com/golang/go/issues?q=milestone%3AGo1.21.1+label%3ACherryPickApproved
Fixes #11474
Fixes #11414
2023-09-21 21:38:41 +02:00
Bjørn Erik Pedersen
24b1be45c1
Go 1.21 Upgrade
...
Fixes #11351
2023-08-23 21:49:27 +02:00
Bjørn Erik Pedersen
ee359df172
Fix upstream Go templates bug with reversed key/value assignment
...
The template packages are based on go1.20.5 with the patch in befec5ddbbfbd81ec84e74e15a38044d67f8785b added.
This also includes a security fix that now disallows Go template actions in JS literals (inside backticks).
This will throw an error saying "... appears in a JS template literal".
If you're really sure this isn't a security risk in your case, you can revert to the old behaviour:
```toml
[security]
[security.gotemplates]
allowActionJSTmpl = true
```
See https://github.com/golang/go/issues/59234
Fixes #11112
2023-06-15 23:04:33 +02:00
Bjørn Erik Pedersen
094135ff96
tpl/internal: Sync Go template src to Go 1.20
...
Updates #10691
2023-02-22 11:26:52 +01:00
Bjørn Erik Pedersen
f6ab9553f4
tpl/internal: Sync go_templates
...
Closes #10411
2022-11-14 22:31:50 +01:00
Bjørn Erik Pedersen
3854a6fa6c
Fix Plainify edge cases
...
This commit replaces the main part of `helpers.StripHTML` with Go's implementation in its html/template package.
It's a little slower, but correctness is more important:
```bash
BenchmarkStripHTMLOld-10 680316 1764 ns/op 728 B/op 4 allocs/op
BenchmarkStripHTMLNew-10 384520 3099 ns/op 2089 B/op 10 allocs/op
```
Fixes #9199
Fixes #9909
Closes #9410
2022-05-25 17:55:23 +02:00
Bjørn Erik Pedersen
3476b53343
tpl: Pull in Go 1.18 patch that fixes the "no space in {{ continue }} and {{ break }}" bug
2022-03-16 13:14:23 +01:00
Bjørn Erik Pedersen
65a78cae1e
tpl: Sync go_templates for Go 1.18
...
Using Go tag go1.18 4aa1efed4853ea067d665a952eee77c52faac774
Updates #9677
2022-03-16 08:54:25 +01:00
Bjørn Erik Pedersen
b5485aeae7
Add breaking tests for "map read and map write in templates"
...
The fix upstream in Go was reverted, so we apply a temporary patch for this in Hugo.
Updates #7293
2021-02-18 14:11:48 +01:00
Bjørn Erik Pedersen
ccb822eb5a
Pull in latest Go template source
2021-02-18 14:11:48 +01:00
Bjørn Erik Pedersen
cf3e077da3
tpl/internal: Synch Go templates fork with Go 1.16dev
2021-02-18 14:11:48 +01:00
Bjørn Erik Pedersen
718e09ed4b
tpl/internal/go_templates: Revert formatting
...
Should make future fork synch easier.
2020-12-03 13:47:43 +01:00
Bjørn Erik Pedersen
d90e37e0c6
all: Format code with gofumpt
...
See https://github.com/mvdan/gofumpt
2020-12-03 13:12:58 +01:00
Bjørn Erik Pedersen
b298c06e05
deps: Update to Chroma v0.8.2
...
Closes #7970
2020-11-20 09:30:05 +01:00
Bjørn Erik Pedersen
6c3c6686f5
Fix Go template script escaping
...
Fixes #6695
2020-05-23 22:00:34 +02:00
Bjørn Erik Pedersen
1cf235412f
tpl: Put Go's internal template funcs in Hugo's map
...
```
name old time/op new time/op delta
SiteNew/Many_HTML_templates-16 43.4ms ± 0% 42.7ms ± 0% -1.71% (p=0.016 n=4+5)
name old alloc/op new alloc/op delta
SiteNew/Many_HTML_templates-16 17.5MB ± 0% 17.5MB ± 0% ~ (p=0.690 n=5+5)
name old allocs/op new allocs/op delta
SiteNew/Many_HTML_templates-16 247k ± 0% 247k ± 0% ~ (p=0.310 n=5+5)
```
Fixes #6717
2020-01-07 13:18:19 +01:00
Bjørn Erik Pedersen
167c01530b
Create lightweight forks of text/template and html/template
...
This commit also removes support for Ace and Amber templates.
Updates #6594
2019-12-12 09:59:34 +01:00