Joe Mooring
46da0b7aaa
tpl/lang: Formally deprecate lang.NumFmt
...
Use lang.FormatNumberCustom instead.
2023-09-27 17:34:45 +02:00
Joe Mooring
75f56b4ce6
tpl/collections: Fix and deprecate echoParams
...
Fixes #11498
2023-09-27 17:34:13 +02:00
Carl Johnson
c32094ace1
google_analytics_async.html: Add deprecation warning
2023-09-23 18:57:19 +02: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
ade7ec8187
Add Page.RenderShortcodes
...
A layouts/shortcodes/include.html shortcode may look like this:
```html
{{ $p := site.GetPage (.Get 0) }}
{{ $p.RenderShortcodes }}
```
Fixes #7297
2023-08-03 20:00:57 +02:00
Bjørn Erik Pedersen
ef6e813ca8
tpl/collections: Add BenchmarkWhereOps
...
```
BenchmarkWhereOps/eq-10 8702 120410 ns/op 52280 B/op 2515 allocs/op
BenchmarkWhereOps/ne-10 9829 120759 ns/op 52280 B/op 2515 allocs/op
BenchmarkWhereOps/like-10 6754 176377 ns/op 52917 B/op 2515 allocs/op
```
2023-07-28 10:08:13 +02:00
Joe Mooring
f4598a0986
tpl/collections: Add like operator to where function
...
Closes #11279
2023-07-28 09:53:00 +02:00
Joe Mooring
dc2a544fac
tpl/collections: Fix description of apply function
...
The collections.Apply template function cannot be used with maps.
2023-07-28 09:51:01 +02:00
Bjørn Erik Pedersen
4d7af757c9
Add a common regexp cache
...
```
BenchmarkGetOrCompileRegexp-10 73959368 13.71 ns/op 0 B/op 0 allocs/op
BenchmarkCompileRegexp-10 3143529 380.1 ns/op 872 B/op 10 allocs/op
```
2023-07-27 19:23:12 +02:00
Bjørn Erik Pedersen
5bec50838c
tpl/collections: Fix WordCount (etc.) regression in Where, Sort, Delimit
...
Fixes #11234
2023-07-11 12:11:39 +02:00
Bjørn Erik Pedersen
a78b17d7f1
Make imageConfig work with modules
...
Fixes #11205
2023-07-08 17:20:18 +02:00
Bjørn Erik Pedersen
79639c981c
Fix output formats and media type per language config regression
...
Fixes #11159
2023-06-28 12:33:33 +02:00
khayyam
b74b8d6478
common/collections: Fix append regression to allow appending nil
...
Closes #11180
2023-06-28 09:41:36 +02:00
Oleksandr Redko
e3308a0bbc
tpl/tplimpl: Fix typo in global variable name
2023-06-26 15:12:21 +02:00
Bjørn Erik Pedersen
7c9fada778
Replace the old log setup, with structured logging etc.
...
Fixes #11124
2023-06-18 13:03:04 +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
d178fe94fe
tpl/collections: Fix append when appending a slice to a slice of slices
...
Fixes #11093
2023-06-14 20:18:54 +02:00
Bjørn Erik Pedersen
2ba2271e4a
tpl/math: Allow variadic math functions to take slice args, add math.Product, math.Sum
...
* Update math.Min and math.Max to allow 1 or more args, either scalar or slice, or combination of the two
* Add math.Sum (allow 1 or more args, either scalar or slice, or combination of the two)
* Add math.Product (allow 1 or more args, either scalar or slice, or combination of the two)
Fixes #11030
2023-06-13 20:00:00 +02:00
Oleksandr Redko
382c726e63
markup: Fix typo in function and struct names
2023-06-01 17:59:44 +02:00
Oleksandr Redko
4c46f9400b
all: Replace deprecated ioutil with io and os
2023-06-01 17:52:21 +02:00
Joe Mooring
ff77a927f9
tpl/tplimpl: Use .Language.LanguageCode in built-in templates
2023-05-30 20:10:16 +02:00
Bjørn Erik Pedersen
32585696be
Fix potential deadlock in ByParam
...
Fixes #11039
2023-05-29 14:01:07 +02:00
Bjørn Erik Pedersen
b6e6438f7f
docs: Regen docshelper
2023-05-22 18:54:34 +02:00
InLaw
2db7ec622f
tpl/tplimpl: Add img loading attribute to figure shortcode ( #10927 )
2023-05-21 12:28:45 -07:00
Bjørn Erik Pedersen
7c7baa6183
Add hugo.WorkingDir
...
Fixes #10969
2023-05-20 17:45:56 +02:00
Joe Mooring
150d190ff0
tpl/urls: Return empty string when JoinPath has zero args
2023-05-20 11:14:18 +02:00
Bjørn Erik Pedersen
e4e0313c80
tpl/urls: Fix build broken by a merge
2023-05-19 10:57:03 +02:00
Joe Mooring
5b3e165bad
tpl/urls: Add JoinPath template function
...
See https://pkg.go.dev/net/url#JoinPath
Closes #9694
2023-05-19 10:31:17 +02:00
Oleksandr Redko
610cedaa61
all: Fix comments for exported functions and packages
2023-05-18 21:25:27 +02:00
Joe Mooring
1155bbca9d
tpl/lang: document delimiter option for FormatNumberCustom
...
Closes gohugoio/hugoDocs#1760
2023-05-17 23:35:43 +02:00
Oleksandr Redko
bda082c98c
tpl: Add math.Abs
...
Fixes #10941 .
2023-05-16 18:32:07 +02:00
Bjørn Erik Pedersen
241b21b0fd
Create a struct with all of Hugo's config options
...
Primary motivation is documentation, but it will also hopefully simplify the code.
Also,
* Lower case the default output format names; this is in line with the custom ones (map keys) and how
it's treated all the places. This avoids doing `stringds.EqualFold` everywhere.
Closes #10896
Closes #10620
2023-05-16 18:01:29 +02:00
Joe Mooring
5c7b79cf7f
tpl/strings: Clarify findRESubmatch description
2023-04-27 22:02:41 +02:00
Bjørn Erik Pedersen
f1062519ae
tpl/debug: Add VisualizeSpaces
2023-04-20 11:27:55 +02:00
Andreas Deininger
05c095a0e6
resources.functions: improve validation
2023-03-20 14:53:57 +01:00
septs
f5eddf89bf
tpl/math: Return error if less than 2 input numbers
...
Fixes #10827
2023-03-14 09:28:38 +01:00
Andreas Deininger
d55af2abf0
Run gofmt -s on source files
2023-03-12 10:32:29 +01:00
septs
84201e8d5d
tpl/math: Allow multi numbers in add, sub, mul, div, min and max
2023-03-11 11:21:08 +01:00
Jonathan Fisher
d171d1543d
tpl: Add hasSuffix alias
...
strings.HasPrefix already has an alias of hasPrefix
but strings.HasSuffix has no such alias.
This PR adds a hasSuffix alias to the tpl function with corresponding
function documentation.
It also adds a Minor update to the hasPrefix function documentation
re: keywords and relatedfuncs.
Completes https://github.com/gohugoio/hugo/issues/10474
2023-03-08 10:18:34 +01:00
Bjørn Erik Pedersen
df5608f8a0
Allow page.TableOfContents on self in shortcode
...
Fixes #10791
2023-03-05 12:51:57 +01:00
Bjørn Erik Pedersen
f56ce01ae1
tpl/partial: Consolidate GoDoc
2023-03-04 22:04:01 +01:00
Bjørn Erik Pedersen
3bbeb5688c
Fix "context canceled" with partial
...
Make sure the context used for timeouts isn't created based on the incoming
context, as we have cases where this can cancel the context prematurely.
Fixes #10789
2023-03-04 21:29:05 +01:00
Bjørn Erik Pedersen
6c798eba60
Page context handling in i18n
...
This is a workaround. We need to improve on this, but not today.
Fixes #10782
2023-03-04 17:19:14 +01:00
Oleksandr Redko
36ce3a4a9d
Correct typos in Go comments
2023-03-02 16:32:32 +01:00
Bjørn Erik Pedersen
eef23a7f27
Fix "page" not defined
...
Fixes #10774
2023-03-02 10:39:44 +01:00
Joe Mooring
66f94b4945
tpl/tplimpl: Remove the Google News internal template
...
This was deprecated, with a warning message, on 21 Nov 2021.
Reference #9190
2023-03-01 18:11:44 +01:00
Khayyam Saleem
c0d15a2897
strings: fix Truncate behavior for formatted html
...
Before this fix, strings.Truncate would erroneously re-include
attributes from the opening tag in the closing tag when closing
formatted html, due to a bug in how tagnames were extracted from the
regex capture group for html tags used in `truncate.go`. This change
ensures that only the tagname is retained and all attributes are discarded
when storing the tags for closing them later.
Fixes #10399
2023-03-01 17:59:50 +01:00
Bjørn Erik Pedersen
2a61910e82
tpl/strings: Adjust benchmark
2023-03-01 17:59:02 +01:00
Bjørn Erik Pedersen
079d1b6540
tpl/strings: Add BenchmarkTruncate
2023-03-01 17:51:09 +01:00