Commit Graph

396 Commits

Author SHA1 Message Date
Bjørn Erik Pedersen 9cd7db61d3
Run mage generate 2024-05-02 10:49:09 +02:00
Bjørn Erik Pedersen c892e75fbc
resources/page: Pull internal Page methods into its own interface
So it doesn't get visible when passing it to `jsonify`.
2024-05-02 10:49:02 +02:00
Bjørn Erik Pedersen 004b694390 Fix partial rebuilds for SCSS fetched with GetMatch and similar
Fixes #12395
2024-04-20 15:09:12 +02:00
Bjørn Erik Pedersen faf9fedc3d
resources/images: Fix TestColorLuminance on s390x 2024-04-19 11:21:50 +02:00
Bjørn Erik Pedersen e197c7b29d Add Luminance to Color
To sort an image's colors from darkest to lightest, you can then do:

```handlebars
{{ {{ $colorsByLuminance := sort $image.Colors "Luminance" }}
```

This uses the formula defined here: https://www.w3.org/TR/WCAG21/#dfn-relative-luminance

Fixes #10450
2024-04-16 10:02:46 +02:00
Bjørn Erik Pedersen df11327ba9 Pass .RenderShortcodes' Page to render hooks as .PageInner
The main use case for this is to resolve links and resources (e.g. images) relative to the included `Page`.

A typical `include` would similar to this:

```handlebars
{{ with site.GetPage (.Get 0) }}
  {{ .RenderShortcodes }}
{{ end }}
```

And when used in a Markdown file:

```markdown
{{% include "/posts/p1" %}}
```

Any render hook triggered while rendering `/posts/p1` will get `/posts/p1` when calling `.PageInner`.

Note that

* This is only relevant for shortcodes included with `{{%` that calls `.RenderShortcodes`.
* `.PageInner` is available in all render hooks that, before this commit, received `.Page`.
* `.PageInner` will fall back to the value of `.Page` if not relevant and will always have a value.

Fixes #12356
2024-04-15 09:49:57 +02:00
Joe Mooring a6e8439176 resources/page: Add taxonomies Page method
Closes #12316
2024-04-12 16:26:02 +02:00
Christian Oliff 17765a7451
all: Typo fixes 2024-04-11 09:23:17 +02:00
Bjørn Erik Pedersen 92de8625c7
babel: Run go fmt 2024-04-08 18:28:04 +02:00
guangwu 7907935a42
babel: Close file before removing 2024-04-08 15:23:08 +02:00
Soren L. Hansen 4500b0e423 resources/page: Escape hash sign in permalinks
When creating a link to a file with a `#` in the filename, the link gets
truncated. This happens because the filename is eventaully passed to
`url.Parse` which (correctly!) interprets the `#` as fragment separator.

This commit escapes the `#` in the filename before creating the link.

Fixes #4926
Fixes #8232
Fixes #12342

Co-authored-by: Joe Mooring <joe.mooring@veriphor.com>
2024-04-05 15:57:02 +02:00
Joe Mooring 54a8f0ce21 resources: Use different cache key when copying resources
Closes #10412
Closes #12310
2024-03-27 09:59:59 +01:00
George Ma 27414d43a0
resources/page: Fix GoDoc comment 2024-03-22 08:56:10 +01:00
Anthony Fok c1ea22a232
testing: Set usesFMA as true for riscv64 too
This fixes TestImageOperationsGolden "values are not deep equal" error on riscv64 with Go 1.22 and above.
2024-03-20 08:59:13 +01:00
Joe Mooring d4d49e0f0e hugolib: Deprecate site methods Author, Authors, and Social
Closes #12228
2024-03-15 17:26:45 +01:00
Christian Oliff 78178d0c2a
all: Typo fixes 2024-03-15 17:25:52 +01:00
Bjørn Erik Pedersen 9668759ad8 Fix front matter date location when value gets inherited from other dates
Fixes #12236
2024-03-13 19:00:50 +02:00
Bjørn Erik Pedersen 9e9b1f110c Fix Name for nested resourced fetched in resources.ByName and similar
Fixes #12214
2024-03-13 18:59:50 +02:00
Joe Mooring dc6a292133 common/hugo: Rename IsMultiHost and IsMultiLingual
hugo.IsMultiHost => hugo.IsMultihost
hugo.IsMultiLingual => hugo.IsMultilingual

Closes #12232
2024-03-13 17:34:42 +02:00
Joe Mooring 4f92f949ea hugolib: Deprecate .Site.MultiLingual in favor of hugo.IsMultiLingual
Closes #12224
2024-03-10 10:47:51 +02:00
razonyang 1f48b717c7 Add hugo.IsMultiHost 2024-03-07 14:04:41 +01:00
Joe Mooring 05e23bd55c resources/images: Retain newlines with text overlays
Closes #12206
2024-03-07 09:52:30 +01:00
Bjørn Erik Pedersen a4b17470a8 Fix resource name in resources.ByType
Fixes #12190
2024-03-07 09:50:50 +01:00
Bjørn Erik Pedersen 0d6e593ffb Fix and add integration test for the Bootstrap SCSS module for both Dart Sass and Libsass
This fixes the reverse filesystem lookup (absolute filename to path relative to the composite filesystem).

The old logic had some assumptions about the locality of the actual files that didn't work in more complex scenarios.

This commit now also adds the popular Bootstrap SCSS Hugo module to the CI build (both for libsass and dartsass transpiler), so we can hopefully avoid similar future breakage.

Fixes #12178
2024-03-01 14:18:52 +01:00
Bjørn Erik Pedersen 7023cf0f07 Fix resources.GetMatch, resources.Match, and resources.ByType to they don't normalize permalinks
Fixes #12182
2024-03-01 13:34:05 +01:00
Joe Mooring 3f217fd664 resources/page: Make Taxonomy.Get and Taxonomy.Count case-insensitive
Closes #12177
2024-03-01 12:09:00 +01:00
Bjørn Erik Pedersen 6bc0d745a5 Fix multihost processed image not copied to non-default content languages
Fixes #12163
2024-02-27 10:43:23 +01:00
Bjørn Erik Pedersen 1736ef7459 Fix cascade-pattern-with-extension for cascade in site config
Also clean up the log handling in the integration tester, most notably lost logs during the config loading.

Fixes #12151
2024-02-26 17:29:37 +01:00
Bjørn Erik Pedersen d310595a2b resource: Revert the normalization of Resource.Name
Which means that .Name now returns the same as it did in 0.122.0.

Closes #12142
2024-02-25 14:57:29 +01:00
Bjørn Erik Pedersen 189b72331e tocss: Fix the import resolving from absolute to relative assets paths
Fixes #12137
2024-02-24 16:41:18 +01:00
Bjørn Erik Pedersen b2b7bfdd3a
Maek Resoyrce.Key as (mostly) internal 2024-02-24 15:17:15 +01:00
Bjørn Erik Pedersen c4fe45ff4c
resources: Skip the image golden tests when running locally
See #12119
2024-02-23 10:30:11 +01:00
Benjamin Altpeter 554aa58db6 js: Support JSX and JSXImportSourceOptions
Fixes #12118
2024-02-23 10:25:27 +01:00
Bjørn Erik Pedersen cf7023cb90 Fix relative import issue in libsass/dart sass
Fixes #12094
2024-02-21 17:27:45 +01:00
Bjørn Erik Pedersen 621194a319 Fix dart sass import regression
Fixes #12072
2024-02-20 17:00:32 +01:00
Bjørn Erik Pedersen 48eec2a4e6 Fall back to original name in Resources.GetMatch/Match
Same as we do in .Get.

Fixes #12076
2024-02-20 16:47:07 +01:00
Christian Oliff 168d375784
all: Fix typos and some URLs 2024-02-18 12:16:30 +01:00
Bjørn Erik Pedersen 68f67c9aeb Fix rebuild regression on non-default content language edits
Fixes #12043
2024-02-16 19:05:18 +01:00
Bjørn Erik Pedersen 639073e4fe Fix rebuild with resources.Concat
Fixes #12017
2024-02-16 13:17:53 +01:00
Joe Mooring 21d9057dbf Add images.Dither filter
Closes #8598
2024-02-11 22:51:11 +02:00
Christian Oliff 0672b5c766
all: Fix typos 2024-02-11 13:51:33 +02:00
Rosano e309f82efe
resources/page: Fix typo 2024-02-10 21:28:03 +02:00
Joe Mooring 3a665ddbf9 resources/page: Formally deprecate .Site.LastChange
Use .Site.Lastmod instead.
2024-02-03 17:11:06 +01:00
Bjørn Erik Pedersen 058f230a1b Detect now invalid path patterns in cascade
Closes #11977
2024-02-03 15:07:59 +01:00
Bjørn Erik Pedersen e33a632551 resources: Optimize reading resource Content when it's already a string 2024-02-03 15:07:59 +01:00
Bjørn Erik Pedersen 2873324898 Misc resource fixes/improvements
* Add --pprof flag to server to enable profile debugging.
* Don't cache the resource content, it seem to eat memory on bigger sites.
* Keep --printMemoryUsag running in server

Fixes #11974
2024-02-02 18:46:23 +01:00
Bjørn Erik Pedersen 6c3b6ba3e6 Improve error message when attempting to paginate from a single page template
Fixes #11953
2024-01-31 16:54:34 +01:00
Bjørn Erik Pedersen 80595bbe3e Fix recent regression .Resources.Get for resources with spaces in filename
Fixes #11944
2024-01-30 20:12:03 +01:00
Bjørn Erik Pedersen f31a6db797 Add path, kind and lang to content front matter
Note that none of these can be set via cascade (you will get an error)

Fixes #11544
2024-01-30 20:12:03 +01:00
Bjørn Erik Pedersen a795acbcd8 all: Run gofumpt -l -w . 2024-01-28 23:14:09 +01:00