Commit graph

1135 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
641403f7de Fix Position for passthrough hooks
Fixes #13406
2025-02-17 12:23:49 +01:00
Bjørn Erik Pedersen
fd8b0fbf8a Upgrade to Go 1.24
Fixes #13381
2025-02-12 22:01:25 +01:00
Bjørn Erik Pedersen
9b5f786df8 Deprecate kind, lang, and path from front matter
These were added to the page meta object when we implemented "pages from data", but were not meant to be used in front matter.

That is not supported, so we might as well add validation.

Fixes #12484
2025-02-10 21:22:43 +01:00
Bjørn Erik Pedersen
c2fb221209 Add ContentTypes to config
This is an empty struct for now, but we will most likely expand on that.

```
[contentTypes]
  [contentTypes.'text/markdown']
```

The above means that only Markdown will be considered a content type. E.g. HTML will be treated as plain text.

Fixes #12274
2025-02-08 10:31:15 +01:00
Joe Mooring
7104de83ce common/hugo: Adjust deprecation timing and message
Closes #13333
2025-02-03 18:32:30 +01:00
Alex Shpak
13b208e2f7 tpl/tplimpl: Remove leading whitespaces produced by Youtube shortcode 2025-01-31 09:29:10 +01:00
Joe Mooring
873a5cda1a tpl/tplimpl: Improve shortcode test coverage 2025-01-24 09:10:45 +01:00
Joe Mooring
f42a4b6af5 tpl/tplimpl: Deprecate gist shortcode
Closes #13211
2025-01-23 20:12:36 +01:00
Bjørn Erik Pedersen
51bb2fedab
tpl/tplimpl: Skip TestTemplateFuncsExamples on s390x
Closes #13204
2025-01-23 10:18:43 +01:00
Joe Mooring
77a8e347bc tpl/tplimpl: Deprecate comment shortcode 2025-01-22 19:38:02 +01:00
Joe Mooring
8de4ffb294 tpl/tplimpl: Fix context in shortcode error messages
Fixes #13279
2025-01-20 16:17:55 +01:00
Bjørn Erik Pedersen
1f5a15aba0 resources: Fix 2 image file cache key issues
* Always include the content hash in the cache key for unprocessed images.
* Always include the image config hash in the cache key.

This is also a major cleanup/simplification of the implementation in this area.

Note that this, unfortunately, forces new hashes/filenames for generated images.

Fixes #13273
Fixes #13272
2025-01-18 12:23:18 +01:00
Nicolas Friedli
8897113666
tpl: Add loading attribute to qr shortcode 2025-01-17 19:06:54 +01:00
Bjørn Erik Pedersen
1fad3832a9 tpl/tplimpl: Simplify some test assertions 2025-01-16 11:29:24 +01:00
Joe Mooring
1191467c05 tpl/tplimpl: Deprecate twitter shortcode in favor of x shortcode
Closes #13214
2025-01-16 10:33:34 +01:00
Bjørn Erik Pedersen
de7137cc35 tpl/collections: Use MapRange/SetIterKey/SetIterValue for Where, Sort and Merge
Some relevant benchmarks:

Where with maps:

```
cpu: Apple M1 Pro
            │ master.bench │         fix-mapkeys.bench          │
            │    sec/op    │   sec/op     vs base               │
WhereMap-10    79.26µ ± 1%   26.58µ ± 1%  -66.46% (p=0.002 n=6)

            │ master.bench │         fix-mapkeys.bench         │
            │     B/op     │    B/op     vs base               │
WhereMap-10   56685.0 ± 0%   111.0 ± 1%  -99.80% (p=0.002 n=6)

            │ master.bench  │         fix-mapkeys.bench         │
            │   allocs/op   │ allocs/op   vs base               │
WhereMap-10   2003.000 ± 0%   4.000 ± 0%  -99.80% (p=0.002 n=6)
```

Merge:

```
         │ master.bench │         fix-mapkeys.bench          │
         │    sec/op    │   sec/op     vs base               │
Merge-10    3.285µ ± 0%   2.268µ ± 1%  -30.96% (p=0.002 n=6)

         │ master.bench │          fix-mapkeys.bench          │
         │     B/op     │     B/op      vs base               │
Merge-10   3.079Ki ± 0%   1.891Ki ± 0%  -38.58% (p=0.002 n=6)

         │ master.bench │         fix-mapkeys.bench         │
         │  allocs/op   │ allocs/op   vs base               │
Merge-10     64.00 ± 0%   26.00 ± 0%  -59.38% (p=0.002 n=6)
```
Sort:

```
cpu: Apple M1 Pro
           │ master.bench │         fix-mapkeys.bench         │
           │    sec/op    │   sec/op     vs base              │
SortMap-10   1008.0n ± 1%   915.5n ± 0%  -9.18% (p=0.002 n=6)

           │ master.bench │         fix-mapkeys.bench         │
           │     B/op     │    B/op     vs base               │
SortMap-10     640.0 ± 0%   512.0 ± 0%  -20.00% (p=0.002 n=6)

           │ master.bench │        fix-mapkeys.bench         │
           │  allocs/op   │ allocs/op   vs base              │
SortMap-10     16.00 ± 0%   15.00 ± 0%  -6.25% (p=0.002 n=6)
```
2025-01-13 16:24:48 +02:00
Bjørn Erik Pedersen
956f915f77
tpl/collections: Add BenchmarkWhereMap 2025-01-13 12:57:48 +02:00
Bjørn Erik Pedersen
a2a4166f6d
tpl/collections: Add BenchmarkSortMap 2025-01-13 10:38:12 +02:00
Bjørn Erik Pedersen
39f582f9f4
tpl/collections: Add Merge benchmark 2025-01-13 10:32:41 +02:00
Bjørn Erik Pedersen
2501de7aab resources/images: Refactor golden image tests to locate them closer to the implementation 2025-01-11 18:27:53 +02:00
Joe Mooring
8af04745fb tpl/tplimpl: Use plain text for image render hook alt attribute
Co-authored-by: Heracles <email@heracl.es>
2025-01-10 19:44:39 +02:00
Bjørn Erik Pedersen
dde9d9d544 Adjust error handling in ToMath vs try (note)
Closes #13239
2025-01-09 11:47:19 +01:00
Bjørn Erik Pedersen
61d3d20129 templates: Fix handling of multiple defers in the same template
Fixes #13236
2025-01-09 07:59:25 +01:00
Joe Mooring
b13d0a68e6 tpl/images: Change signature of images.QR to images.QR TEXT OPTIONS
Closes #13230
2025-01-08 19:59:39 +01:00
Bjørn Erik Pedersen
5f2adad2c7 tpl/images: Format the QR hashes as hex
Slightly shorter, and it looks more like a ... hash.
2025-01-06 15:05:03 +01:00
Bjørn Erik Pedersen
0918e087ec resources: Replace error handling in GetRemote with try (note)
Closes #13216
2025-01-06 12:22:17 +01:00
Joe Mooring
4ea94c451d tpl/images: Add images.QR function
Closes #13205
2025-01-06 12:05:59 +01:00
Bjørn Erik Pedersen
5d2cbee989 Add try
Updates #9737
2025-01-05 15:32:21 +01:00
Bjørn Erik Pedersen
4a5e94087b Fix union, complement, symdiff, and intersect for transient resources
Fixes #13181
2024-12-22 19:25:03 +01:00
Bjørn Erik Pedersen
a5e5be234c Fix panic on server rebuilds when using both base templates and template.Defer
Fixes #12963
2024-12-16 18:03:04 +01:00
Bjørn Erik Pedersen
565c30eac9 js: Fix js.Batch for multihost setups
Note that this is an unreleased feature.

Fixes #13151
2024-12-16 11:52:18 +01:00
Joe Mooring
a32c889a7b
tpl/tplimpl: Fix title attribute in details shortcode 2024-12-13 10:50:17 -08:00
Joe Mooring
852d868549 tpl/tplimpl: Update youtube shortcode
Pass a map instead of a slice to the collections.Querify function.
2024-12-13 15:16:55 +01:00
Joe Mooring
1e34e5b26d tpl/tplimpl: Update details shortcode
- Remove localization of default summary value
- Add title attribute
- Reformat to be consistent with other embedded templates
- Simplify and improve integration test
- Update documentation
2024-12-13 14:21:13 +01:00
Joe Mooring
641d2616c7 tpl/collections: Allow querify to accept a map argument
Closes #13131
2024-12-13 13:30:55 +01:00
racehd
4f130f6e4f tpl/tplimpl: Add details shortcode
- 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
2024-12-13 09:24:20 +01:00
Bjørn Erik Pedersen
e293e7ca6d Add js.Batch
Fixes #12626
Closes #7499
Closes #9978
Closes #12879
Closes #13113
Fixes #13116
2024-12-12 21:43:17 +01:00
Joe Mooring
54398f8d57
tpl/tplimpl: Escape Markdown attributes in render hooks and shortcodes 2024-12-09 17:58:57 +01:00
Bjørn Erik Pedersen
c1dc35dd71 Fix server edits of resources included in shortcode/hooks
Fixes #13093
2024-11-29 14:22:39 +01:00
Bjørn Erik Pedersen
ad43d137d5 Remove deprecations <= v0.122.0 (note)
These have, once we release this, been logging ERROR for 6 minor versions.
2024-11-16 20:32:43 +01:00
Joe Mooring
801035bb7a tpl/tplimpl: Create an embedded comment shortcode
Closes #13010
2024-11-04 21:05:07 +01:00
Joe Mooring
889308dd85 resources: Address Dart Sass deprecation of global built-in functions
See https://github.com/sass/dart-sass/releases/tag/1.80.0

Fixes #12961
2024-11-01 14:05:27 +01:00
Bjørn Erik Pedersen
cb6e27b32a hugolib/commands: Fix stuck server error issues
Fixes #11378
2024-10-24 13:34:11 +02:00
Joe Mooring
5bbe95f9c5 tpl/transform: Revert unmarshal whitespace removal
Fixes #12977
2024-10-22 09:42:40 +02:00
Joe Mooring
d37606d2c2 tpl/strings: Add TrimSpace function
Closes #12962
2024-10-19 21:10:00 +02:00
Bjørn Erik Pedersen
42f37b4e98
tpl/transform: Don't fail on "no data to transform"
Fixes #12964
2024-10-18 10:30:36 +02:00
Patrice Chalin
039845804f
tpl/tplimpl: Trim descriptions rather than just chomp 2024-10-12 22:41:42 +02:00
Joe Mooring
1158e63072 markup/goldmark: Change default cell alignment in table render hook
Change the default table cell alignment from "left" to an empty string.

Closes #12886
2024-09-30 08:44:14 +02:00
Joe Mooring
d1ba52f3c3 tests: Address deprecation warnings and errors 2024-09-29 10:49:26 +02:00
Joe Mooring
0ea796dad1 tpl/compare: Use any data type for compare.Conditional condition
Improves #5792
2024-09-22 16:53:11 +02:00