aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl
AgeCommit message (Collapse)Author
10 daysFix panic on server rebuilds when using both base templates and template.DeferBjørn Erik Pedersen
Fixes #12963
10 daysjs: Fix js.Batch for multihost setupsBjørn Erik Pedersen
Note that this is an unreleased feature. Fixes #13151
13 daystpl/tplimpl: Fix title attribute in details shortcodeJoe Mooring
13 daystpl/tplimpl: Update youtube shortcodeJoe Mooring
Pass a map instead of a slice to the collections.Querify function.
13 daystpl/tplimpl: Update details shortcodeJoe Mooring
- Remove localization of default summary value - Add title attribute - Reformat to be consistent with other embedded templates - Simplify and improve integration test - Update documentation
13 daystpl/collections: Allow querify to accept a map argumentJoe Mooring
Closes #13131
13 daystpl/tplimpl: Add details shortcoderacehd
- Add new shortcode to render details HTML element. - Implement integration tests to check: default state, custom summary, open state, attribute sanitization, allowed attributes, and localization of default summary text. - Update docs to include details shortcode. Closes # 13090
14 daysAdd js.BatchBjørn Erik Pedersen
Fixes #12626 Closes #7499 Closes #9978 Closes #12879 Closes #13113 Fixes #13116
2024-12-09tpl/tplimpl: Escape Markdown attributes in render hooks and shortcodesJoe Mooring
2024-11-29Fix server edits of resources included in shortcode/hooksBjørn Erik Pedersen
Fixes #13093
2024-11-16Remove deprecations <= v0.122.0 (note)Bjørn Erik Pedersen
These have, once we release this, been logging ERROR for 6 minor versions.
2024-11-04tpl/tplimpl: Create an embedded comment shortcodeJoe Mooring
Closes #13010
2024-11-01resources: Address Dart Sass deprecation of global built-in functionsJoe Mooring
See https://github.com/sass/dart-sass/releases/tag/1.80.0 Fixes #12961
2024-10-24hugolib/commands: Fix stuck server error issuesBjørn Erik Pedersen
Fixes #11378
2024-10-22tpl/transform: Revert unmarshal whitespace removalJoe Mooring
Fixes #12977
2024-10-19tpl/strings: Add TrimSpace functionJoe Mooring
Closes #12962
2024-10-18tpl/transform: Don't fail on "no data to transform"Bjørn Erik Pedersen
Fixes #12964
2024-10-12tpl/tplimpl: Trim descriptions rather than just chompPatrice Chalin
2024-09-30markup/goldmark: Change default cell alignment in table render hookJoe Mooring
Change the default table cell alignment from "left" to an empty string. Closes #12886
2024-09-29tests: Address deprecation warnings and errorsJoe Mooring
2024-09-22tpl/compare: Use any data type for compare.Conditional conditionJoe Mooring
Improves #5792
2024-09-19tpl: Remove RSS deprecation site.Author checkBjørn Erik Pedersen
The check itself creates a warning which I guess was not intended. We could possibly make that work, but it has been deprecated since Hugo 0.98, so just remove the usage.
2024-09-12internal/warpc: Improve the JS plugin APIBjørn Erik Pedersen
* Move the error handling into commons and make sure the error returned also returns message errors * Make the protocol version an int so it can be more easily compared
2024-08-31Make all renderhook Text methods return template.HTMLBjørn Erik Pedersen
2024-08-31Add Markdown render hooks for tablesBjørn Erik Pedersen
Fixes #9316 Fixes #12811
2024-08-30Fix deprecation warning for resources.ToCSSAndreas Deininger
2024-08-30tpl/resources: Improve resources.Concat error messageJoe Mooring
Closes #7428
2024-08-29tpl: Trim whitespace from google_analytics.htmlPatrice Chalin
2024-08-15Upgrade to Go 1.23Bjørn Erik Pedersen
Fixes #12763
2024-08-14tpl/transform: Don't run ToMath tests in parallelBjørn Erik Pedersen
Closes #12765
2024-08-12Improve Katex error handling and fix handling of large expressionsBjørn Erik Pedersen
* Make throwOnError=true the new default * Handle JS errors as part of the RPC request/response flow * Return a new Result type with .Err on it This enables constructs on the form: ```handlebars {{ with transform.ToMath "c = \\foo{a^2 + b^2}" }} {{ with .Err }} {{ warnf "error: %s" . }} {{ else }} {{ . }} {{ end }} {{ end }} ``` Note that the new `Result` type behaves like `template.HTML` (or a string if needed) when printed, but it will panic if in a error state. Closes #12748
2024-08-11Add katex option ThrowOnErrorBjørn Erik Pedersen
As an internal option for now. Katex misbehaves in error situations without a value set.
2024-08-11Add some more KaTeX optionsBjørn Erik Pedersen
And fix the options handling. Closes #12745 Fixes #12746
2024-08-11tpl/transform: Make Plainify and ToMath return template.HTMLBjørn Erik Pedersen
None of these are useful as plain strings in the templates, which forces the users to do `transform.Plainify "foo" | safeHTML`. If people have trust issues with the output of these functions, they need to just stop using them. Closes #8732
2024-08-10Fix compare of uints and ints in eq, gt etc.Bjørn Erik Pedersen
Fixes #12733
2024-08-09Add build time math renderingBjørn Erik Pedersen
While very useful on its own (and combined with the passthrough render hooks), this also serves as a proof of concept of using WASI (WebAssembly System Interface) modules in Hugo. This will be marked _experimental_ in the documentation. Not because it will be removed or changed in a dramatic way, but we need to think a little more how to best set up/configure similar services, define where these WASM files gets stored, maybe we can allow user provided WASM files plugins via Hugo Modules mounts etc. See these issues for more context: * https://github.com/gohugoio/hugo/issues/12736 * https://github.com/gohugoio/hugo/issues/12737 See #11927
2024-08-06tpl/cast: Improve floatBjørn Erik Pedersen
Make it support the new upstream rational number type in Exif. See #12718
2024-08-06Skip TestEchoParamBjørn Erik Pedersen
Is deprecated, will be remvoved soon.
2024-08-05Fix deprecation errorsBjørn Erik Pedersen
2024-08-01resources/page: Expand parmalinks tokens in `url`n1xx1
This change allows to use permalink tokens in url front matter fields. This should be useful to target more specific pages instead of using a global permalink configuration. It's expected to be used with cascade. Fixes #9714
2024-08-01Bump to go 1.21 in go.modBjørn Erik Pedersen
2024-08-01tpl: Sync Go template packages with the Go 1.22.5 sourceBjørn Erik Pedersen
2024-07-31Shorten processed image filenamesBjørn Erik Pedersen
Fixes #12688 Fixes #12656
2024-07-31Consolidate all hashing to the common/hashing packageBjørn Erik Pedersen
And remove now unsued hashing funcs.
2024-07-31Replace the MD5 hashing of images with xxHashBjørn Erik Pedersen
Note that we only use this for change detection. The previous implementation invoked `MD5FromReaderFast` that created a MD5 has from 8 64 bytes chunks in the file, which is obviously very fast. The new implementation creates the hash from the entire file and ... seems to be even more effective: ``` name old time/op new time/op delta HashImage-10 9.45µs ±21% 10.89µs ± 1% ~ (p=0.343 n=4+4) name old alloc/op new alloc/op delta HashImage-10 144B ± 0% 8B ± 0% -94.44% (p=0.029 n=4+4) name old allocs/op new allocs/op delta HashImage-10 4.00 ± 0% 1.00 ± 0% -75.00% (p=0.029 n=4+4) ```
2024-07-31identity: Upgrade to github.com/mitchellh/hashstructure/v2 v2.0.2Bjørn Erik Pedersen
``` name old time/op new time/op delta HashString/n28-10 131ns ± 7% 133ns ±19% ~ (p=0.343 n=4+4) HashString/n112-10 237ns ± 5% 241ns ± 3% ~ (p=0.229 n=4+4) HashString/n448-10 688ns ± 3% 687ns ± 1% ~ (p=0.886 n=4+4) HashString/n1792-10 2.51µs ± 3% 2.56µs ± 3% ~ (p=0.200 n=4+4) HashString/n7168-10 10.1µs ± 2% 10.0µs ± 4% ~ (p=0.686 n=4+4) name old alloc/op new alloc/op delta HashString/n28-10 80.0B ± 0% 80.0B ± 0% ~ (all equal) HashString/n112-10 160B ± 0% 160B ± 0% ~ (all equal) HashString/n448-10 496B ± 0% 496B ± 0% ~ (all equal) HashString/n1792-10 1.84kB ± 0% 1.84kB ± 0% ~ (all equal) HashString/n7168-10 8.24kB ± 0% 8.24kB ± 0% ~ (all equal) name old allocs/op new allocs/op delta HashString/n28-10 4.00 ± 0% 4.00 ± 0% ~ (all equal) HashString/n112-10 4.00 ± 0% 4.00 ± 0% ~ (all equal) HashString/n448-10 4.00 ± 0% 4.00 ± 0% ~ (all equal) HashString/n1792-10 4.00 ± 0% 4.00 ± 0% ~ (all equal) HashString/n7168-10 4.00 ± 0% 4.00 ± 0% ~ (all equal) ``` Closes #11644
2024-07-29math: Add trigonometric functions and some angle helper functionsraoulb
This commit adds these new template functions in the `math` namespace: math.Acos math.Asin math.Atan math.Atan2 math.Cos math.Pi math.Sin math.Tan math.ToDegrees math.ToRadians Co-authored-by: Joe Mooring <[email protected]>
2024-07-17tpl: Use xxHash instead of MD5 to hash the deferred templatesBjørn Erik Pedersen
Motivation is performance. These templates are typically very small, so the win is minor, I guess.
2024-07-17Throw error if resources.PostProcess is used in a deferred templateBjørn Erik Pedersen
That just doesn't work. See #12655
2024-07-06Add hash.XxHashBjørn Erik Pedersen
Also move the non crypto hash funcs into this new package. This is much faster than e.g. MD5, especially for larger inputs: ``` BenchmarkXxHash/xxHash_43-10 9917955 112.2 ns/op 56 B/op 4 allocs/op BenchmarkXxHash/mdb5_43-10 6017239 204.1 ns/op 96 B/op 3 allocs/op BenchmarkXxHash/fnv32a_43-10 14407333 82.30 ns/op 16 B/op 1 allocs/op BenchmarkXxHash/xxHash_4300-10 2916892 409.7 ns/op 56 B/op 4 allocs/op BenchmarkXxHash/mdb5_4300-10 159748 7491 ns/op 4912 B/op 3 allocs/op BenchmarkXxHash/fnv32a_4300-10 218210 5510 ns/op 16 B/op 1 allocs/op ``` Fixes #12635