From b5801d8b6add72b3fdead267237874b3a73298ce Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Wed, 16 Oct 2024 16:18:44 +0000 Subject: [PATCH 001/470] releaser: Prepare repository for 0.137.0-DEV [ci skip] --- common/hugo/version_current.go | 6 +++--- hugoreleaser.env | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 39e4dc2de..870719dcb 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 136, - PatchLevel: 1, - Suffix: "", + Minor: 137, + PatchLevel: 0, + Suffix: "-DEV", } diff --git a/hugoreleaser.env b/hugoreleaser.env index 927ff97e7..d3d21ba3d 100644 --- a/hugoreleaser.env +++ b/hugoreleaser.env @@ -1,7 +1,8 @@ # Release env. # These will be replaced by script before release. -HUGORELEASER_TAG=v0.136.0 -HUGORELEASER_COMMITISH=2939270a3bb78b3799973345c0dab7fa239cef9d +HUGORELEASER_TAG=v0.136.1 +HUGORELEASER_COMMITISH=64d1865c1e21c66feb96ffedda44a9eba2365af9 + From b5852d0e685d95ce70e03ec2b4da753b82d121cf Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:42:41 +0200 Subject: [PATCH 002/470] docker: Fix Dart Sass ARM64 arch mismatch, /cache permissions Also improve the final build step. Closes #12956 Closes #12957 Closes #12960 --- Dockerfile | 24 +++++++++++-------- scripts/docker/install_runtimedeps_default.sh | 20 ---------------- 2 files changed, 14 insertions(+), 30 deletions(-) delete mode 100755 scripts/docker/install_runtimedeps_default.sh diff --git a/Dockerfile b/Dockerfile index 394133aed..01e82dbf4 100755 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,8 @@ # Website: https://gohugo.io/ ARG GO_VERSION="1.23.2" -ARG ALPINE_VERSION=3.20 +ARG ALPINE_VERSION="3.20" +ARG DART_SASS_VERSION="1.79.3" FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.5.0 AS xx FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS gobuild @@ -45,6 +46,15 @@ RUN --mount=target=. \ xx-verify /usr/bin/hugo EOT +# dart-sass downloads the dart-sass runtime dependency +FROM alpine:${ALPINE_VERSION} AS dart-sass +ARG TARGETARCH +ARG DART_SASS_VERSION +ARG DART_ARCH=${TARGETARCH/amd64/x64} +WORKDIR /out +ADD https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-${DART_ARCH}.tar.gz . +RUN tar -xf dart-sass-${DART_SASS_VERSION}-linux-${DART_ARCH}.tar.gz + FROM gorun AS final COPY --from=build /usr/bin/hugo /usr/bin/hugo @@ -54,14 +64,13 @@ RUN apk add --no-cache \ libc6-compat \ git \ runuser \ - curl \ nodejs \ npm -RUN mkdir -p /var/hugo/bin && \ +RUN mkdir -p /var/hugo/bin /cache && \ addgroup -Sg 1000 hugo && \ adduser -Sg hugo -u 1000 -h /var/hugo hugo && \ - chown -R hugo: /var/hugo && \ + chown -R hugo: /var/hugo /cache && \ # For the Hugo's Git integration to work. runuser -u hugo -- git config --global --add safe.directory /project && \ # See https://github.com/gohugoio/hugo/issues/9810 @@ -71,15 +80,11 @@ VOLUME /project WORKDIR /project USER hugo:hugo ENV HUGO_CACHEDIR=/cache -ARG BUILDARCH -ENV BUILDARCH=${BUILDARCH} ENV PATH="/var/hugo/bin:$PATH" -COPY scripts/docker scripts/docker COPY scripts/docker/entrypoint.sh /entrypoint.sh +COPY --link --from=dart-sass /out/dart-sass /var/hugo/bin/dart-sass -# Install default dependencies. -RUN scripts/docker/install_runtimedeps_default.sh # Update PATH to reflect the new dependencies. # For more complex setups, we should probably find a way to # delegate this to the script itself, but this will have to do for now. @@ -92,4 +97,3 @@ EXPOSE 1313 ENTRYPOINT ["/entrypoint.sh"] CMD ["--help"] - diff --git a/scripts/docker/install_runtimedeps_default.sh b/scripts/docker/install_runtimedeps_default.sh deleted file mode 100755 index 0b6c2c617..000000000 --- a/scripts/docker/install_runtimedeps_default.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -set -ex - -export DART_SASS_VERSION=1.79.3 - -# If $BUILDARCH=arm64, then we need to install the arm64 version of Dart Sass, -# otherwise we install the x64 version. -ARCH="x64" -if [ "$BUILDARCH" = "arm64" ]; then - ARCH="arm64" -fi - -cd /tmp -curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-${ARCH}.tar.gz -ls -ltr -tar -xf dart-sass-${DART_SASS_VERSION}-linux-${ARCH}.tar.gz -rm dart-sass-${DART_SASS_VERSION}-linux-${ARCH}.tar.gz && \ -# The dart-sass folder is added to the PATH by the caller. -mv dart-sass /var/hugo/bin \ No newline at end of file From ad985550a4faff6bc40ce4c88b11215a9330a74e Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Thu, 17 Oct 2024 14:30:05 +0000 Subject: [PATCH 003/470] releaser: Bump versions for release of 0.136.2 [ci skip] --- common/hugo/version_current.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 870719dcb..74c0976ca 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 137, - PatchLevel: 0, - Suffix: "-DEV", + Minor: 136, + PatchLevel: 2, + Suffix: "", } From e971b7d866d8834022f0038b094dce4352338f74 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Thu, 17 Oct 2024 14:44:10 +0000 Subject: [PATCH 004/470] releaser: Prepare repository for 0.137.0-DEV [ci skip] --- common/hugo/version_current.go | 6 +++--- hugoreleaser.env | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 74c0976ca..870719dcb 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 136, - PatchLevel: 2, - Suffix: "", + Minor: 137, + PatchLevel: 0, + Suffix: "-DEV", } diff --git a/hugoreleaser.env b/hugoreleaser.env index d3d21ba3d..613eb2de0 100644 --- a/hugoreleaser.env +++ b/hugoreleaser.env @@ -1,7 +1,8 @@ # Release env. # These will be replaced by script before release. -HUGORELEASER_TAG=v0.136.1 -HUGORELEASER_COMMITISH=64d1865c1e21c66feb96ffedda44a9eba2365af9 +HUGORELEASER_TAG=v0.136.2 +HUGORELEASER_COMMITISH=ad985550a4faff6bc40ce4c88b11215a9330a74e + From 42f37b4e98e6f9621af4f1da40e831525f65fc0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 18 Oct 2024 10:30:36 +0200 Subject: [PATCH 005/470] tpl/transform: Don't fail on "no data to transform" Fixes #12964 --- tpl/transform/unmarshal.go | 3 ++- tpl/transform/unmarshal_test.go | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tpl/transform/unmarshal.go b/tpl/transform/unmarshal.go index 898085661..0068947f6 100644 --- a/tpl/transform/unmarshal.go +++ b/tpl/transform/unmarshal.go @@ -112,9 +112,10 @@ func (ns *Namespace) Unmarshal(args ...any) (any, error) { if err != nil { return nil, fmt.Errorf("type %T not supported", data) } + dataStr = strings.TrimSpace(dataStr) if dataStr == "" { - return nil, errors.New("no data to transform") + return nil, nil } key := hashing.MD5FromStringHexEncoded(dataStr) diff --git a/tpl/transform/unmarshal_test.go b/tpl/transform/unmarshal_test.go index 1b976c449..d65f05fd4 100644 --- a/tpl/transform/unmarshal_test.go +++ b/tpl/transform/unmarshal_test.go @@ -139,6 +139,8 @@ func TestUnmarshal(t *testing.T) { a;b;c`, mime: media.Builtin.CSVType}, map[string]any{"DElimiter": ";", "Comment": "%"}, func(r [][]string) { b.Assert([][]string{{"a", "b", "c"}}, qt.DeepEquals, r) }}, + {``, nil, nil}, + {` `, nil, nil}, // errors {"thisisnotavaliddataformat", nil, false}, {testContentResource{key: "r1", content: `invalid&toml"`, mime: media.Builtin.TOMLType}, nil, false}, From f5e54d9c7d6642ba5435e7342761f684c84f4b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 19 Oct 2024 10:00:01 +0200 Subject: [PATCH 006/470] common/herrors: Fix the deferred error message cleaner regexp Make it less gready. --- common/herrors/errors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/herrors/errors.go b/common/herrors/errors.go index e7f91462e..40833e55c 100644 --- a/common/herrors/errors.go +++ b/common/herrors/errors.go @@ -137,7 +137,7 @@ var nilPointerErrRe = regexp.MustCompile(`at <(.*)>: error calling (.*?): runtim const deferredPrefix = "__hdeferred/" -var deferredStringToRemove = regexp.MustCompile(`executing "__hdeferred/.*" `) +var deferredStringToRemove = regexp.MustCompile(`executing "__hdeferred/.*?" `) // ImproveRenderErr improves the error message for rendering errors. func ImproveRenderErr(inErr error) (outErr error) { From d37606d2c2174e20cfba5150812da83378078f09 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sat, 19 Oct 2024 11:13:20 -0700 Subject: [PATCH 007/470] tpl/strings: Add TrimSpace function Closes #12962 --- tpl/strings/strings.go | 11 +++++++++++ tpl/strings/strings_test.go | 27 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/tpl/strings/strings.go b/tpl/strings/strings.go index 02f9a2b1e..eb5aee3cb 100644 --- a/tpl/strings/strings.go +++ b/tpl/strings/strings.go @@ -450,6 +450,17 @@ func (ns *Namespace) Trim(s, cutset any) (string, error) { return strings.Trim(ss, sc), nil } +// TrimSpace returns the given string, removing leading and trailing whitespace +// as defined by Unicode. +func (ns *Namespace) TrimSpace(s any) (string, error) { + ss, err := cast.ToStringE(s) + if err != nil { + return "", err + } + + return strings.TrimSpace(ss), nil +} + // TrimLeft returns a slice of the string s with all leading characters // contained in cutset removed. func (ns *Namespace) TrimLeft(cutset, s any) (string, error) { diff --git a/tpl/strings/strings_test.go b/tpl/strings/strings_test.go index 4fcd3b59a..0e6039ba1 100644 --- a/tpl/strings/strings_test.go +++ b/tpl/strings/strings_test.go @@ -854,3 +854,30 @@ func TestDiff(t *testing.T) { } } + +func TestTrimSpace(t *testing.T) { + t.Parallel() + c := qt.New(t) + + for _, test := range []struct { + s any + expect any + }{ + {"\n\r test \n\r", "test"}, + {template.HTML("\n\r test \n\r"), "test"}, + {[]byte("\n\r test \n\r"), "test"}, + // errors + {tstNoStringer{}, false}, + } { + + result, err := ns.TrimSpace(test.s) + + if b, ok := test.expect.(bool); ok && !b { + c.Assert(err, qt.Not(qt.IsNil)) + continue + } + + c.Assert(err, qt.IsNil) + c.Assert(result, qt.Equals, test.expect) + } +} From 352be5ba8702017997587b3b99c42e66857b0627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sun, 20 Oct 2024 11:25:16 +0200 Subject: [PATCH 008/470] Make sure that HugoSites is always closed when done Including all the integration tests. --- commands/commandeer.go | 19 +++++++++++++++++++ commands/server.go | 4 ---- deps/deps.go | 7 +++++++ hugolib/integrationtest_builder.go | 6 ++++++ 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/commands/commandeer.go b/commands/commandeer.go index 06565d45d..ad2adf3a2 100644 --- a/commands/commandeer.go +++ b/commands/commandeer.go @@ -42,6 +42,7 @@ import ( "github.com/gohugoio/hugo/common/hugo" "github.com/gohugoio/hugo/common/loggers" "github.com/gohugoio/hugo/common/paths" + "github.com/gohugoio/hugo/common/types" "github.com/gohugoio/hugo/config" "github.com/gohugoio/hugo/config/allconfig" "github.com/gohugoio/hugo/deps" @@ -66,6 +67,12 @@ func Execute(args []string) error { } args = mapLegacyArgs(args) cd, err := x.Execute(context.Background(), args) + if cd != nil { + if closer, ok := cd.Root.Command.(types.Closer); ok { + closer.Close() + } + } + if err != nil { if err == errHelp { cd.CobraCommand.Help() @@ -149,6 +156,18 @@ func (r *rootCommand) isVerbose() bool { return r.logger.Level() <= logg.LevelInfo } +func (r *rootCommand) Close() error { + if r.hugoSites != nil { + r.hugoSites.DeleteFunc(func(key configKey, value *hugolib.HugoSites) bool { + if value != nil { + value.Close() + } + return false + }) + } + return nil +} + func (r *rootCommand) Build(cd *simplecobra.Commandeer, bcfg hugolib.BuildCfg, cfg config.Provider) (*hugolib.HugoSites, error) { h, err := r.Hugo(cfg) if err != nil { diff --git a/commands/server.go b/commands/server.go index b16bf3148..84d4165f0 100644 --- a/commands/server.go +++ b/commands/server.go @@ -1012,10 +1012,6 @@ func (c *serverCommand) serve() error { c.r.Println("Error:", err) } - if h := c.hugoTry(); h != nil { - h.Close() - } - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() wg2, ctx := errgroup.WithContext(ctx) diff --git a/deps/deps.go b/deps/deps.go index e137aed7b..4389036cb 100644 --- a/deps/deps.go +++ b/deps/deps.go @@ -98,6 +98,8 @@ type Deps struct { // TODO(bep) rethink this re. a plugin setup, but this will have to do for now. WasmDispatchers *warpc.Dispatchers + isClosed bool + *globalErrHandler } @@ -345,6 +347,11 @@ func (d *Deps) TextTmpl() tpl.TemplateParseFinder { } func (d *Deps) Close() error { + if d.isClosed { + return nil + } + d.isClosed = true + if d.MemCache != nil { d.MemCache.Stop() } diff --git a/hugolib/integrationtest_builder.go b/hugolib/integrationtest_builder.go index 551b807db..b45defb42 100644 --- a/hugolib/integrationtest_builder.go +++ b/hugolib/integrationtest_builder.go @@ -421,6 +421,12 @@ func (s *IntegrationTestBuilder) Build() *IntegrationTestBuilder { s.Assert(err, qt.IsNil) } + s.Cleanup(func() { + if h := s.H; h != nil { + s.Assert(h.Close(), qt.IsNil) + } + }) + return s } From 88d598a0493882f0361b007980569814c0be2a77 Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Mon, 21 Oct 2024 15:28:36 +0200 Subject: [PATCH 009/470] docker: Fix permission issues in Dockerfile Closes #12971 Closes #12970 --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 01e82dbf4..65c4dbfb9 100755 --- a/Dockerfile +++ b/Dockerfile @@ -76,14 +76,14 @@ RUN mkdir -p /var/hugo/bin /cache && \ # See https://github.com/gohugoio/hugo/issues/9810 runuser -u hugo -- git config --global core.quotepath false +USER hugo:hugo VOLUME /project WORKDIR /project -USER hugo:hugo ENV HUGO_CACHEDIR=/cache ENV PATH="/var/hugo/bin:$PATH" COPY scripts/docker/entrypoint.sh /entrypoint.sh -COPY --link --from=dart-sass /out/dart-sass /var/hugo/bin/dart-sass +COPY --from=dart-sass /out/dart-sass /var/hugo/bin/dart-sass # Update PATH to reflect the new dependencies. # For more complex setups, we should probably find a way to From bfa2fd683e7f0874c7f7e2198ec407a037dadf14 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Mon, 21 Oct 2024 13:31:54 +0000 Subject: [PATCH 010/470] releaser: Bump versions for release of 0.136.3 [ci skip] --- common/hugo/version_current.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 870719dcb..823797501 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 137, - PatchLevel: 0, - Suffix: "-DEV", + Minor: 136, + PatchLevel: 3, + Suffix: "", } From 31d19b505d658e35ff4b1e4390c1e0fa9e41f811 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Mon, 21 Oct 2024 13:46:41 +0000 Subject: [PATCH 011/470] releaser: Prepare repository for 0.137.0-DEV [ci skip] --- common/hugo/version_current.go | 6 +++--- hugoreleaser.env | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 823797501..870719dcb 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 136, - PatchLevel: 3, - Suffix: "", + Minor: 137, + PatchLevel: 0, + Suffix: "-DEV", } diff --git a/hugoreleaser.env b/hugoreleaser.env index 613eb2de0..66d5d0cc3 100644 --- a/hugoreleaser.env +++ b/hugoreleaser.env @@ -1,7 +1,8 @@ # Release env. # These will be replaced by script before release. -HUGORELEASER_TAG=v0.136.2 -HUGORELEASER_COMMITISH=ad985550a4faff6bc40ce4c88b11215a9330a74e +HUGORELEASER_TAG=v0.136.3 +HUGORELEASER_COMMITISH=bfa2fd683e7f0874c7f7e2198ec407a037dadf14 + From 5bbe95f9c5442898cdfb100bff4f1aac52fce5ad Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Mon, 21 Oct 2024 17:46:53 -0700 Subject: [PATCH 012/470] tpl/transform: Revert unmarshal whitespace removal Fixes #12977 --- tpl/transform/transform_integration_test.go | 20 +++++++++++++++++++- tpl/transform/unmarshal.go | 3 +-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/tpl/transform/transform_integration_test.go b/tpl/transform/transform_integration_test.go index da8290e17..5f34ff81b 100644 --- a/tpl/transform/transform_integration_test.go +++ b/tpl/transform/transform_integration_test.go @@ -248,7 +248,7 @@ func TestToMathMacros(t *testing.T) { -- hugo.toml -- disableKinds = ['page','rss','section','sitemap','taxonomy','term'] -- layouts/index.html -- -{{ $macros := dict +{{ $macros := dict "\\addBar" "\\bar{#1}" "\\bold" "\\mathbf{#1}" }} @@ -261,3 +261,21 @@ disableKinds = ['page','rss','section','sitemap','taxonomy','term'] y `) } + +// Issue #12977 +func TestUnmarshalWithIndentedYAML(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableKinds = ['page','rss','section','sitemap','taxonomy','term'] +-- layouts/index.html -- +{{ $yaml := "\n a:\n b: 1\n c:\n d: 2\n" }} +{{ $yaml | transform.Unmarshal | encoding.Jsonify }} +` + + b := hugolib.Test(t, files) + + b.AssertFileExists("public/index.html", true) + b.AssertFileContent("public/index.html", `{"a":{"b":1},"c":{"d":2}}`) +} diff --git a/tpl/transform/unmarshal.go b/tpl/transform/unmarshal.go index 0068947f6..a3a9c040a 100644 --- a/tpl/transform/unmarshal.go +++ b/tpl/transform/unmarshal.go @@ -112,9 +112,8 @@ func (ns *Namespace) Unmarshal(args ...any) (any, error) { if err != nil { return nil, fmt.Errorf("type %T not supported", data) } - dataStr = strings.TrimSpace(dataStr) - if dataStr == "" { + if strings.TrimSpace(dataStr) == "" { return nil, nil } From cb6e27b32a1d09956027b8e45bae0c18c1593d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 23 Oct 2024 19:26:13 +0200 Subject: [PATCH 013/470] hugolib/commands: Fix stuck server error issues Fixes #11378 --- commands/commandeer.go | 2 +- commands/hugobuilder.go | 58 +++++++++++-------- commands/server.go | 20 ++++--- hugolib/hugo_sites.go | 3 - hugolib/hugo_sites_build.go | 10 ---- hugolib/integrationtest_builder.go | 5 -- hugolib/page__new.go | 13 +++-- hugolib/site.go | 10 ---- .../server__error_recovery_edit_config.txt | 42 ++++++++++++++ .../server__error_recovery_edit_content.txt | 42 ++++++++++++++ tpl/template.go | 1 - tpl/tplimpl/template.go | 21 ++----- 12 files changed, 143 insertions(+), 84 deletions(-) create mode 100644 testscripts/commands/server__error_recovery_edit_config.txt create mode 100644 testscripts/commands/server__error_recovery_edit_content.txt diff --git a/commands/commandeer.go b/commands/commandeer.go index ad2adf3a2..69077ad73 100644 --- a/commands/commandeer.go +++ b/commands/commandeer.go @@ -507,7 +507,7 @@ func (r *rootCommand) createLogger(running bool) (loggers.Logger, error) { return loggers.New(optsLogger), nil } -func (r *rootCommand) Reset() { +func (r *rootCommand) resetLogs() { r.logger.Reset() loggers.Log().Reset() } diff --git a/commands/hugobuilder.go b/commands/hugobuilder.go index 42bf68a37..95129018f 100644 --- a/commands/hugobuilder.go +++ b/commands/hugobuilder.go @@ -27,7 +27,6 @@ import ( "sync/atomic" "time" - "github.com/bep/logg" "github.com/bep/simplecobra" "github.com/fsnotify/fsnotify" "github.com/gohugoio/hugo/common/herrors" @@ -136,10 +135,6 @@ func (e *hugoBuilderErrState) wasErr() bool { return e.waserr } -func (c *hugoBuilder) errCount() int { - return c.r.logger.LoggCount(logg.LevelError) + loggers.Log().LoggCount(logg.LevelError) -} - // getDirList provides NewWatcher() with a list of directories to watch for changes. func (c *hugoBuilder) getDirList() ([]string, error) { h, err := c.hugo() @@ -345,7 +340,6 @@ func (c *hugoBuilder) newWatcher(pollIntervalStr string, dirList ...string) (*wa for { select { case changes := <-c.r.changesFromBuild: - c.errState.setBuildErr(nil) unlock, err := h.LockBuild() if err != nil { c.r.logger.Errorln("Failed to acquire a build lock: %s", err) @@ -358,7 +352,7 @@ func (c *hugoBuilder) newWatcher(pollIntervalStr string, dirList ...string) (*wa } if c.s != nil && c.s.doLiveReload { doReload := c.changeDetector == nil || len(c.changeDetector.changed()) > 0 - doReload = doReload || c.showErrorInBrowser && c.errCount() > 0 + doReload = doReload || c.showErrorInBrowser && c.errState.buildErr() != nil if doReload { livereload.ForceRefresh() } @@ -372,7 +366,7 @@ func (c *hugoBuilder) newWatcher(pollIntervalStr string, dirList ...string) (*wa return } c.handleEvents(watcher, staticSyncer, evs, configSet) - if c.showErrorInBrowser && c.errCount() > 0 { + if c.showErrorInBrowser && c.errState.buildErr() != nil { // Need to reload browser to show the error livereload.ForceRefresh() } @@ -419,11 +413,17 @@ func (c *hugoBuilder) build() error { } func (c *hugoBuilder) buildSites(noBuildLock bool) (err error) { - h, err := c.hugo() + defer func() { + c.errState.setBuildErr(err) + }() + + var h *hugolib.HugoSites + h, err = c.hugo() if err != nil { - return err + return } - return h.Build(hugolib.BuildCfg{NoBuildLock: noBuildLock}) + err = h.Build(hugolib.BuildCfg{NoBuildLock: noBuildLock}) + return } func (c *hugoBuilder) copyStatic() (map[string]uint64, error) { @@ -619,6 +619,9 @@ func (c *hugoBuilder) fullRebuild(changeType string) { // Set the processing on pause until the state is recovered. c.errState.setPaused(true) c.handleBuildErr(err, "Failed to reload config") + if c.s.doLiveReload { + livereload.ForceRefresh() + } } else { c.errState.setPaused(false) } @@ -1081,37 +1084,44 @@ func (c *hugoBuilder) printChangeDetected(typ string) { c.r.logger.Println(htime.Now().Format(layout)) } -func (c *hugoBuilder) rebuildSites(events []fsnotify.Event) error { +func (c *hugoBuilder) rebuildSites(events []fsnotify.Event) (err error) { + defer func() { + c.errState.setBuildErr(err) + }() if err := c.errState.buildErr(); err != nil { ferrs := herrors.UnwrapFileErrorsWithErrorContext(err) for _, err := range ferrs { events = append(events, fsnotify.Event{Name: err.Position().Filename, Op: fsnotify.Write}) } } - c.errState.setBuildErr(nil) - h, err := c.hugo() + var h *hugolib.HugoSites + h, err = c.hugo() if err != nil { - return err + return } - - return h.Build(hugolib.BuildCfg{NoBuildLock: true, RecentlyVisited: c.visitedURLs, ErrRecovery: c.errState.wasErr()}, events...) + err = h.Build(hugolib.BuildCfg{NoBuildLock: true, RecentlyVisited: c.visitedURLs, ErrRecovery: c.errState.wasErr()}, events...) + return } -func (c *hugoBuilder) rebuildSitesForChanges(ids []identity.Identity) error { - c.errState.setBuildErr(nil) - h, err := c.hugo() +func (c *hugoBuilder) rebuildSitesForChanges(ids []identity.Identity) (err error) { + defer func() { + c.errState.setBuildErr(err) + }() + + var h *hugolib.HugoSites + h, err = c.hugo() if err != nil { - return err + return } whatChanged := &hugolib.WhatChanged{} whatChanged.Add(ids...) err = h.Build(hugolib.BuildCfg{NoBuildLock: true, WhatChanged: whatChanged, RecentlyVisited: c.visitedURLs, ErrRecovery: c.errState.wasErr()}) - c.errState.setBuildErr(err) - return err + + return } func (c *hugoBuilder) reloadConfig() error { - c.r.Reset() + c.r.resetLogs() c.r.configVersionID.Add(1) if err := c.withConfE(func(conf *commonConfig) error { diff --git a/commands/server.go b/commands/server.go index 84d4165f0..6b801b158 100644 --- a/commands/server.go +++ b/commands/server.go @@ -648,9 +648,8 @@ func (c *serverCommand) setServerInfoInConfig() error { } func (c *serverCommand) getErrorWithContext() any { - errCount := c.errCount() - - if errCount == 0 { + buildErr := c.errState.buildErr() + if buildErr == nil { return nil } @@ -659,7 +658,7 @@ func (c *serverCommand) getErrorWithContext() any { m["Error"] = cleanErrorLog(c.r.logger.Errors()) m["Version"] = hugo.BuildVersionString() - ferrors := herrors.UnwrapFileErrorsWithErrorContext(c.errState.buildErr()) + ferrors := herrors.UnwrapFileErrorsWithErrorContext(buildErr) m["Files"] = ferrors return m @@ -830,22 +829,25 @@ func (c *serverCommand) fixURL(baseURLFromConfig, baseURLFromFlag string, port i return u.String(), nil } -func (c *serverCommand) partialReRender(urls ...string) error { +func (c *serverCommand) partialReRender(urls ...string) (err error) { defer func() { c.errState.setWasErr(false) }() - c.errState.setBuildErr(nil) visited := types.NewEvictingStringQueue(len(urls)) for _, url := range urls { visited.Add(url) } - h, err := c.hugo() + var h *hugolib.HugoSites + h, err = c.hugo() if err != nil { - return err + return } + // Note: We do not set NoBuildLock as the file lock is not acquired at this stage. - return h.Build(hugolib.BuildCfg{NoBuildLock: false, RecentlyVisited: visited, PartialReRender: true, ErrRecovery: c.errState.wasErr()}) + err = h.Build(hugolib.BuildCfg{NoBuildLock: false, RecentlyVisited: visited, PartialReRender: true, ErrRecovery: c.errState.wasErr()}) + + return } func (c *serverCommand) serve() error { diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go index 659a772f2..a5186fd44 100644 --- a/hugolib/hugo_sites.go +++ b/hugolib/hugo_sites.go @@ -179,9 +179,6 @@ type hugoSitesInit struct { // Loads the data from all of the /data folders. data *lazy.Init - // Performs late initialization (before render) of the templates. - layouts *lazy.Init - // Loads the Git info and CODEOWNERS for all the pages if enabled. gitInfo *lazy.Init } diff --git a/hugolib/hugo_sites_build.go b/hugolib/hugo_sites_build.go index 65ce946e9..dd548be51 100644 --- a/hugolib/hugo_sites_build.go +++ b/hugolib/hugo_sites_build.go @@ -250,10 +250,6 @@ func (h *HugoSites) process(ctx context.Context, l logg.LevelLogger, config *Bui l = l.WithField("step", "process") defer loggers.TimeTrackf(l, time.Now(), nil, "") - if _, err := h.init.layouts.Do(ctx); err != nil { - return err - } - if len(events) > 0 { // This is a rebuild triggered from file events. return h.processPartialFileEvents(ctx, l, config, init, events) @@ -1067,8 +1063,6 @@ func (h *HugoSites) processPartialFileEvents(ctx context.Context, l logg.LevelLo } if tmplChanged || i18nChanged { - // TODO(bep) we should split this, but currently the loading of i18n and layout files are tied together. See #12048. - h.init.layouts.Reset() if err := loggers.TimeTrackfn(func() (logg.LevelLogger, error) { // TODO(bep) this could probably be optimized to somehow // only load the changed templates and its dependencies, but that is non-trivial. @@ -1141,10 +1135,6 @@ func (s *Site) handleContentAdapterChanges(bi pagesfromdata.BuildInfo, buildConf } func (h *HugoSites) processContentAdaptersOnRebuild(ctx context.Context, buildConfig *BuildCfg) error { - // Make sure the layouts are initialized. - if _, err := h.init.layouts.Do(context.Background()); err != nil { - return err - } g := rungroup.Run[*pagesfromdata.PagesFromTemplate](ctx, rungroup.Config[*pagesfromdata.PagesFromTemplate]{ NumWorkers: h.numWorkers, Handle: func(ctx context.Context, p *pagesfromdata.PagesFromTemplate) error { diff --git a/hugolib/integrationtest_builder.go b/hugolib/integrationtest_builder.go index b45defb42..b806ad7c1 100644 --- a/hugolib/integrationtest_builder.go +++ b/hugolib/integrationtest_builder.go @@ -246,11 +246,6 @@ func (s *IntegrationTestBuilder) AssertBuildCountGitInfo(count int) { s.Assert(s.H.init.gitInfo.InitCount(), qt.Equals, count) } -func (s *IntegrationTestBuilder) AssertBuildCountLayouts(count int) { - s.Helper() - s.Assert(s.H.init.layouts.InitCount(), qt.Equals, count) -} - func (s *IntegrationTestBuilder) AssertFileCount(dirname string, expected int) { s.Helper() fs := s.fs.WorkingDirReadOnly diff --git a/hugolib/page__new.go b/hugolib/page__new.go index b7d9b10f2..9a4972d07 100644 --- a/hugolib/page__new.go +++ b/hugolib/page__new.go @@ -34,6 +34,15 @@ import ( var pageIDCounter atomic.Uint64 func (h *HugoSites) newPage(m *pageMeta) (*pageState, *paths.Path, error) { + p, pth, err := h.doNewPage(m) + if err != nil { + // Make sure that any partially created page part is marked as stale. + m.MarkStale() + } + return p, pth, err +} + +func (h *HugoSites) doNewPage(m *pageMeta) (*pageState, *paths.Path, error) { m.Staler = &resources.AtomicStaler{} if m.pageMetaParams == nil { m.pageMetaParams = &pageMetaParams{ @@ -231,10 +240,6 @@ func (h *HugoSites) newPage(m *pageMeta) (*pageState, *paths.Path, error) { } return ps, nil }() - // Make sure to evict any cached and now stale data. - if err != nil { - m.MarkStale() - } if ps == nil { return nil, nil, err diff --git a/hugolib/site.go b/hugolib/site.go index 08031390b..24ee5dcc5 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -344,7 +344,6 @@ func newHugoSites(cfg deps.DepsCfg, d *deps.Deps, pageTrees *pageTrees, sites [] skipRebuildForFilenames: make(map[string]bool), init: &hugoSitesInit{ data: lazy.New(), - layouts: lazy.New(), gitInfo: lazy.New(), }, } @@ -400,15 +399,6 @@ func newHugoSites(cfg deps.DepsCfg, d *deps.Deps, pageTrees *pageTrees, sites [] return nil, nil }) - h.init.layouts.Add(func(context.Context) (any, error) { - for _, s := range h.Sites { - if err := s.Tmpl().(tpl.TemplateManager).MarkReady(); err != nil { - return nil, err - } - } - return nil, nil - }) - h.init.gitInfo.Add(func(context.Context) (any, error) { err := h.loadGitInfo() if err != nil { diff --git a/testscripts/commands/server__error_recovery_edit_config.txt b/testscripts/commands/server__error_recovery_edit_config.txt new file mode 100644 index 000000000..664d99272 --- /dev/null +++ b/testscripts/commands/server__error_recovery_edit_config.txt @@ -0,0 +1,42 @@ +# Test the hugo server command when adding an error to a config file +# and then fixing it. + +hugo server & + +waitServer + +httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1' + +replace $WORK/hugo.toml 'title =' 'titlefoo' +httpget ${HUGOTEST_BASEURL_0}p1/ 'failed' + +replace $WORK/hugo.toml 'titlefoo' 'title =' +httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1' + +stopServer + +-- hugo.toml -- +title = "Hugo Server Test" +baseURL = "https://example.org/" +disableKinds = ["taxonomy", "term", "sitemap"] +-- layouts/index.html -- +Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}| +-- layouts/_default/single.html -- +Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}| +-- content/_index.md -- +--- +title: Hugo Home +--- +-- content/p1/index.md -- +--- +title: P1 +--- +-- content/p2/index.md -- +--- +title: P2 +--- +-- static/staticfiles/static.txt -- +static + + + diff --git a/testscripts/commands/server__error_recovery_edit_content.txt b/testscripts/commands/server__error_recovery_edit_content.txt new file mode 100644 index 000000000..f5ea7e94b --- /dev/null +++ b/testscripts/commands/server__error_recovery_edit_content.txt @@ -0,0 +1,42 @@ +# Test the hugo server command when adding a front matter error to a content file +# and then fixing it. + +hugo server & + +waitServer + +httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1' + +replace $WORK/content/p1/index.md 'title:' 'titlecolon' +httpget ${HUGOTEST_BASEURL_0}p1/ 'failed' + +replace $WORK/content/p1/index.md 'titlecolon' 'title:' +httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1' + +stopServer + +-- hugo.toml -- +title = "Hugo Server Test" +baseURL = "https://example.org/" +disableKinds = ["taxonomy", "term", "sitemap"] +-- layouts/index.html -- +Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}| +-- layouts/_default/single.html -- +Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}| +-- content/_index.md -- +--- +title: Hugo Home +--- +-- content/p1/index.md -- +--- +title: P1 +--- +-- content/p2/index.md -- +--- +title: P2 +--- +-- static/staticfiles/static.txt -- +static + + + diff --git a/tpl/template.go b/tpl/template.go index cb8d2b321..18a31e231 100644 --- a/tpl/template.go +++ b/tpl/template.go @@ -40,7 +40,6 @@ type TemplateManager interface { TemplateHandler TemplateFuncGetter AddTemplate(name, tpl string) error - MarkReady() error } // TemplateVariants describes the possible variants of a template. diff --git a/tpl/tplimpl/template.go b/tpl/tplimpl/template.go index 04ccdaad2..fd07db68e 100644 --- a/tpl/tplimpl/template.go +++ b/tpl/tplimpl/template.go @@ -168,6 +168,10 @@ func newTemplateHandlers(d *deps.Deps) (*tpl.TemplateHandlers, error) { return nil, err } + if err := h.main.createPrototypes(); err != nil { + return nil, err + } + e := &templateExec{ d: d, executor: exec, @@ -312,28 +316,11 @@ func (t *templateExec) GetFunc(name string) (reflect.Value, bool) { return v, found } -func (t *templateExec) MarkReady() error { - var err error - t.readyInit.Do(func() { - // We only need the clones if base templates are in use. - if len(t.needsBaseof) > 0 { - err = t.main.createPrototypes() - if err != nil { - return - } - } - }) - - return err -} - type templateHandler struct { main *templateNamespace needsBaseof map[string]templateInfo baseof map[string]templateInfo - readyInit sync.Once - // This is the filesystem to load the templates from. All the templates are // stored in the root of this filesystem. layoutsFs afero.Fs From 46cccb021bc6425455f4eec093f5cc4a32f1d12c Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Thu, 24 Oct 2024 12:26:27 +0000 Subject: [PATCH 014/470] releaser: Bump versions for release of 0.136.5 [ci skip] --- common/hugo/version_current.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 870719dcb..095a94c50 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 137, - PatchLevel: 0, - Suffix: "-DEV", + Minor: 136, + PatchLevel: 5, + Suffix: "", } From ec3890affe55af1fa196901f446cc0e7df059da8 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Thu, 24 Oct 2024 12:41:02 +0000 Subject: [PATCH 015/470] releaser: Prepare repository for 0.137.0-DEV [ci skip] --- common/hugo/version_current.go | 6 +++--- hugoreleaser.env | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 095a94c50..870719dcb 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 136, - PatchLevel: 5, - Suffix: "", + Minor: 137, + PatchLevel: 0, + Suffix: "-DEV", } diff --git a/hugoreleaser.env b/hugoreleaser.env index 66d5d0cc3..590267381 100644 --- a/hugoreleaser.env +++ b/hugoreleaser.env @@ -1,7 +1,8 @@ # Release env. # These will be replaced by script before release. -HUGORELEASER_TAG=v0.136.3 -HUGORELEASER_COMMITISH=bfa2fd683e7f0874c7f7e2198ec407a037dadf14 +HUGORELEASER_TAG=v0.136.5 +HUGORELEASER_COMMITISH=46cccb021bc6425455f4eec093f5cc4a32f1d12c + From e10915f80af18cbe24b0f5e22922b87ce0bc74ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 26 Oct 2024 15:36:02 +0200 Subject: [PATCH 016/470] dynacache: Fix potential deadlocks on panics in GetOrCreate --- cache/dynacache/dynacache_test.go | 25 +++++++++++++++++++++++++ go.mod | 2 +- go.sum | 2 ++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/cache/dynacache/dynacache_test.go b/cache/dynacache/dynacache_test.go index a58a8d94b..9a932729b 100644 --- a/cache/dynacache/dynacache_test.go +++ b/cache/dynacache/dynacache_test.go @@ -14,8 +14,10 @@ package dynacache import ( + "fmt" "path/filepath" "testing" + "time" qt "github.com/frankban/quicktest" "github.com/gohugoio/hugo/common/loggers" @@ -165,6 +167,29 @@ func TestClear(t *testing.T) { cache.adjustCurrentMaxSize() } +func TestPanicInCreate(t *testing.T) { + t.Parallel() + c := qt.New(t) + cache := newTestCache(t) + + p1 := GetOrCreatePartition[string, testItem](cache, "/aaaa/bbbb", OptionsPartition{Weight: 30, ClearWhen: ClearOnRebuild}) + + for i := 0; i < 3; i++ { + for j := 0; j < 3; j++ { + _, err := p1.GetOrCreate(fmt.Sprintf("panic1-%d", i), func(string) (testItem, error) { + panic("failed") + }) + + c.Assert(err, qt.Not(qt.IsNil)) + + _, err = p1.GetOrCreateWitTimeout(fmt.Sprintf("panic2-%d", i), 10*time.Second, func(string) (testItem, error) { + panic("failed") + }) + c.Assert(err, qt.Not(qt.IsNil)) + } + } +} + func TestAdjustCurrentMaxSize(t *testing.T) { t.Parallel() c := qt.New(t) diff --git a/go.mod b/go.mod index 392119e17..3f5d4a707 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/bep/gowebp v0.3.0 github.com/bep/helpers v0.5.0 github.com/bep/imagemeta v0.8.1 - github.com/bep/lazycache v0.4.0 + github.com/bep/lazycache v0.6.0 github.com/bep/logg v0.4.0 github.com/bep/mclib v1.20400.20402 github.com/bep/overlayfs v0.9.2 diff --git a/go.sum b/go.sum index 6f3e61e89..6346fb099 100644 --- a/go.sum +++ b/go.sum @@ -143,6 +143,8 @@ github.com/bep/imagemeta v0.8.1 h1:tjZLPRftjxU7PTI87o5e5WKOFQ4S9S0engiP1OTpJTI= github.com/bep/imagemeta v0.8.1/go.mod h1:5piPAq5Qomh07m/dPPCLN3mDJyFusvUG7VwdRD/vX0s= github.com/bep/lazycache v0.4.0 h1:X8yVyWNVupPd4e1jV7efi3zb7ZV/qcjKQgIQ5aPbkYI= github.com/bep/lazycache v0.4.0/go.mod h1:NmRm7Dexh3pmR1EignYR8PjO2cWybFQ68+QgY3VMCSc= +github.com/bep/lazycache v0.6.0 h1:0vCgFo7TBtMQpSx64jnH1sagmw0ZougIFRpsqPHTa5U= +github.com/bep/lazycache v0.6.0/go.mod h1:NmRm7Dexh3pmR1EignYR8PjO2cWybFQ68+QgY3VMCSc= github.com/bep/logg v0.4.0 h1:luAo5mO4ZkhA5M1iDVDqDqnBBnlHjmtZF6VAyTp+nCQ= github.com/bep/logg v0.4.0/go.mod h1:Ccp9yP3wbR1mm++Kpxet91hAZBEQgmWgFgnXX3GkIV0= github.com/bep/mclib v1.20400.20402 h1:olpCE2WSPpOAbFE1R4hnftSEmQ34+xzy2HRzd0m69rA= From 62567d38205a61134a6822d37a534520772419f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sun, 27 Oct 2024 10:31:59 +0100 Subject: [PATCH 017/470] deps: Upgrade github.com/bep/lazycache v0.6.0 => v0.7.0 --- cache/dynacache/dynacache.go | 25 +++++++++++++---- cache/dynacache/dynacache_test.go | 46 +++++++++++++++++++++++++------ go.mod | 2 +- go.sum | 2 ++ 4 files changed, 60 insertions(+), 15 deletions(-) diff --git a/cache/dynacache/dynacache.go b/cache/dynacache/dynacache.go index 5007e27ba..a906a0dd3 100644 --- a/cache/dynacache/dynacache.go +++ b/cache/dynacache/dynacache.go @@ -430,12 +430,25 @@ func (p *Partition[K, V]) doGetOrCreateWitTimeout(key K, duration time.Duration, errch := make(chan error, 1) go func() { - v, _, err := p.c.GetOrCreate(key, create) - if err != nil { - errch <- err - return - } - resultch <- v + var ( + v V + err error + ) + defer func() { + if r := recover(); r != nil { + if rerr, ok := r.(error); ok { + err = rerr + } else { + err = fmt.Errorf("panic: %v", r) + } + } + if err != nil { + errch <- err + } else { + resultch <- v + } + }() + v, _, err = p.c.GetOrCreate(key, create) }() select { diff --git a/cache/dynacache/dynacache_test.go b/cache/dynacache/dynacache_test.go index 9a932729b..87239479b 100644 --- a/cache/dynacache/dynacache_test.go +++ b/cache/dynacache/dynacache_test.go @@ -14,6 +14,7 @@ package dynacache import ( + "errors" "fmt" "path/filepath" "testing" @@ -174,18 +175,47 @@ func TestPanicInCreate(t *testing.T) { p1 := GetOrCreatePartition[string, testItem](cache, "/aaaa/bbbb", OptionsPartition{Weight: 30, ClearWhen: ClearOnRebuild}) + willPanic := func(i int) func() { + return func() { + p1.GetOrCreate(fmt.Sprintf("panic-%d", i), func(key string) (testItem, error) { + panic(errors.New(key)) + }) + } + } + + // GetOrCreateWitTimeout needs to recover from panics in the create func. + willErr := func(i int) error { + _, err := p1.GetOrCreateWitTimeout(fmt.Sprintf("error-%d", i), 10*time.Second, func(key string) (testItem, error) { + return testItem{}, errors.New(key) + }) + return err + } + for i := 0; i < 3; i++ { for j := 0; j < 3; j++ { - _, err := p1.GetOrCreate(fmt.Sprintf("panic1-%d", i), func(string) (testItem, error) { - panic("failed") - }) + c.Assert(willPanic(i), qt.PanicMatches, fmt.Sprintf("panic-%d", i)) + c.Assert(willErr(i), qt.ErrorMatches, fmt.Sprintf("error-%d", i)) + } + } - c.Assert(err, qt.Not(qt.IsNil)) - - _, err = p1.GetOrCreateWitTimeout(fmt.Sprintf("panic2-%d", i), 10*time.Second, func(string) (testItem, error) { - panic("failed") + // Test the same keys again without the panic. + for i := 0; i < 3; i++ { + for j := 0; j < 3; j++ { + v, err := p1.GetOrCreate(fmt.Sprintf("panic-%d", i), func(key string) (testItem, error) { + return testItem{ + name: key, + }, nil }) - c.Assert(err, qt.Not(qt.IsNil)) + c.Assert(err, qt.IsNil) + c.Assert(v.name, qt.Equals, fmt.Sprintf("panic-%d", i)) + + v, err = p1.GetOrCreateWitTimeout(fmt.Sprintf("error-%d", i), 10*time.Second, func(key string) (testItem, error) { + return testItem{ + name: key, + }, nil + }) + c.Assert(err, qt.IsNil) + c.Assert(v.name, qt.Equals, fmt.Sprintf("error-%d", i)) } } } diff --git a/go.mod b/go.mod index 3f5d4a707..108241dc5 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/bep/gowebp v0.3.0 github.com/bep/helpers v0.5.0 github.com/bep/imagemeta v0.8.1 - github.com/bep/lazycache v0.6.0 + github.com/bep/lazycache v0.7.0 github.com/bep/logg v0.4.0 github.com/bep/mclib v1.20400.20402 github.com/bep/overlayfs v0.9.2 diff --git a/go.sum b/go.sum index 6346fb099..cfc34880b 100644 --- a/go.sum +++ b/go.sum @@ -145,6 +145,8 @@ github.com/bep/lazycache v0.4.0 h1:X8yVyWNVupPd4e1jV7efi3zb7ZV/qcjKQgIQ5aPbkYI= github.com/bep/lazycache v0.4.0/go.mod h1:NmRm7Dexh3pmR1EignYR8PjO2cWybFQ68+QgY3VMCSc= github.com/bep/lazycache v0.6.0 h1:0vCgFo7TBtMQpSx64jnH1sagmw0ZougIFRpsqPHTa5U= github.com/bep/lazycache v0.6.0/go.mod h1:NmRm7Dexh3pmR1EignYR8PjO2cWybFQ68+QgY3VMCSc= +github.com/bep/lazycache v0.7.0 h1:VM257SkkjcR9z55eslXTkUIX8QMNKoqQRNKV/4xIkCY= +github.com/bep/lazycache v0.7.0/go.mod h1:NmRm7Dexh3pmR1EignYR8PjO2cWybFQ68+QgY3VMCSc= github.com/bep/logg v0.4.0 h1:luAo5mO4ZkhA5M1iDVDqDqnBBnlHjmtZF6VAyTp+nCQ= github.com/bep/logg v0.4.0/go.mod h1:Ccp9yP3wbR1mm++Kpxet91hAZBEQgmWgFgnXX3GkIV0= github.com/bep/mclib v1.20400.20402 h1:olpCE2WSPpOAbFE1R4hnftSEmQ34+xzy2HRzd0m69rA= From 89bd025ebfd2c559039826641702941fc35a7fdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 30 Oct 2024 09:29:38 +0100 Subject: [PATCH 018/470] Build without the deploy feature by default Build tags setup changed to: * !nodeploy => withdeploy * nodeploy => !withdeploy Also move the deploy feature out into its own release archives. See #12994 for the primary motivation for this change. But this also greatly reduces the number of dependencies in Hugo when you don't need this feature and cuts the binary size greatly. Fixes #12994 --- .github/workflows/test.yml | 6 ++-- .gitignore | 4 ++- Dockerfile | 4 +-- commands/deploy.go | 17 ++--------- commands/deploy_off.go | 7 +++-- deploy/cloudfront.go | 4 +-- deploy/deploy.go | 4 +-- deploy/deploy_azure.go | 4 +-- deploy/deploy_test.go | 4 +-- deploy/deployconfig/deployConfig_test.go | 4 +-- deploy/google.go | 4 +-- hugoreleaser.toml | 22 ++++++++++++++ magefile.go | 2 +- main_withdeploy_test.go | 29 +++++++++++++++++++ testscripts/commands/gen.txt | 5 ---- .../{commands => withdeploy}/deploy.txt | 0 16 files changed, 78 insertions(+), 42 deletions(-) create mode 100644 main_withdeploy_test.go rename testscripts/{commands => withdeploy}/deploy.txt (100%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b513863c5..05d9d23a2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -112,17 +112,17 @@ jobs: sass --version; mage -v check; env: - HUGO_BUILD_TAGS: extended + HUGO_BUILD_TAGS: extended,withdeploy - if: matrix.os == 'windows-latest' # See issue #11052. We limit the build to regular test (no -race flag) on Windows for now. name: Test run: | mage -v test; env: - HUGO_BUILD_TAGS: extended + HUGO_BUILD_TAGS: extended,withdeploy - name: Build tags run: | - go install -tags extended,nodeploy + go install -tags extended - if: matrix.os == 'ubuntu-latest' name: Build for dragonfly run: | diff --git a/.gitignore b/.gitignore index b170fe204..a1fa54656 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.test -imports.* \ No newline at end of file +imports.* +dist/ +public/ diff --git a/Dockerfile b/Dockerfile index 65c4dbfb9..6d1bf78c4 100755 --- a/Dockerfile +++ b/Dockerfile @@ -21,8 +21,8 @@ COPY --from=xx / / ARG TARGETPLATFORM RUN xx-apk add musl-dev gcc g++ -# Optionally set HUGO_BUILD_TAGS to "none" or "nodeploy" when building like so: -# docker build --build-arg HUGO_BUILD_TAGS=nodeploy . +# Optionally set HUGO_BUILD_TAGS to "none" or "withdeploy" when building like so: +# docker build --build-arg HUGO_BUILD_TAGS=withdeploy . # # We build the extended version by default. ARG HUGO_BUILD_TAGS="extended" diff --git a/commands/deploy.go b/commands/deploy.go index f0bc670ca..f9c22be48 100644 --- a/commands/deploy.go +++ b/commands/deploy.go @@ -11,21 +11,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !nodeploy -// +build !nodeploy - -// Copyright 2024 The Hugo Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +//go:build withdeploy +// +build withdeploy package commands diff --git a/commands/deploy_off.go b/commands/deploy_off.go index 8a481bd96..7eb6429c5 100644 --- a/commands/deploy_off.go +++ b/commands/deploy_off.go @@ -11,8 +11,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build nodeploy -// +build nodeploy +//go:build !withdeploy +// +build !withdeploy // Copyright 2024 The Hugo Authors. All rights reserved. // @@ -31,6 +31,7 @@ package commands import ( "context" + "errors" "github.com/bep/simplecobra" "github.com/spf13/cobra" @@ -40,7 +41,7 @@ func newDeployCommand() simplecobra.Commander { return &simpleCommand{ name: "deploy", run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error { - return nil + return errors.New("deploy not supported in this version of Hugo; install a release with 'withdeploy' in the archive filename or build yourself with the 'withdeploy' build tag. Also see https://github.com/gohugoio/hugo/pull/12995") }, withc: func(cmd *cobra.Command, r *rootCommand) { cmd.Hidden = true diff --git a/deploy/cloudfront.go b/deploy/cloudfront.go index 4481eb52a..29c0a7f8c 100644 --- a/deploy/cloudfront.go +++ b/deploy/cloudfront.go @@ -11,8 +11,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !nodeploy -// +build !nodeploy +//go:build withdeploy +// +build withdeploy package deploy diff --git a/deploy/deploy.go b/deploy/deploy.go index a69e974b7..0c379ffb8 100644 --- a/deploy/deploy.go +++ b/deploy/deploy.go @@ -11,8 +11,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !nodeploy -// +build !nodeploy +//go:build withdeploy +// +build withdeploy package deploy diff --git a/deploy/deploy_azure.go b/deploy/deploy_azure.go index fc7daca3b..521d8f094 100644 --- a/deploy/deploy_azure.go +++ b/deploy/deploy_azure.go @@ -11,8 +11,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !solaris && !nodeploy -// +build !solaris,!nodeploy +//go:build !solaris && withdeploy +// +build !solaris,withdeploy package deploy diff --git a/deploy/deploy_test.go b/deploy/deploy_test.go index 17dffc25a..f290d6c81 100644 --- a/deploy/deploy_test.go +++ b/deploy/deploy_test.go @@ -11,8 +11,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !nodeploy -// +build !nodeploy +//go:build withdeploy +// +build withdeploy package deploy diff --git a/deploy/deployconfig/deployConfig_test.go b/deploy/deployconfig/deployConfig_test.go index 0b92a5cb1..8a3ad2d8a 100644 --- a/deploy/deployconfig/deployConfig_test.go +++ b/deploy/deployconfig/deployConfig_test.go @@ -11,8 +11,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !nodeploy -// +build !nodeploy +//go:build withdeploy +// +build withdeploy package deployconfig diff --git a/deploy/google.go b/deploy/google.go index 6e492bc01..e4683aa81 100644 --- a/deploy/google.go +++ b/deploy/google.go @@ -11,8 +11,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !nodeploy -// +build !nodeploy +//go:build withdeploy +// +build withdeploy package deploy diff --git a/hugoreleaser.toml b/hugoreleaser.toml index d516bd34b..8c3693739 100644 --- a/hugoreleaser.toml +++ b/hugoreleaser.toml @@ -119,6 +119,24 @@ archive_alias_replacements = { "linux-amd64.tar.gz" = "Linux-64bit.tar.gz" } [[builds.os.archs]] goarch = "amd64" +[[builds]] + path = "container1/unix/extended-withdeploy" + + [builds.build_settings] + flags = ["-buildmode", "exe", "-tags", "extended,withdeploy"] + env = ["CGO_ENABLED=1"] + + [[builds.os]] + goos = "darwin" + [builds.os.build_settings] + env = ["CGO_ENABLED=1", "CC=o64-clang", "CXX=o64-clang++"] + [[builds.os.archs]] + goarch = "universal" + [[builds.os]] + goos = "linux" + [[builds.os.archs]] + goarch = "amd64" + [[builds]] path = "container2/linux/extended" @@ -173,6 +191,10 @@ archive_alias_replacements = { "linux-amd64.tar.gz" = "Linux-64bit.tar.gz" } paths = ["builds/container1/unix/extended/**"] [archives.archive_settings] name_template = "{{ .Project }}_extended_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" +[[archives]] + paths = ["builds/container1/unix/extended-withdeploy/**"] + [archives.archive_settings] + name_template = "{{ .Project }}_extended_withdeploy_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" [[archives]] # Only extended builds in container2. paths = ["builds/container2/**"] diff --git a/magefile.go b/magefile.go index 142b9160a..9919e0185 100644 --- a/magefile.go +++ b/magefile.go @@ -334,7 +334,7 @@ func buildFlags() []string { func buildTags() string { // To build the extended Hugo SCSS/SASS enabled version, build with // HUGO_BUILD_TAGS=extended mage install etc. - // To build without `hugo deploy` for smaller binary, use HUGO_BUILD_TAGS=nodeploy + // To build with `hugo deploy`, use HUGO_BUILD_TAGS=withdeploy if envtags := os.Getenv("HUGO_BUILD_TAGS"); envtags != "" { return envtags } diff --git a/main_withdeploy_test.go b/main_withdeploy_test.go new file mode 100644 index 000000000..de50313c3 --- /dev/null +++ b/main_withdeploy_test.go @@ -0,0 +1,29 @@ +// Copyright 2024 The Hugo Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build withdeploy +// +build withdeploy + +package main + +import ( + "testing" + + "github.com/rogpeppe/go-internal/testscript" +) + +func TestWithdeploy(t *testing.T) { + p := commonTestScriptsParam + p.Dir = "testscripts/withdeploy" + testscript.Run(t, p) +} diff --git a/testscripts/commands/gen.txt b/testscripts/commands/gen.txt index b8fe9d2dc..092b4e129 100644 --- a/testscripts/commands/gen.txt +++ b/testscripts/commands/gen.txt @@ -1,17 +1,12 @@ # Test the gen commands. -# Note that adding new commands will require updating the NUM_COMMANDS value. -env NUM_COMMANDS=44 hugo gen -h stdout 'Generate documentation for your project using Hugo''s documentation engine, including syntax highlighting for various programming languages\.' - hugo gen doc --dir clidocs -checkfilecount $NUM_COMMANDS clidocs hugo gen man -h stdout 'up-to-date man pages' hugo gen man --dir manpages -checkfilecount $NUM_COMMANDS manpages hugo gen chromastyles -h stdout 'Generate CSS stylesheet for the Chroma code highlighter' diff --git a/testscripts/commands/deploy.txt b/testscripts/withdeploy/deploy.txt similarity index 100% rename from testscripts/commands/deploy.txt rename to testscripts/withdeploy/deploy.txt From 1ec6fa36c0d3d8599bb37d7b033fefce4650ddf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 1 Nov 2024 10:16:05 +0100 Subject: [PATCH 019/470] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b9ad14d01..b1beabb0f 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,8 @@ See the [features] section of the documentation for a comprehensive summary of H Linode     Route Planning & Route Optimization Software +     + The complete IDE crafted for professional Go developers.

## Installation From e3304db61756e8563ab0a3326ea93846676dc42e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 1 Nov 2024 11:43:36 +0100 Subject: [PATCH 020/470] deps: Upgrade github.com/bep/godartsass/v2 v2.1.0 => v2.2.0 --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 108241dc5..4b1d53a1b 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/bep/gitmap v1.6.0 github.com/bep/goat v0.5.0 github.com/bep/godartsass v1.2.0 - github.com/bep/godartsass/v2 v2.1.0 + github.com/bep/godartsass/v2 v2.2.0 github.com/bep/golibsass v1.2.0 github.com/bep/gowebp v0.3.0 github.com/bep/helpers v0.5.0 diff --git a/go.sum b/go.sum index cfc34880b..cc8b23683 100644 --- a/go.sum +++ b/go.sum @@ -133,6 +133,8 @@ github.com/bep/godartsass v1.2.0 h1:E2VvQrxAHAFwbjyOIExAMmogTItSKodoKuijNrGm5yU= github.com/bep/godartsass v1.2.0/go.mod h1:6LvK9RftsXMxGfsA0LDV12AGc4Jylnu6NgHL+Q5/pE8= github.com/bep/godartsass/v2 v2.1.0 h1:fq5Y1xYf4diu4tXABiekZUCA+5l/dmNjGKCeQwdy+s0= github.com/bep/godartsass/v2 v2.1.0/go.mod h1:AcP8QgC+OwOXEq6im0WgDRYK7scDsmZCEW62o1prQLo= +github.com/bep/godartsass/v2 v2.2.0 h1:3hO9Dt4BOnxkKmRxc+OpoKVFrDvBycpSCXEdElVAMVI= +github.com/bep/godartsass/v2 v2.2.0/go.mod h1:AcP8QgC+OwOXEq6im0WgDRYK7scDsmZCEW62o1prQLo= github.com/bep/golibsass v1.2.0 h1:nyZUkKP/0psr8nT6GR2cnmt99xS93Ji82ZD9AgOK6VI= github.com/bep/golibsass v1.2.0/go.mod h1:DL87K8Un/+pWUS75ggYv41bliGiolxzDKWJAq3eJ1MA= github.com/bep/gowebp v0.3.0 h1:MhmMrcf88pUY7/PsEhMgEP0T6fDUnRTMpN8OclDrbrY= From 72352f205afeef8310dcc276fc7a72db311a1621 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sat, 19 Oct 2024 10:28:37 -0700 Subject: [PATCH 021/470] github: Adjust test workflow to install Dart Sass v1.80.3 --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 05d9d23a2..fb9d71f06 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,10 +6,10 @@ name: Test env: GOPROXY: https://proxy.golang.org GO111MODULE: on - SASS_VERSION: 1.63.2 - DART_SASS_SHA_LINUX: 3ea33c95ad5c35fda6e9a0956199eef38a398f496cfb8750e02479d7d1dd42af - DART_SASS_SHA_MACOS: 11c70f259836b250b44a9cb57fed70e030f21f45069b467d371685855f1eb4f0 - DART_SASS_SHA_WINDOWS: cd8cd36a619dd8e27f93d3186c52d70eb7d69472aa6c85f5094b29693e773f64 + SASS_VERSION: 1.80.3 + DART_SASS_SHA_LINUX: 7c933edbad0a7d389192c5b79393485c088bd2c4398e32f5754c32af006a9ffd + DART_SASS_SHA_MACOS: 79e060b0e131c3bb3c16926bafc371dc33feab122bfa8c01aa337a072097967b + DART_SASS_SHA_WINDOWS: 0bc4708b37cd1bac4740e83ac5e3176e66b774f77fd5dd364da5b5cfc9bfb469 permissions: contents: read jobs: From 889308dd854b0907069d7bc6dd44ed760bc6e819 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Fri, 18 Oct 2024 16:10:46 -0700 Subject: [PATCH 022/470] resources: Address Dart Sass deprecation of global built-in functions See https://github.com/sass/dart-sass/releases/tag/1.80.0 Fixes #12961 --- .../tocss/dartsass/transform.go | 4 +- .../tocss/{internal => }/sass/helpers.go | 21 +++++++-- .../tocss/{internal => }/sass/helpers_test.go | 0 .../resource_transformers/tocss/scss/tocss.go | 4 +- tpl/css/css.go | 17 +++---- tpl/resources/resources_integration_test.go | 44 +++++++++++++++++++ 6 files changed, 71 insertions(+), 19 deletions(-) rename resources/resource_transformers/tocss/{internal => }/sass/helpers.go (75%) rename resources/resource_transformers/tocss/{internal => }/sass/helpers_test.go (100%) diff --git a/resources/resource_transformers/tocss/dartsass/transform.go b/resources/resource_transformers/tocss/dartsass/transform.go index f0bd6634a..d8b6ae5b4 100644 --- a/resources/resource_transformers/tocss/dartsass/transform.go +++ b/resources/resource_transformers/tocss/dartsass/transform.go @@ -29,7 +29,7 @@ import ( "github.com/gohugoio/hugo/resources" "github.com/gohugoio/hugo/resources/internal" - "github.com/gohugoio/hugo/resources/resource_transformers/tocss/internal/sass" + "github.com/gohugoio/hugo/resources/resource_transformers/tocss/sass" "github.com/spf13/afero" @@ -85,7 +85,7 @@ func (t *transform) Transform(ctx *resources.ResourceTransformationCtx) error { c: t.c, dependencyManager: ctx.DependencyManager, - varsStylesheet: godartsass.Import{Content: sass.CreateVarsStyleSheet(opts.Vars)}, + varsStylesheet: godartsass.Import{Content: sass.CreateVarsStyleSheet(sass.TranspilerDart, opts.Vars)}, }, OutputStyle: godartsass.ParseOutputStyle(opts.OutputStyle), EnableSourceMap: opts.EnableSourceMap, diff --git a/resources/resource_transformers/tocss/internal/sass/helpers.go b/resources/resource_transformers/tocss/sass/helpers.go similarity index 75% rename from resources/resource_transformers/tocss/internal/sass/helpers.go rename to resources/resource_transformers/tocss/sass/helpers.go index c1cef141e..d4091a39c 100644 --- a/resources/resource_transformers/tocss/internal/sass/helpers.go +++ b/resources/resource_transformers/tocss/sass/helpers.go @@ -24,9 +24,14 @@ import ( const ( HugoVarsNamespace = "hugo:vars" + // Transpiler implementation can be controlled from the client by + // setting the 'transpiler' option. + // Default is currently 'libsass', but that may change. + TranspilerDart = "dartsass" + TranspilerLibSass = "libsass" ) -func CreateVarsStyleSheet(vars map[string]any) string { +func CreateVarsStyleSheet(transpiler string, vars map[string]any) string { if vars == nil { return "" } @@ -49,12 +54,22 @@ func CreateVarsStyleSheet(vars map[string]any) string { varsSlice = append(varsSlice, fmt.Sprintf("%s%s: %v;", prefix, k, v)) } else { // unquote will preserve quotes around URLs etc. if needed. - varsSlice = append(varsSlice, fmt.Sprintf("%s%s: unquote(%q);", prefix, k, v)) + if transpiler == TranspilerDart { + varsSlice = append(varsSlice, fmt.Sprintf("%s%s: string.unquote(%q);", prefix, k, v)) + } else { + varsSlice = append(varsSlice, fmt.Sprintf("%s%s: unquote(%q);", prefix, k, v)) + } } } } sort.Strings(varsSlice) - varsStylesheet = strings.Join(varsSlice, "\n") + + if transpiler == TranspilerDart { + varsStylesheet = `@use "sass:string";` + "\n" + strings.Join(varsSlice, "\n") + } else { + varsStylesheet = strings.Join(varsSlice, "\n") + } + return varsStylesheet } diff --git a/resources/resource_transformers/tocss/internal/sass/helpers_test.go b/resources/resource_transformers/tocss/sass/helpers_test.go similarity index 100% rename from resources/resource_transformers/tocss/internal/sass/helpers_test.go rename to resources/resource_transformers/tocss/sass/helpers_test.go diff --git a/resources/resource_transformers/tocss/scss/tocss.go b/resources/resource_transformers/tocss/scss/tocss.go index 36ef2a77d..4b9c51ce0 100644 --- a/resources/resource_transformers/tocss/scss/tocss.go +++ b/resources/resource_transformers/tocss/scss/tocss.go @@ -31,7 +31,7 @@ import ( "github.com/gohugoio/hugo/identity" "github.com/gohugoio/hugo/media" "github.com/gohugoio/hugo/resources" - "github.com/gohugoio/hugo/resources/resource_transformers/tocss/internal/sass" + "github.com/gohugoio/hugo/resources/resource_transformers/tocss/sass" ) // Used in tests. This feature requires Hugo to be built with the extended tag. @@ -64,7 +64,7 @@ func (t *toCSSTransformation) Transform(ctx *resources.ResourceTransformationCtx } } - varsStylesheet := sass.CreateVarsStyleSheet(options.from.Vars) + varsStylesheet := sass.CreateVarsStyleSheet(sass.TranspilerLibSass, options.from.Vars) // To allow for overrides of SCSS files anywhere in the project/theme hierarchy, we need // to help libsass revolve the filename by looking in the composite filesystem first. diff --git a/tpl/css/css.go b/tpl/css/css.go index 48a526c17..199deda69 100644 --- a/tpl/css/css.go +++ b/tpl/css/css.go @@ -15,6 +15,7 @@ import ( "github.com/gohugoio/hugo/resources/resource_transformers/babel" "github.com/gohugoio/hugo/resources/resource_transformers/cssjs" "github.com/gohugoio/hugo/resources/resource_transformers/tocss/dartsass" + "github.com/gohugoio/hugo/resources/resource_transformers/tocss/sass" "github.com/gohugoio/hugo/resources/resource_transformers/tocss/scss" "github.com/gohugoio/hugo/tpl/internal" "github.com/gohugoio/hugo/tpl/internal/resourcehelpers" @@ -84,21 +85,13 @@ func (ns *Namespace) Sass(args ...any) (resource.Resource, error) { return nil, errors.New("must not provide more arguments than resource object and options") } - const ( - // Transpiler implementation can be controlled from the client by - // setting the 'transpiler' option. - // Default is currently 'libsass', but that may change. - transpilerDart = "dartsass" - transpilerLibSass = "libsass" - ) - var ( r resources.ResourceTransformer m map[string]any targetPath string err error ok bool - transpiler = transpilerLibSass + transpiler = sass.TranspilerLibSass ) r, targetPath, ok = resourcehelpers.ResolveIfFirstArgIsString(args) @@ -113,15 +106,15 @@ func (ns *Namespace) Sass(args ...any) (resource.Resource, error) { if m != nil { if t, _, found := maps.LookupEqualFold(m, "transpiler"); found { switch t { - case transpilerDart, transpilerLibSass: + case sass.TranspilerDart, sass.TranspilerLibSass: transpiler = cast.ToString(t) default: - return nil, fmt.Errorf("unsupported transpiler %q; valid values are %q or %q", t, transpilerLibSass, transpilerDart) + return nil, fmt.Errorf("unsupported transpiler %q; valid values are %q or %q", t, sass.TranspilerLibSass, sass.TranspilerDart) } } } - if transpiler == transpilerLibSass { + if transpiler == sass.TranspilerLibSass { var options scss.Options if targetPath != "" { options.TargetPath = paths.ToSlashTrimLeading(targetPath) diff --git a/tpl/resources/resources_integration_test.go b/tpl/resources/resources_integration_test.go index cfd03dc73..563b3c455 100644 --- a/tpl/resources/resources_integration_test.go +++ b/tpl/resources/resources_integration_test.go @@ -18,6 +18,8 @@ import ( qt "github.com/frankban/quicktest" "github.com/gohugoio/hugo/hugolib" + "github.com/gohugoio/hugo/resources/resource_transformers/tocss/dartsass" + "github.com/gohugoio/hugo/resources/resource_transformers/tocss/scss" ) func TestCopy(t *testing.T) { @@ -238,3 +240,45 @@ match /files/C*: 2| b.AssertFileContent("public/files/b.txt", "I am b.txt") b.AssertFileContent("public/files/C.txt", "I am C.txt") } + +// Issue #12961 +func TestDartSassVars(t *testing.T) { + t.Parallel() + + if !scss.Supports() || !dartsass.Supports() { + t.Skip() + } + + files := ` +-- hugo.toml -- +disableKinds = ['page','section','rss','sitemap','taxonomy','term'] +-- layouts/index.html -- +{{ $opts := dict "transpiler" "dartsass" "outputStyle" "compressed" "vars" (dict "color" "red") }} +{{ with resources.Get "dartsass.scss" | css.Sass $opts }} + {{ .Content }} +{{ end }} + +{{ $opts := dict "transpiler" "libsass" "outputStyle" "compressed" "vars" (dict "color" "blue") }} +{{ with resources.Get "libsass.scss" | css.Sass $opts }} + {{ .Content }} +{{ end }} +-- assets/dartsass.scss -- +@use "hugo:vars" as v; +.dartsass { + color: v.$color; +} +-- assets/libsass.scss -- +@import "hugo:vars"; +.libsass { + color: $color; +} +` + + b := hugolib.Test(t, files, hugolib.TestOptWarn()) + + b.AssertFileContent("public/index.html", + ".dartsass{color:red}", + ".libsass{color:blue}", + ) + b.AssertLogContains("! WARN Dart Sass: hugo:vars") +} From 5fc16390355f32b336836163907fc215034f5b73 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Fri, 1 Nov 2024 21:10:52 -0700 Subject: [PATCH 023/470] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index b1beabb0f..97afe32fd 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,7 @@ A fast and flexible static site generator built with love by [bep], [spf13], and [![Tests on Linux, MacOS and Windows](https://github.com/gohugoio/hugo/workflows/Test/badge.svg)](https://github.com/gohugoio/hugo/actions?query=workflow%3ATest) [![Go Report Card](https://goreportcard.com/badge/github.com/gohugoio/hugo)](https://goreportcard.com/report/github.com/gohugoio/hugo) -[Website] | [Installation] | [Documentation] | [Support] | [Contributing] | Mastodon | X - +[Website] | [Installation] | [Documentation] | [Support] | [Contributing] | Mastodon ## Overview Hugo is a [static site generator] written in [Go], optimized for speed and designed for flexibility. With its advanced templating system and fast asset pipelines, Hugo renders a complete site in seconds, often less. From 1f23b4949c70a2a8f2084fa937e19e93a9fe890a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 30 Oct 2024 18:10:09 +0100 Subject: [PATCH 024/470] Fix some RenderShortcodes error cases This issue fixes two cases where `{{__hugo_ctx` artifacts were left in the rendered output: 1. Inclusion when `.RenderShortcodes` is wrapped in HTML. 2. Inclusion of Markdown file without a trailing newline in some cases. Closes #12854 Updates #12998 --- common/constants/constants.go | 1 + hugolib/collections_test.go | 16 +-- hugolib/integrationtest_builder.go | 23 ++++ hugolib/menu_test.go | 124 +++--------------- hugolib/page.go | 19 ++- hugolib/rendershortcodes_test.go | 112 ++++++++++++++++ hugolib/shortcode_page.go | 4 + markup/goldmark/convert.go | 2 +- markup/goldmark/goldmark_integration_test.go | 2 +- markup/goldmark/hugocontext/hugocontext.go | 111 +++++++++++++--- .../goldmark/hugocontext/hugocontext_test.go | 2 +- resources/page/page.go | 2 + .../page/page_markup_integration_test.go | 6 +- 13 files changed, 283 insertions(+), 141 deletions(-) diff --git a/common/constants/constants.go b/common/constants/constants.go index f8f057e05..752aef72c 100644 --- a/common/constants/constants.go +++ b/common/constants/constants.go @@ -21,6 +21,7 @@ const ( ErrRemoteGetCSV = "error-remote-getcsv" WarnFrontMatterParamsOverrides = "warning-frontmatter-params-overrides" + WarnRenderShortcodesInHTML = "warning-rendershortcodes-in-html" ) // Field/method names with special meaning. diff --git a/hugolib/collections_test.go b/hugolib/collections_test.go index fff57337f..a8c817bec 100644 --- a/hugolib/collections_test.go +++ b/hugolib/collections_test.go @@ -71,9 +71,9 @@ tags_weight: %d {{ $pageGroups := slice $cool $blue }} {{ $weighted := slice $wp1 $wp2 }} -{{ printf "pages:%d:%T:%v/%v" (len $pages) $pages (index $pages 0) (index $pages 1) }} -{{ printf "pageGroups:%d:%T:%v/%v" (len $pageGroups) $pageGroups (index (index $pageGroups 0).Pages 0) (index (index $pageGroups 1).Pages 0)}} -{{ printf "weightedPages:%d::%T:%v" (len $weighted) $weighted $weighted | safeHTML }} +{{ printf "pages:%d:%T:%s|%s" (len $pages) $pages (index $pages 0).Path (index $pages 1).Path }} +{{ printf "pageGroups:%d:%T:%s|%s" (len $pageGroups) $pageGroups (index (index $pageGroups 0).Pages 0).Path (index (index $pageGroups 1).Pages 0).Path}} +{{ printf "weightedPages:%d:%T" (len $weighted) $weighted | safeHTML }} `) b.CreateSites().Build(BuildCfg{}) @@ -82,9 +82,9 @@ tags_weight: %d c.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 2) b.AssertFileContent("public/index.html", - "pages:2:page.Pages:Page(/page1)/Page(/page2)", - "pageGroups:2:page.PagesGroup:Page(/page1)/Page(/page2)", - `weightedPages:2::page.WeightedPages:[WeightedPage(10,"Page") WeightedPage(20,"Page")]`) + "pages:2:page.Pages:/page1|/page2", + "pageGroups:2:page.PagesGroup:/page1|/page2", + `weightedPages:2:page.WeightedPages`) } func TestUnionFunc(t *testing.T) { @@ -189,7 +189,7 @@ tags_weight: %d {{ $appendStrings := slice "a" "b" | append "c" "d" "e" }} {{ $appendStringsSlice := slice "a" "b" "c" | append (slice "c" "d") }} -{{ printf "pages:%d:%T:%v/%v" (len $pages) $pages (index $pages 0) (index $pages 1) }} +{{ printf "pages:%d:%T:%s|%s" (len $pages) $pages (index $pages 0).Path (index $pages 1).Path }} {{ printf "appendPages:%d:%T:%v/%v" (len $appendPages) $appendPages (index $appendPages 0).Kind (index $appendPages 8).Kind }} {{ printf "appendStrings:%T:%v" $appendStrings $appendStrings }} {{ printf "appendStringsSlice:%T:%v" $appendStringsSlice $appendStringsSlice }} @@ -207,7 +207,7 @@ tags_weight: %d c.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 2) b.AssertFileContent("public/index.html", - "pages:2:page.Pages:Page(/page2)/Page(/page1)", + "pages:2:page.Pages:/page2|/page1", "appendPages:9:page.Pages:home/page", "appendStrings:[]string:[a b c d e]", "appendStringsSlice:[]string:[a b c c d]", diff --git a/hugolib/integrationtest_builder.go b/hugolib/integrationtest_builder.go index b806ad7c1..5dc13592f 100644 --- a/hugolib/integrationtest_builder.go +++ b/hugolib/integrationtest_builder.go @@ -2,6 +2,7 @@ package hugolib import ( "bytes" + "context" "encoding/base64" "errors" "fmt" @@ -32,6 +33,7 @@ import ( "github.com/gohugoio/hugo/htesting" "github.com/gohugoio/hugo/hugofs" "github.com/spf13/afero" + "github.com/spf13/cast" "golang.org/x/text/unicode/norm" "golang.org/x/tools/txtar" ) @@ -294,6 +296,12 @@ func (s *IntegrationTestBuilder) AssertFileContent(filename string, matches ...s } } +func (s *IntegrationTestBuilder) AssertFileContentEquals(filename string, match string) { + s.Helper() + content := s.FileContent(filename) + s.Assert(content, qt.Equals, match, qt.Commentf(match)) +} + func (s *IntegrationTestBuilder) AssertFileContentExact(filename string, matches ...string) { s.Helper() content := s.FileContent(filename) @@ -302,6 +310,16 @@ func (s *IntegrationTestBuilder) AssertFileContentExact(filename string, matches } } +func (s *IntegrationTestBuilder) AssertNoRenderShortcodesArtifacts() { + s.Helper() + for _, p := range s.H.Pages() { + content, err := p.Content(context.Background()) + s.Assert(err, qt.IsNil) + comment := qt.Commentf("Page: %s\n%s", p.Path(), content) + s.Assert(strings.Contains(cast.ToString(content), "__hugo_ctx"), qt.IsFalse, comment) + } +} + func (s *IntegrationTestBuilder) AssertPublishDir(matches ...string) { s.AssertFs(s.fs.PublishDir, matches...) } @@ -835,6 +853,11 @@ type IntegrationTestConfig struct { // The files to use on txtar format, see // https://pkg.go.dev/golang.org/x/exp/cmd/txtar + // There are some conentions used in this test setup. + // - §§§ can be used to wrap code fences. + // - §§ can be used to wrap multiline strings. + // - filenames prefixed with sourcefilename: will be read from the file system relative to the current dir. + // - filenames with a .png or .jpg extension will be treated as binary and base64 decoded. TxtarString string // COnfig to use as the base. We will also read the config from the txtar. diff --git a/hugolib/menu_test.go b/hugolib/menu_test.go index 304b4fbf4..6ee62771b 100644 --- a/hugolib/menu_test.go +++ b/hugolib/menu_test.go @@ -105,94 +105,6 @@ Menu Main: {{ partial "menu.html" (dict "page" . "menu" "main") }}`, "/sect3/|Sect3s|Sect3s|0|-|-|") } -// related issue #7594 -func TestMenusSort(t *testing.T) { - b := newTestSitesBuilder(t).WithSimpleConfigFile() - - b.WithTemplatesAdded("index.html", ` -{{ range $k, $v := .Site.Menus.main }} -Default1|{{ $k }}|{{ $v.Weight }}|{{ $v.Name }}|{{ .URL }}|{{ $v.Page }}{{ end }} -{{ range $k, $v := .Site.Menus.main.ByWeight }} -ByWeight|{{ $k }}|{{ $v.Weight }}|{{ $v.Name }}|{{ .URL }}|{{ $v.Page }}{{ end }} -{{ range $k, $v := (.Site.Menus.main.ByWeight).Reverse }} -Reverse|{{ $k }}|{{ $v.Weight }}|{{ $v.Name }}|{{ .URL }}|{{ $v.Page }}{{ end }} -{{ range $k, $v := .Site.Menus.main }} -Default2|{{ $k }}|{{ $v.Weight }}|{{ $v.Name }}|{{ .URL }}|{{ $v.Page }}{{ end }} -{{ range $k, $v := .Site.Menus.main.ByWeight }} -ByWeight|{{ $k }}|{{ $v.Weight }}|{{ $v.Name }}|{{ .URL }}|{{ $v.Page }}{{ end }} -{{ range $k, $v := .Site.Menus.main }} -Default3|{{ $k }}|{{ $v.Weight }}|{{ $v.Name }}|{{ .URL }}|{{ $v.Page }}{{ end }} -`) - - b.WithContent("_index.md", ` ---- -title: Home -menu: - main: - weight: 100 ----`) - - b.WithContent("blog/A.md", ` ---- -title: "A" -menu: - main: - weight: 10 ---- -`) - - b.WithContent("blog/B.md", ` ---- -title: "B" -menu: - main: - weight: 20 ---- -`) - b.WithContent("blog/C.md", ` ---- -title: "C" -menu: - main: - weight: 30 ---- -`) - - b.Build(BuildCfg{}) - - b.AssertFileContent("public/index.html", - `Default1|0|10|A|/blog/a/|Page(/blog/a) - Default1|1|20|B|/blog/b/|Page(/blog/b) - Default1|2|30|C|/blog/c/|Page(/blog/c) - Default1|3|100|Home|/|Page(/) - - ByWeight|0|10|A|/blog/a/|Page(/blog/a) - ByWeight|1|20|B|/blog/b/|Page(/blog/b) - ByWeight|2|30|C|/blog/c/|Page(/blog/c) - ByWeight|3|100|Home|/|Page(/) - - Reverse|0|100|Home|/|Page(/) - Reverse|1|30|C|/blog/c/|Page(/blog/c) - Reverse|2|20|B|/blog/b/|Page(/blog/b) - Reverse|3|10|A|/blog/a/|Page(/blog/a) - - Default2|0|10|A|/blog/a/|Page(/blog/a) - Default2|1|20|B|/blog/b/|Page(/blog/b) - Default2|2|30|C|/blog/c/|Page(/blog/c) - Default2|3|100|Home|/|Page(/) - - ByWeight|0|10|A|/blog/a/|Page(/blog/a) - ByWeight|1|20|B|/blog/b/|Page(/blog/b) - ByWeight|2|30|C|/blog/c/|Page(/blog/c) - ByWeight|3|100|Home|/|Page(/) - - Default3|0|10|A|/blog/a/|Page(/blog/a) - Default3|1|20|B|/blog/b/|Page(/blog/b) - Default3|2|30|C|/blog/c/|Page(/blog/c) - Default3|3|100|Home|/|Page(/)`, - ) -} - func TestMenusFrontMatter(t *testing.T) { b := newTestSitesBuilder(t).WithSimpleConfigFile() @@ -437,8 +349,8 @@ url = "/blog/post3" commonTempl := ` Main: {{ len .Site.Menus.main }} {{ range .Site.Menus.main }} -{{ .Title }}|HasMenuCurrent: {{ $.HasMenuCurrent "main" . }}|Page: {{ .Page }} -{{ .Title }}|IsMenuCurrent: {{ $.IsMenuCurrent "main" . }}|Page: {{ .Page }} +{{ .Title }}|HasMenuCurrent: {{ $.HasMenuCurrent "main" . }}|Page: {{ .Page.Path }} +{{ .Title }}|IsMenuCurrent: {{ $.IsMenuCurrent "main" . }}|Page: {{ .Page.Path }} {{ end }} ` @@ -494,34 +406,34 @@ title: "Contact: With No Menu Defined" b.AssertFileContent("public/index.html", ` Main: 5 -Home|HasMenuCurrent: false|Page: Page(/) -Blog|HasMenuCurrent: false|Page: Page(/blog) -My Post 2: With Menu Defined|HasMenuCurrent: false|Page: Page(/blog/post2) -My Post 3|HasMenuCurrent: false|Page: Page(/blog/post3) -Contact Us|HasMenuCurrent: false|Page: Page(/contact) +Home|HasMenuCurrent: false|Page: / +Blog|HasMenuCurrent: false|Page: /blog +My Post 2: With Menu Defined|HasMenuCurrent: false|Page: /blog/post2 +My Post 3|HasMenuCurrent: false|Page: /blog/post3 +Contact Us|HasMenuCurrent: false|Page: /contact `) b.AssertFileContent("public/blog/post1/index.html", ` -Home|HasMenuCurrent: false|Page: Page(/) -Blog|HasMenuCurrent: true|Page: Page(/blog) +Home|HasMenuCurrent: false|Page: / +Blog|HasMenuCurrent: true|Page: /blog `) b.AssertFileContent("public/blog/post2/index.html", ` -Home|HasMenuCurrent: false|Page: Page(/) -Blog|HasMenuCurrent: true|Page: Page(/blog) -Blog|IsMenuCurrent: false|Page: Page(/blog) +Home|HasMenuCurrent: false|Page: / +Blog|HasMenuCurrent: true|Page: /blog +Blog|IsMenuCurrent: false|Page: /blog `) b.AssertFileContent("public/blog/post3/index.html", ` -Home|HasMenuCurrent: false|Page: Page(/) -Blog|HasMenuCurrent: true|Page: Page(/blog) +Home|HasMenuCurrent: false|Page: / +Blog|HasMenuCurrent: true|Page: /blog `) b.AssertFileContent("public/contact/index.html", ` -Contact Us|HasMenuCurrent: false|Page: Page(/contact) -Contact Us|IsMenuCurrent: true|Page: Page(/contact) -Blog|HasMenuCurrent: false|Page: Page(/blog) -Blog|IsMenuCurrent: false|Page: Page(/blog) +Contact Us|HasMenuCurrent: false|Page: /contact +Contact Us|IsMenuCurrent: true|Page: /contact +Blog|HasMenuCurrent: false|Page: /blog +Blog|IsMenuCurrent: false|Page: /blog `) } diff --git a/hugolib/page.go b/hugolib/page.go index 7525ab672..2bc1da044 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -16,7 +16,9 @@ package hugolib import ( "context" "fmt" + "path/filepath" "strconv" + "strings" "sync" "sync/atomic" @@ -358,7 +360,22 @@ func (p *pageState) Site() page.Site { } func (p *pageState) String() string { - return fmt.Sprintf("Page(%s)", p.Path()) + var sb strings.Builder + if p.File() != nil { + // The forward slashes even on Windows is motivated by + // getting stable tests. + // This information is meant for getting positional information in logs, + // so the direction of the slashes should not matter. + sb.WriteString(filepath.ToSlash(p.File().Filename())) + if p.File().IsContentAdapter() { + // Also include the path. + sb.WriteString(":") + sb.WriteString(p.Path()) + } + } else { + sb.WriteString(p.Path()) + } + return sb.String() } // IsTranslated returns whether this content file is translated to diff --git a/hugolib/rendershortcodes_test.go b/hugolib/rendershortcodes_test.go index 313c80a73..9a31b6536 100644 --- a/hugolib/rendershortcodes_test.go +++ b/hugolib/rendershortcodes_test.go @@ -14,6 +14,7 @@ package hugolib import ( + "path/filepath" "strings" "testing" ) @@ -69,6 +70,7 @@ Content: {{ .Content }}| b := Test(t, files) + b.AssertNoRenderShortcodesArtifacts() b.AssertFileContent("public/p1/index.html", "Fragments: [p1-h1 p2-h1 p2-h2 p2-h3 p2-withmarkdown p3-h1 p3-h2 p3-withmarkdown]|", "HasShortcode Level 1: true|", @@ -115,6 +117,7 @@ JSON: {{ .Content }} b := Test(t, files) + b.AssertNoRenderShortcodesArtifacts() b.AssertFileContent("public/p1/index.html", "Myshort HTML") b.AssertFileContent("public/p1/index.json", "Myshort JSON") } @@ -147,9 +150,11 @@ Myshort Original. {{ .Content }} ` b := TestRunning(t, files) + b.AssertNoRenderShortcodesArtifacts() b.AssertFileContent("public/p1/index.html", "Myshort Original.") b.EditFileReplaceAll("layouts/shortcodes/myshort.html", "Original", "Edited").Build() + b.AssertNoRenderShortcodesArtifacts() b.AssertFileContent("public/p1/index.html", "Myshort Edited.") } @@ -192,12 +197,14 @@ Myshort Original. }, ).Build() + b.AssertNoRenderShortcodesArtifacts() b.AssertFileContent("public/p1/index.html", "Original") b.EditFileReplaceFunc("content/p2.md", func(s string) string { return strings.Replace(s, "Original", "Edited", 1) }) b.Build() + b.AssertNoRenderShortcodesArtifacts() b.AssertFileContent("public/p1/index.html", "Edited") } @@ -233,8 +240,10 @@ Myshort Original. ` b := TestRunning(t, files) + b.AssertNoRenderShortcodesArtifacts() b.AssertFileContent("public/mysection/index.html", "p1-h1") b.EditFileReplaceAll("content/mysection/_index.md", "p1-h1", "p1-h1 Edited").Build() + b.AssertNoRenderShortcodesArtifacts() b.AssertFileContent("public/mysection/index.html", "p1-h1 Edited") } @@ -314,6 +323,8 @@ iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAA b := Test(t, files) + b.AssertNoRenderShortcodesArtifacts() + b.AssertFileContent("public/markdown/index.html", // Images. "Image: /posts/p1/pixel1.png|\nImage: /posts/p1/pixel2.png|\n|\nImage: /markdown/pixel3.png|

\n|", @@ -333,3 +344,104 @@ iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAA b.AssertFileContent("public/html/index.html", "! hugo_ctx") } + +// Issue 12854. +func TestRenderShortcodesWithHTML(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableLiveReload = true +disableKinds = ["home", "taxonomy", "term"] +markup.goldmark.renderer.unsafe = true +-- content/p1.md -- +--- +title: "p1" +--- +{{% include "p2" %}} +-- content/p2.md -- +--- +title: "p2" +--- +Hello world. Some **bold** text. Some Unicode: 神真美好. +-- layouts/shortcodes/include.html -- +{{ with site.GetPage (.Get 0) }} +
{{ .RenderShortcodes }}
+{{ end }} +-- layouts/_default/single.html -- +{{ .Content }} +` + + b := TestRunning(t, files, TestOptWarn()) + + b.AssertNoRenderShortcodesArtifacts() + b.AssertLogContains(filepath.ToSlash("WARN .RenderShortcodes detected inside HTML block in \"/content/p1.md\"; this may not be what you intended, see https://gohugo.io/methods/page/rendershortcodes/#limitations\nYou can suppress this warning by adding the following to your site configuration:\nignoreLogs = ['warning-rendershortcodes-in-html']")) + b.AssertFileContent("public/p1/index.html", "
Hello world. Some **bold** text. Some Unicode: 神真美好.\n
") + b.EditFileReplaceAll("content/p2.md", "Hello", "Hello Edited").Build() + b.AssertNoRenderShortcodesArtifacts() + b.AssertFileContent("public/p1/index.html", "
Hello Edited world. Some **bold** text. Some Unicode: 神真美好.\n
") +} + +func TestRenderShortcodesIncludeMarkdownFileWithoutTrailingNewline(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableLiveReload = true +disableKinds = ["home", "taxonomy", "term"] +markup.goldmark.renderer.unsafe = true +-- content/p1.md -- +--- +title: "p1" +--- +Content p1 id-1000.{{% include "p2" %}}{{% include "p3" %}} + +§§§ go +code_p1 +§§§ +§§§ go +code_p1_2 +§§§ + +§§§ go +code_p1_3 +§§§ +-- content/p2.md -- +--- +title: "p2" +--- +§§§ bash +code_p2 +§§§ +Foo. +-- content/p3.md -- +--- +title: "p3" +--- +§§§ php +code_p3 +§§§ +-- layouts/shortcodes/include.html -- +{{ with site.GetPage (.Get 0) -}} +{{ .RenderShortcodes -}} +{{ end -}} +-- layouts/_default/single.html -- +{{ .Content }} +-- layouts/_default/_markup/render-codeblock.html -- +{{ .Inner | safeHTML }} +` + + b := TestRunning(t, files, TestOptWarn()) + + b.AssertNoRenderShortcodesArtifacts() + b.AssertFileContentEquals("public/p1/index.html", "

Content p1 id-1000.

\ncode_p2

Foo.\n

\ncode_p3

\ncode_p1code_p1_2code_p1_3") + b.EditFileReplaceAll("content/p1.md", "id-1000.", "id-100.").Build() + b.AssertNoRenderShortcodesArtifacts() + b.AssertFileContentEquals("public/p1/index.html", "

Content p1 id-100.

\ncode_p2

Foo.\n

\ncode_p3

\ncode_p1code_p1_2code_p1_3") + b.EditFileReplaceAll("content/p2.md", "code_p2", "codep2").Build() + b.AssertNoRenderShortcodesArtifacts() + b.AssertFileContentEquals("public/p1/index.html", "

Content p1 id-100.

\ncodep2

Foo.\n

\ncode_p3

\ncode_p1code_p1_2code_p1_3") + b.EditFileReplaceAll("content/p3.md", "code_p3", "code_p3_edited").Build() + b.AssertNoRenderShortcodesArtifacts() + b.AssertFileContentEquals("public/p1/index.html", "

Content p1 id-100.

\ncodep2

Foo.\n

\ncode_p3_edited

\ncode_p1code_p1_2code_p1_3") +} diff --git a/hugolib/shortcode_page.go b/hugolib/shortcode_page.go index 8030b0285..3d27cc93c 100644 --- a/hugolib/shortcode_page.go +++ b/hugolib/shortcode_page.go @@ -125,3 +125,7 @@ func newPageForRenderHook(p *pageState) page.Page { func (p *pageForRenderHooks) Unwrapv() any { return p.p } + +func (p *pageForRenderHooks) String() string { + return p.p.String() +} diff --git a/markup/goldmark/convert.go b/markup/goldmark/convert.go index 5c31eee40..ea3bbc4ae 100644 --- a/markup/goldmark/convert.go +++ b/markup/goldmark/convert.go @@ -106,7 +106,7 @@ func newMarkdown(pcfg converter.ProviderConfig) goldmark.Markdown { renderer.WithNodeRenderers(util.Prioritized(emoji.NewHTMLRenderer(), 200))) var ( extensions = []goldmark.Extender{ - hugocontext.New(), + hugocontext.New(pcfg.Logger), newLinks(cfg), newTocExtension(tocRendererOptions), blockquotes.New(), diff --git a/markup/goldmark/goldmark_integration_test.go b/markup/goldmark/goldmark_integration_test.go index c691435ee..19b18692e 100644 --- a/markup/goldmark/goldmark_integration_test.go +++ b/markup/goldmark/goldmark_integration_test.go @@ -575,7 +575,7 @@ sc3_begin|{{ .Inner }}|sc3_end // Issue #7332 ":x:\n", // Issue #11587 - "

✔️

", + "

✔️\n

", // Should not be converted to emoji "sc1_begin|:smiley:|sc1_end", // Should be converted to emoji diff --git a/markup/goldmark/hugocontext/hugocontext.go b/markup/goldmark/hugocontext/hugocontext.go index b9c548dac..223c30c91 100644 --- a/markup/goldmark/hugocontext/hugocontext.go +++ b/markup/goldmark/hugocontext/hugocontext.go @@ -16,20 +16,24 @@ package hugocontext import ( "bytes" "fmt" + "regexp" "strconv" "github.com/gohugoio/hugo/bufferpool" + "github.com/gohugoio/hugo/common/constants" + "github.com/gohugoio/hugo/common/loggers" "github.com/gohugoio/hugo/markup/goldmark/internal/render" "github.com/yuin/goldmark" "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer" + "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) -func New() goldmark.Extender { - return &hugoContextExtension{} +func New(logger loggers.Logger) goldmark.Extender { + return &hugoContextExtension{logger: logger} } // Wrap wraps the given byte slice in a Hugo context that used to determine the correct Page @@ -37,14 +41,19 @@ func New() goldmark.Extender { func Wrap(b []byte, pid uint64) string { buf := bufferpool.GetBuffer() defer bufferpool.PutBuffer(buf) - buf.Write(prefix) + buf.Write(hugoCtxPrefix) buf.WriteString(" pid=") buf.WriteString(strconv.FormatUint(pid, 10)) - buf.Write(endDelim) + buf.Write(hugoCtxEndDelim) buf.WriteByte('\n') buf.Write(b) - buf.Write(prefix) - buf.Write(closingDelimAndNewline) + // To make sure that we're able to parse it, make sure it ends with a newline. + if len(b) > 0 && b[len(b)-1] != '\n' { + buf.WriteByte('\n') + } + buf.Write(hugoCtxPrefix) + buf.Write(hugoCtxClosingDelim) + buf.WriteByte('\n') return buf.String() } @@ -89,45 +98,100 @@ func (h *HugoContext) Kind() ast.NodeKind { } var ( - prefix = []byte("{{__hugo_ctx") - endDelim = []byte("}}") - closingDelimAndNewline = []byte("/}}\n") + hugoCtxPrefix = []byte("{{__hugo_ctx") + hugoCtxEndDelim = []byte("}}") + hugoCtxClosingDelim = []byte("/}}") + hugoCtxRe = regexp.MustCompile(`{{__hugo_ctx( pid=\d+)?/?}}\n?`) ) var _ parser.InlineParser = (*hugoContextParser)(nil) type hugoContextParser struct{} -func (s *hugoContextParser) Parse(parent ast.Node, block text.Reader, pc parser.Context) ast.Node { - line, _ := block.PeekLine() - if !bytes.HasPrefix(line, prefix) { +func (a *hugoContextParser) Trigger() []byte { + return []byte{'{'} +} + +func (s *hugoContextParser) Parse(parent ast.Node, reader text.Reader, pc parser.Context) ast.Node { + line, _ := reader.PeekLine() + if !bytes.HasPrefix(line, hugoCtxPrefix) { return nil } - end := bytes.Index(line, endDelim) + end := bytes.Index(line, hugoCtxEndDelim) if end == -1 { return nil } - block.Advance(end + len(endDelim) + 1) // +1 for the newline + reader.Advance(end + len(hugoCtxEndDelim) + 1) // +1 for the newline if line[end-1] == '/' { return &HugoContext{Closing: true} } - attrBytes := line[len(prefix)+1 : end] + attrBytes := line[len(hugoCtxPrefix)+1 : end] h := &HugoContext{} h.parseAttrs(attrBytes) return h } -func (a *hugoContextParser) Trigger() []byte { - return []byte{'{'} +type hugoContextRenderer struct { + logger loggers.Logger + html.Config } -type hugoContextRenderer struct{} +func (r *hugoContextRenderer) SetOption(name renderer.OptionName, value any) { + r.Config.SetOption(name, value) +} func (r *hugoContextRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer) { reg.Register(kindHugoContext, r.handleHugoContext) + reg.Register(ast.KindHTMLBlock, r.renderHTMLBlock) +} + +func (r *hugoContextRenderer) stripHugoCtx(b []byte) ([]byte, bool) { + if !bytes.Contains(b, hugoCtxPrefix) { + return b, false + } + return hugoCtxRe.ReplaceAll(b, nil), true +} + +func (r *hugoContextRenderer) renderHTMLBlock( + w util.BufWriter, source []byte, node ast.Node, entering bool, +) (ast.WalkStatus, error) { + n := node.(*ast.HTMLBlock) + if entering { + if r.Unsafe { + l := n.Lines().Len() + for i := 0; i < l; i++ { + line := n.Lines().At(i) + linev := line.Value(source) + var stripped bool + linev, stripped = r.stripHugoCtx(linev) + if stripped { + var p any + ctx, ok := w.(*render.Context) + if ok { + p, _ = render.GetPageAndPageInner(ctx) + } + r.logger.Warnidf(constants.WarnRenderShortcodesInHTML, ".RenderShortcodes detected inside HTML block in %q; this may not be what you intended, see https://gohugo.io/methods/page/rendershortcodes/#limitations", p) + } + + r.Writer.SecureWrite(w, linev) + } + } else { + _, _ = w.WriteString("\n") + } + } else { + if n.HasClosure() { + if r.Unsafe { + closure := n.ClosureLine + r.Writer.SecureWrite(w, closure.Value(source)) + } else { + _, _ = w.WriteString("\n") + } + } + } + return ast.WalkContinue, nil } func (r *hugoContextRenderer) handleHugoContext(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { @@ -148,7 +212,9 @@ func (r *hugoContextRenderer) handleHugoContext(w util.BufWriter, source []byte, return ast.WalkContinue, nil } -type hugoContextExtension struct{} +type hugoContextExtension struct { + logger loggers.Logger +} func (a *hugoContextExtension) Extend(m goldmark.Markdown) { m.Parser().AddOptions( @@ -159,7 +225,12 @@ func (a *hugoContextExtension) Extend(m goldmark.Markdown) { m.Renderer().AddOptions( renderer.WithNodeRenderers( - util.Prioritized(&hugoContextRenderer{}, 50), + util.Prioritized(&hugoContextRenderer{ + logger: a.logger, + Config: html.Config{ + Writer: html.DefaultWriter, + }, + }, 50), ), ) } diff --git a/markup/goldmark/hugocontext/hugocontext_test.go b/markup/goldmark/hugocontext/hugocontext_test.go index 4a6eb80f5..62769f4d0 100644 --- a/markup/goldmark/hugocontext/hugocontext_test.go +++ b/markup/goldmark/hugocontext/hugocontext_test.go @@ -24,7 +24,7 @@ func TestWrap(t *testing.T) { b := []byte("test") - c.Assert(Wrap(b, 42), qt.Equals, "{{__hugo_ctx pid=42}}\ntest{{__hugo_ctx/}}\n") + c.Assert(Wrap(b, 42), qt.Equals, "{{__hugo_ctx pid=42}}\ntest\n{{__hugo_ctx/}}\n") } func BenchmarkWrap(b *testing.B) { diff --git a/resources/page/page.go b/resources/page/page.go index 4cda8d31f..20525669c 100644 --- a/resources/page/page.go +++ b/resources/page/page.go @@ -17,6 +17,7 @@ package page import ( "context" + "fmt" "html/template" "github.com/gohugoio/hugo/markup/converter" @@ -180,6 +181,7 @@ type Page interface { ContentProvider TableOfContentsProvider PageWithoutContent + fmt.Stringer } type PageFragment interface { diff --git a/resources/page/page_markup_integration_test.go b/resources/page/page_markup_integration_test.go index 010a9d729..425099215 100644 --- a/resources/page/page_markup_integration_test.go +++ b/resources/page/page_markup_integration_test.go @@ -161,13 +161,13 @@ includecontent: {{ hugo.Context.MarkupScope }}|{{ $p.Markup.Render.Content }}| b := hugolib.Test(t, files) - b.AssertFileContent("public/p1/index.html", "Render heading: title: P1 scope: |", "Foo scope: |") + b.AssertFileContentExact("public/p1/index.html", "Render heading: title: P1 scope: |", "Foo scope: |") - b.AssertFileContent("public/index.html", + b.AssertFileContentExact("public/index.html", + "Begin:\nincludecontent: home|Render heading: title: P3 scope: home|Foo scope: home|\n|\n:End", "Render heading: title: P1 scope: home|", "Foo scope: home|", "Begin:\nincluderendershortcodes: home|

\nRender heading: title: P2 scope: home|

|:End", - "Begin:\nincludecontent: home|Render heading: title: P3 scope: home|Foo scope: home|\n|\n:End", ) } From 30d9aea8607e8143968d73d11a8c1c0e51d34343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sun, 3 Nov 2024 10:41:34 +0100 Subject: [PATCH 025/470] Fix stale pages on rebuilds in GetPage with short refs Fixes #13004 --- hugolib/content_map_page.go | 12 +++++++---- hugolib/rendershortcodes_test.go | 35 ++++++++++++++++++++++++++++++++ hugolib/site.go | 1 + lazy/init.go | 2 +- lazy/once.go | 12 +++++------ 5 files changed, 51 insertions(+), 11 deletions(-) diff --git a/hugolib/content_map_page.go b/hugolib/content_map_page.go index c3f06a592..5e8646b21 100644 --- a/hugolib/content_map_page.go +++ b/hugolib/content_map_page.go @@ -37,6 +37,7 @@ import ( "github.com/gohugoio/hugo/hugolib/doctree" "github.com/gohugoio/hugo/hugolib/pagesfromdata" "github.com/gohugoio/hugo/identity" + "github.com/gohugoio/hugo/lazy" "github.com/gohugoio/hugo/media" "github.com/gohugoio/hugo/output" "github.com/gohugoio/hugo/resources" @@ -109,6 +110,11 @@ type pageMap struct { cfg contentMapConfig } +// Invoked on rebuilds. +func (m *pageMap) Reset() { + m.pageReverseIndex.Reset() +} + // pageTrees holds pages and resources in a tree structure for all sites/languages. // Each site gets its own tree set via the Shape method. type pageTrees struct { @@ -958,9 +964,7 @@ type contentTreeReverseIndex struct { } func (c *contentTreeReverseIndex) Reset() { - c.contentTreeReverseIndexMap = &contentTreeReverseIndexMap{ - m: make(map[any]contentNodeI), - } + c.init.ResetWithLock().Unlock() } func (c *contentTreeReverseIndex) Get(key any) contentNodeI { @@ -972,7 +976,7 @@ func (c *contentTreeReverseIndex) Get(key any) contentNodeI { } type contentTreeReverseIndexMap struct { - init sync.Once + init lazy.OnceMore m map[any]contentNodeI } diff --git a/hugolib/rendershortcodes_test.go b/hugolib/rendershortcodes_test.go index 9a31b6536..0eebf46eb 100644 --- a/hugolib/rendershortcodes_test.go +++ b/hugolib/rendershortcodes_test.go @@ -445,3 +445,38 @@ code_p3 b.AssertNoRenderShortcodesArtifacts() b.AssertFileContentEquals("public/p1/index.html", "

Content p1 id-100.

\ncodep2

Foo.\n

\ncode_p3_edited

\ncode_p1code_p1_2code_p1_3") } + +// Issue 13004. +func TestRenderShortcodesIncludeShortRefEdit(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableLiveReload = true +disableKinds = ["home", "taxonomy", "term", "section", "rss", "sitemap", "robotsTXT", "404"] +-- content/first/p1.md -- +--- +title: "p1" +--- +## p1-h1 +{{% include "p2" %}} +-- content/second/p2.md -- +--- +title: "p2" +--- +### p2-h1 + +This is some **markup**. +-- layouts/shortcodes/include.html -- +{{ $p := site.GetPage (.Get 0) -}} +{{ $p.RenderShortcodes -}} +-- layouts/_default/single.html -- +{{ .Content }} +` + b := TestRunning(t, files) + b.AssertNoRenderShortcodesArtifacts() + b.AssertFileContentEquals("public/first/p1/index.html", "

p1-h1

\n

\n

p2-h1

\n

This is some markup.\n

\n") + b.EditFileReplaceAll("content/second/p2.md", "p2-h1", "p2-h1-edited").Build() + b.AssertNoRenderShortcodesArtifacts() + b.AssertFileContentEquals("public/first/p1/index.html", "

p1-h1

\n

\n

p2-h1-edited

\n

This is some markup.\n

\n") +} diff --git a/hugolib/site.go b/hugolib/site.go index 24ee5dcc5..c5a4956e2 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -1351,6 +1351,7 @@ func (s *Site) getLanguagePermalinkLang(alwaysInSubDir bool) string { func (s *Site) resetBuildState(sourceChanged bool) { s.relatedDocsHandler = s.relatedDocsHandler.Clone() s.init.Reset() + s.pageMap.Reset() } func (s *Site) errorCollator(results <-chan error, errs chan<- error) { diff --git a/lazy/init.go b/lazy/init.go index 7b88a5351..bef3867a9 100644 --- a/lazy/init.go +++ b/lazy/init.go @@ -36,7 +36,7 @@ type Init struct { prev *Init children []*Init - init onceMore + init OnceMore out any err error f func(context.Context) (any, error) diff --git a/lazy/once.go b/lazy/once.go index c6abcd884..dac689df3 100644 --- a/lazy/once.go +++ b/lazy/once.go @@ -18,19 +18,19 @@ import ( "sync/atomic" ) -// onceMore is similar to sync.Once. +// OnceMore is similar to sync.Once. // // Additional features are: // * it can be reset, so the action can be repeated if needed // * it has methods to check if it's done or in progress -type onceMore struct { +type OnceMore struct { mu sync.Mutex lock uint32 done uint32 } -func (t *onceMore) Do(f func()) { +func (t *OnceMore) Do(f func()) { if atomic.LoadUint32(&t.done) == 1 { return } @@ -53,15 +53,15 @@ func (t *onceMore) Do(f func()) { f() } -func (t *onceMore) InProgress() bool { +func (t *OnceMore) InProgress() bool { return atomic.LoadUint32(&t.lock) == 1 } -func (t *onceMore) Done() bool { +func (t *OnceMore) Done() bool { return atomic.LoadUint32(&t.done) == 1 } -func (t *onceMore) ResetWithLock() *sync.Mutex { +func (t *OnceMore) ResetWithLock() *sync.Mutex { t.mu.Lock() defer atomic.StoreUint32(&t.done, 0) return &t.mu From 62a96cef7fbe496271e8cca0f234193f6106a771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sun, 3 Nov 2024 13:37:11 +0100 Subject: [PATCH 026/470] markup/goldmark: Add warning (using Warnidf) on Goldmark Fixes #12997 --- common/constants/constants.go | 1 + markup/goldmark/goldmark_integration_test.go | 25 ++++++++++++++++++++ markup/goldmark/hugocontext/hugocontext.go | 13 ++++++---- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/common/constants/constants.go b/common/constants/constants.go index 752aef72c..48813e79b 100644 --- a/common/constants/constants.go +++ b/common/constants/constants.go @@ -22,6 +22,7 @@ const ( WarnFrontMatterParamsOverrides = "warning-frontmatter-params-overrides" WarnRenderShortcodesInHTML = "warning-rendershortcodes-in-html" + WarnGoldmarkRawHTML = "warning-goldmark-raw-html" ) // Field/method names with special meaning. diff --git a/markup/goldmark/goldmark_integration_test.go b/markup/goldmark/goldmark_integration_test.go index 19b18692e..8b7cc5a54 100644 --- a/markup/goldmark/goldmark_integration_test.go +++ b/markup/goldmark/goldmark_integration_test.go @@ -802,3 +802,28 @@ H~2~0 "

1st

", ) } + +// Issue 12997. +func TestGoldmarkRawHTMLWarning(t *testing.T) { + files := ` +-- hugo.toml -- +disableKinds = ['home','rss','section','sitemap','taxonomy','term'] +markup.goldmark.renderer.unsafe = false +-- content/p1.md -- +--- +title: "p1" +--- +
Some raw HTML
+-- layouts/_default/single.html -- +{{ .Content }} +` + + b := hugolib.Test(t, files, hugolib.TestOptWarn()) + + b.AssertFileContent("public/p1/index.html", "") + b.AssertLogContains("WARN Raw HTML omitted from \"/content/p1.md\"; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe\nYou can suppress this warning by adding the following to your site configuration:\nignoreLogs = ['warning-goldmark-raw-html']") + + b = hugolib.Test(t, strings.ReplaceAll(files, "markup.goldmark.renderer.unsafe = false", "markup.goldmark.renderer.unsafe = true"), hugolib.TestOptWarn()) + b.AssertFileContent("public/p1/index.html", "! ") + b.AssertLogContains("! WARN") +} diff --git a/markup/goldmark/hugocontext/hugocontext.go b/markup/goldmark/hugocontext/hugocontext.go index 223c30c91..912e9eb3c 100644 --- a/markup/goldmark/hugocontext/hugocontext.go +++ b/markup/goldmark/hugocontext/hugocontext.go @@ -159,6 +159,14 @@ func (r *hugoContextRenderer) renderHTMLBlock( w util.BufWriter, source []byte, node ast.Node, entering bool, ) (ast.WalkStatus, error) { n := node.(*ast.HTMLBlock) + var p any + ctx, ok := w.(*render.Context) + if ok { + p, _ = render.GetPageAndPageInner(ctx) + } + if !r.Unsafe { + r.logger.Warnidf(constants.WarnGoldmarkRawHTML, "Raw HTML omitted from %q; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe", p) + } if entering { if r.Unsafe { l := n.Lines().Len() @@ -168,11 +176,6 @@ func (r *hugoContextRenderer) renderHTMLBlock( var stripped bool linev, stripped = r.stripHugoCtx(linev) if stripped { - var p any - ctx, ok := w.(*render.Context) - if ok { - p, _ = render.GetPageAndPageInner(ctx) - } r.logger.Warnidf(constants.WarnRenderShortcodesInHTML, ".RenderShortcodes detected inside HTML block in %q; this may not be what you intended, see https://gohugo.io/methods/page/rendershortcodes/#limitations", p) } From 6cf23bf8824758b0d2c4d855f0241e72aef77206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 4 Nov 2024 09:27:17 +0100 Subject: [PATCH 027/470] markup/goldmark: Only log Raw HTML omitted WARN on block entering Updates #12997 --- markup/goldmark/hugocontext/hugocontext.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/markup/goldmark/hugocontext/hugocontext.go b/markup/goldmark/hugocontext/hugocontext.go index 912e9eb3c..4971456be 100644 --- a/markup/goldmark/hugocontext/hugocontext.go +++ b/markup/goldmark/hugocontext/hugocontext.go @@ -159,15 +159,12 @@ func (r *hugoContextRenderer) renderHTMLBlock( w util.BufWriter, source []byte, node ast.Node, entering bool, ) (ast.WalkStatus, error) { n := node.(*ast.HTMLBlock) - var p any - ctx, ok := w.(*render.Context) - if ok { - p, _ = render.GetPageAndPageInner(ctx) - } - if !r.Unsafe { - r.logger.Warnidf(constants.WarnGoldmarkRawHTML, "Raw HTML omitted from %q; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe", p) - } if entering { + var p any + ctx, ok := w.(*render.Context) + if ok { + p, _ = render.GetPageAndPageInner(ctx) + } if r.Unsafe { l := n.Lines().Len() for i := 0; i < l; i++ { @@ -178,10 +175,10 @@ func (r *hugoContextRenderer) renderHTMLBlock( if stripped { r.logger.Warnidf(constants.WarnRenderShortcodesInHTML, ".RenderShortcodes detected inside HTML block in %q; this may not be what you intended, see https://gohugo.io/methods/page/rendershortcodes/#limitations", p) } - r.Writer.SecureWrite(w, linev) } } else { + r.logger.Warnidf(constants.WarnGoldmarkRawHTML, "Raw HTML omitted from %q; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe", p) _, _ = w.WriteString("\n") } } else { From fcdc454cc58e9f26ba29389100adfc09cb383448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 4 Nov 2024 10:31:59 +0100 Subject: [PATCH 028/470] Do not watch directories with no mounted files in it Fixes #12912 Fixes #13007 --- hugofs/rootmapping_fs.go | 10 ++++----- hugolib/filesystems/basefs_test.go | 33 +++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/hugofs/rootmapping_fs.go b/hugofs/rootmapping_fs.go index 2ecd88e9e..02e541a05 100644 --- a/hugofs/rootmapping_fs.go +++ b/hugofs/rootmapping_fs.go @@ -246,11 +246,11 @@ func (fs *RootMappingFs) Mounts(base string) ([]FileMetaInfo, error) { return nil, nil } - fss := make([]FileMetaInfo, len(roots)) - for i, r := range roots { + fss := make([]FileMetaInfo, 0, len(roots)) + for _, r := range roots { if r.fiSingleFile != nil { // A single file mount. - fss[i] = r.fiSingleFile + fss = append(fss, r.fiSingleFile) continue } bfs := NewBasePathFs(fs.Fs, r.To) @@ -261,9 +261,9 @@ func (fs *RootMappingFs) Mounts(base string) ([]FileMetaInfo, error) { fs = decorateDirs(fs, r.Meta) fi, err := fs.Stat("") if err != nil { - return nil, fmt.Errorf("RootMappingFs.Dirs: %w", err) + continue } - fss[i] = fi.(FileMetaInfo) + fss = append(fss, fi.(FileMetaInfo)) } return fss, nil diff --git a/hugolib/filesystems/basefs_test.go b/hugolib/filesystems/basefs_test.go index e39709386..3f189c860 100644 --- a/hugolib/filesystems/basefs_test.go +++ b/hugolib/filesystems/basefs_test.go @@ -220,6 +220,18 @@ target = 'content' source = 'content2' target = 'content/c2' [[module.mounts]] +source = 'content3' +target = 'content/watchdisabled' +disableWatch = true +[[module.mounts]] +source = 'content4' +target = 'content/excludedsome' +excludeFiles = 'p1.md' +[[module.mounts]] +source = 'content5' +target = 'content/excludedall' +excludeFiles = '/**' +[[module.mounts]] source = "hugo_stats.json" target = "assets/watching/hugo_stats.json" -- hugo_stats.json -- @@ -230,12 +242,27 @@ foo -- themes/t1/layouts/_default/single.html -- {{ .Content }} -- themes/t1/static/f1.txt -- +-- content3/p1.md -- +-- content4/p1.md -- +-- content4/p2.md -- +-- content5/p3.md -- +-- content5/p4.md -- ` b := hugolib.Test(t, files) bfs := b.H.BaseFs - watchFilenames := bfs.WatchFilenames() - // []string{"/hugo_stats.json", "/content", "/content2", "/themes/t1/layouts", "/themes/t1/layouts/_default", "/themes/t1/static"} - b.Assert(watchFilenames, qt.HasLen, 6) + watchFilenames := toSlashes(bfs.WatchFilenames()) + + // content3 has disableWatch = true + // content5 has excludeFiles = '/**' + b.Assert(watchFilenames, qt.DeepEquals, []string{"/hugo_stats.json", "/content", "/content2", "/content4", "/themes/t1/layouts", "/themes/t1/layouts/_default", "/themes/t1/static"}) +} + +func toSlashes(in []string) []string { + out := make([]string, len(in)) + for i, s := range in { + out[i] = filepath.ToSlash(s) + } + return out } func TestNoSymlinks(t *testing.T) { From 59c115813595cba1b1c0e70b867e734992648d1b Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Mon, 4 Nov 2024 16:04:06 +0000 Subject: [PATCH 029/470] releaser: Bump versions for release of 0.137.0 [ci skip] --- common/hugo/version_current.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 870719dcb..991b54ac4 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -19,5 +19,5 @@ var CurrentVersion = Version{ Major: 0, Minor: 137, PatchLevel: 0, - Suffix: "-DEV", + Suffix: "", } From b7861e586eb3e35c56ff0580de244f939596f7f4 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Mon, 4 Nov 2024 16:19:39 +0000 Subject: [PATCH 030/470] releaser: Prepare repository for 0.138.0-DEV [ci skip] --- common/hugo/version_current.go | 4 ++-- hugoreleaser.env | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 991b54ac4..b265b6983 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 137, + Minor: 138, PatchLevel: 0, - Suffix: "", + Suffix: "-DEV", } diff --git a/hugoreleaser.env b/hugoreleaser.env index 590267381..e19674c16 100644 --- a/hugoreleaser.env +++ b/hugoreleaser.env @@ -1,7 +1,8 @@ # Release env. # These will be replaced by script before release. -HUGORELEASER_TAG=v0.136.5 -HUGORELEASER_COMMITISH=46cccb021bc6425455f4eec093f5cc4a32f1d12c +HUGORELEASER_TAG=v0.137.0 +HUGORELEASER_COMMITISH=59c115813595cba1b1c0e70b867e734992648d1b + From 801035bb7a38beae214105e872a4cdc49ac610ce Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Mon, 4 Nov 2024 11:11:46 -0800 Subject: [PATCH 031/470] tpl/tplimpl: Create an embedded comment shortcode Closes #13010 --- .../embedded/templates/shortcodes/comment.html | 1 + tpl/tplimpl/tplimpl_integration_test.go | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 tpl/tplimpl/embedded/templates/shortcodes/comment.html diff --git a/tpl/tplimpl/embedded/templates/shortcodes/comment.html b/tpl/tplimpl/embedded/templates/shortcodes/comment.html new file mode 100644 index 000000000..cb3293401 --- /dev/null +++ b/tpl/tplimpl/embedded/templates/shortcodes/comment.html @@ -0,0 +1 @@ +{{- $noop := .Inner -}} diff --git a/tpl/tplimpl/tplimpl_integration_test.go b/tpl/tplimpl/tplimpl_integration_test.go index a8599bbad..c7e118e82 100644 --- a/tpl/tplimpl/tplimpl_integration_test.go +++ b/tpl/tplimpl/tplimpl_integration_test.go @@ -584,3 +584,19 @@ title: p5 ``, ) } + +func TestCommentShortcode(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableKinds = ['page','rss','section','sitemap','taxonomy','term'] +-- layouts/index.html -- +{{ .Content }} +-- content/_index.md -- +a{{< comment >}}b{{< /comment >}}c +` + + b := hugolib.Test(t, files) + b.AssertFileContent("public/index.html", "

ac

") +} From 2b0b3b8584f5b6554f61b15fbe25dc664d9bcc7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 5 Nov 2024 09:14:19 +0100 Subject: [PATCH 032/470] commands: Print the "deploy not available" error message even if flags provided Fixes #13012 --- commands/deploy.go | 13 +-------- commands/deploy_flags.go | 33 +++++++++++++++++++++++ commands/deploy_off.go | 1 + main_withdeploy_off_test.go | 29 ++++++++++++++++++++ testscripts/withdeploy-off/deploy_off.txt | 3 +++ 5 files changed, 67 insertions(+), 12 deletions(-) create mode 100644 commands/deploy_flags.go create mode 100644 main_withdeploy_off_test.go create mode 100644 testscripts/withdeploy-off/deploy_off.txt diff --git a/commands/deploy.go b/commands/deploy.go index f9c22be48..eb419daba 100644 --- a/commands/deploy.go +++ b/commands/deploy.go @@ -20,7 +20,6 @@ import ( "context" "github.com/gohugoio/hugo/deploy" - "github.com/gohugoio/hugo/deploy/deployconfig" "github.com/bep/simplecobra" "github.com/spf13/cobra" @@ -47,17 +46,7 @@ documentation. return deployer.Deploy(ctx) }, withc: func(cmd *cobra.Command, r *rootCommand) { - cmd.ValidArgsFunction = cobra.NoFileCompletions - cmd.Flags().String("target", "", "target deployment from deployments section in config file; defaults to the first one") - _ = cmd.RegisterFlagCompletionFunc("target", cobra.NoFileCompletions) - cmd.Flags().Bool("confirm", false, "ask for confirmation before making changes to the target") - cmd.Flags().Bool("dryRun", false, "dry run") - cmd.Flags().Bool("force", false, "force upload of all files") - cmd.Flags().Bool("invalidateCDN", deployconfig.DefaultConfig.InvalidateCDN, "invalidate the CDN cache listed in the deployment target") - cmd.Flags().Int("maxDeletes", deployconfig.DefaultConfig.MaxDeletes, "maximum # of files to delete, or -1 to disable") - _ = cmd.RegisterFlagCompletionFunc("maxDeletes", cobra.NoFileCompletions) - cmd.Flags().Int("workers", deployconfig.DefaultConfig.Workers, "number of workers to transfer files. defaults to 10") - _ = cmd.RegisterFlagCompletionFunc("workers", cobra.NoFileCompletions) + applyDeployFlags(cmd, r) }, } } diff --git a/commands/deploy_flags.go b/commands/deploy_flags.go new file mode 100644 index 000000000..d4326547a --- /dev/null +++ b/commands/deploy_flags.go @@ -0,0 +1,33 @@ +// Copyright 2024 The Hugo Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package commands + +import ( + "github.com/gohugoio/hugo/deploy/deployconfig" + "github.com/spf13/cobra" +) + +func applyDeployFlags(cmd *cobra.Command, r *rootCommand) { + cmd.ValidArgsFunction = cobra.NoFileCompletions + cmd.Flags().String("target", "", "target deployment from deployments section in config file; defaults to the first one") + _ = cmd.RegisterFlagCompletionFunc("target", cobra.NoFileCompletions) + cmd.Flags().Bool("confirm", false, "ask for confirmation before making changes to the target") + cmd.Flags().Bool("dryRun", false, "dry run") + cmd.Flags().Bool("force", false, "force upload of all files") + cmd.Flags().Bool("invalidateCDN", deployconfig.DefaultConfig.InvalidateCDN, "invalidate the CDN cache listed in the deployment target") + cmd.Flags().Int("maxDeletes", deployconfig.DefaultConfig.MaxDeletes, "maximum # of files to delete, or -1 to disable") + _ = cmd.RegisterFlagCompletionFunc("maxDeletes", cobra.NoFileCompletions) + cmd.Flags().Int("workers", deployconfig.DefaultConfig.Workers, "number of workers to transfer files. defaults to 10") + _ = cmd.RegisterFlagCompletionFunc("workers", cobra.NoFileCompletions) +} diff --git a/commands/deploy_off.go b/commands/deploy_off.go index 7eb6429c5..32a08da2e 100644 --- a/commands/deploy_off.go +++ b/commands/deploy_off.go @@ -44,6 +44,7 @@ func newDeployCommand() simplecobra.Commander { return errors.New("deploy not supported in this version of Hugo; install a release with 'withdeploy' in the archive filename or build yourself with the 'withdeploy' build tag. Also see https://github.com/gohugoio/hugo/pull/12995") }, withc: func(cmd *cobra.Command, r *rootCommand) { + applyDeployFlags(cmd, r) cmd.Hidden = true }, } diff --git a/main_withdeploy_off_test.go b/main_withdeploy_off_test.go new file mode 100644 index 000000000..490ccd693 --- /dev/null +++ b/main_withdeploy_off_test.go @@ -0,0 +1,29 @@ +// Copyright 2024 The Hugo Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !withdeploy +// +build !withdeploy + +package main + +import ( + "testing" + + "github.com/rogpeppe/go-internal/testscript" +) + +func TestWithdeploy(t *testing.T) { + p := commonTestScriptsParam + p.Dir = "testscripts/withdeploy-off" + testscript.Run(t, p) +} diff --git a/testscripts/withdeploy-off/deploy_off.txt b/testscripts/withdeploy-off/deploy_off.txt new file mode 100644 index 000000000..5e6c65d27 --- /dev/null +++ b/testscripts/withdeploy-off/deploy_off.txt @@ -0,0 +1,3 @@ +! hugo deploy --force +# Issue 13012 +stderr 'deploy not supported in this version of Hugo' \ No newline at end of file From 94b46c36b4c808e47ac0727f4fbaae74705f4483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 5 Nov 2024 09:19:16 +0100 Subject: [PATCH 033/470] build: Add missing withdeploy archive for Windows Fixes #13009 --- hugoreleaser.toml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/hugoreleaser.toml b/hugoreleaser.toml index 8c3693739..2cb8e3665 100644 --- a/hugoreleaser.toml +++ b/hugoreleaser.toml @@ -185,6 +185,25 @@ archive_alias_replacements = { "linux-amd64.tar.gz" = "Linux-64bit.tar.gz" } [[builds.os.archs]] goarch = "amd64" +[[builds]] + path = "container1/windows/extended-withdeploy" + + [builds.build_settings] + flags = ["-buildmode", "exe", "-tags", "extended,withdeploy"] + env = [ + "CGO_ENABLED=1", + "CC=x86_64-w64-mingw32-gcc", + "CXX=x86_64-w64-mingw32-g++", + ] + ldflags = "-s -w -X github.com/gohugoio/hugo/common/hugo.vendorInfo=gohugoio -extldflags '-static'" + + [[builds.os]] + goos = "windows" + [builds.os.build_settings] + binary = "hugo.exe" + [[builds.os.archs]] + goarch = "amd64" + [[archives]] paths = ["builds/container1/unix/regular/**"] [[archives]] @@ -212,6 +231,13 @@ archive_alias_replacements = { "linux-amd64.tar.gz" = "Linux-64bit.tar.gz" } [archives.archive_settings.type] format = "zip" extension = ".zip" +[[archives]] + paths = ["builds/**/windows/extended-withdeploy/**"] + [archives.archive_settings] + name_template = "{{ .Project }}_extended_withdeploy_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" + [archives.archive_settings.type] + format = "zip" + extension = ".zip" [[archives]] paths = ["builds/**/regular/linux/{arm64,amd64}"] [archives.archive_settings] From 4faaaf9c2ffb8ceab0630a66136da852d88e651f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 5 Nov 2024 09:29:10 +0100 Subject: [PATCH 034/470] markup: Goldmark log "Raw HTML omitted" warning also for inline HTML Fixes #13013 --- markup/goldmark/goldmark_integration_test.go | 26 +++++++++++- markup/goldmark/hugocontext/hugocontext.go | 44 ++++++++++++++++---- 2 files changed, 62 insertions(+), 8 deletions(-) diff --git a/markup/goldmark/goldmark_integration_test.go b/markup/goldmark/goldmark_integration_test.go index 8b7cc5a54..82579069b 100644 --- a/markup/goldmark/goldmark_integration_test.go +++ b/markup/goldmark/goldmark_integration_test.go @@ -804,7 +804,7 @@ H~2~0 } // Issue 12997. -func TestGoldmarkRawHTMLWarning(t *testing.T) { +func TestGoldmarkRawHTMLWarningBlocks(t *testing.T) { files := ` -- hugo.toml -- disableKinds = ['home','rss','section','sitemap','taxonomy','term'] @@ -827,3 +827,27 @@ title: "p1" b.AssertFileContent("public/p1/index.html", "! ") b.AssertLogContains("! WARN") } + +func TestGoldmarkRawHTMLWarningInline(t *testing.T) { + files := ` +-- hugo.toml -- +disableKinds = ['home','rss','section','sitemap','taxonomy','term'] +markup.goldmark.renderer.unsafe = false +-- content/p1.md -- +--- +title: "p1" +--- +raw HTML +-- layouts/_default/single.html -- +{{ .Content }} +` + + b := hugolib.Test(t, files, hugolib.TestOptWarn()) + + b.AssertFileContent("public/p1/index.html", "") + b.AssertLogContains("WARN Raw HTML omitted from \"/content/p1.md\"; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe\nYou can suppress this warning by adding the following to your site configuration:\nignoreLogs = ['warning-goldmark-raw-html']") + + b = hugolib.Test(t, strings.ReplaceAll(files, "markup.goldmark.renderer.unsafe = false", "markup.goldmark.renderer.unsafe = true"), hugolib.TestOptWarn()) + b.AssertFileContent("public/p1/index.html", "! ") + b.AssertLogContains("! WARN") +} diff --git a/markup/goldmark/hugocontext/hugocontext.go b/markup/goldmark/hugocontext/hugocontext.go index 4971456be..a10e095ef 100644 --- a/markup/goldmark/hugocontext/hugocontext.go +++ b/markup/goldmark/hugocontext/hugocontext.go @@ -145,6 +145,7 @@ func (r *hugoContextRenderer) SetOption(name renderer.OptionName, value any) { func (r *hugoContextRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer) { reg.Register(kindHugoContext, r.handleHugoContext) + reg.Register(ast.KindRawHTML, r.renderRawHTML) reg.Register(ast.KindHTMLBlock, r.renderHTMLBlock) } @@ -155,16 +156,25 @@ func (r *hugoContextRenderer) stripHugoCtx(b []byte) ([]byte, bool) { return hugoCtxRe.ReplaceAll(b, nil), true } +func (r *hugoContextRenderer) logRawHTMLEmittedWarn(w util.BufWriter) { + r.logger.Warnidf(constants.WarnGoldmarkRawHTML, "Raw HTML omitted from %q; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe", r.getPage(w)) +} + +func (r *hugoContextRenderer) getPage(w util.BufWriter) any { + var p any + ctx, ok := w.(*render.Context) + if ok { + p, _ = render.GetPageAndPageInner(ctx) + } + return p +} + +// HTML rendering based on Goldmark implementation. func (r *hugoContextRenderer) renderHTMLBlock( w util.BufWriter, source []byte, node ast.Node, entering bool, ) (ast.WalkStatus, error) { n := node.(*ast.HTMLBlock) if entering { - var p any - ctx, ok := w.(*render.Context) - if ok { - p, _ = render.GetPageAndPageInner(ctx) - } if r.Unsafe { l := n.Lines().Len() for i := 0; i < l; i++ { @@ -173,12 +183,12 @@ func (r *hugoContextRenderer) renderHTMLBlock( var stripped bool linev, stripped = r.stripHugoCtx(linev) if stripped { - r.logger.Warnidf(constants.WarnRenderShortcodesInHTML, ".RenderShortcodes detected inside HTML block in %q; this may not be what you intended, see https://gohugo.io/methods/page/rendershortcodes/#limitations", p) + r.logger.Warnidf(constants.WarnRenderShortcodesInHTML, ".RenderShortcodes detected inside HTML block in %q; this may not be what you intended, see https://gohugo.io/methods/page/rendershortcodes/#limitations", r.getPage(w)) } r.Writer.SecureWrite(w, linev) } } else { - r.logger.Warnidf(constants.WarnGoldmarkRawHTML, "Raw HTML omitted from %q; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe", p) + r.logRawHTMLEmittedWarn(w) _, _ = w.WriteString("\n") } } else { @@ -194,6 +204,26 @@ func (r *hugoContextRenderer) renderHTMLBlock( return ast.WalkContinue, nil } +func (r *hugoContextRenderer) renderRawHTML( + w util.BufWriter, source []byte, node ast.Node, entering bool, +) (ast.WalkStatus, error) { + if !entering { + return ast.WalkSkipChildren, nil + } + if r.Unsafe { + n := node.(*ast.RawHTML) + l := n.Segments.Len() + for i := 0; i < l; i++ { + segment := n.Segments.At(i) + _, _ = w.Write(segment.Value(source)) + } + return ast.WalkSkipChildren, nil + } + r.logRawHTMLEmittedWarn(w) + _, _ = w.WriteString("") + return ast.WalkSkipChildren, nil +} + func (r *hugoContextRenderer) handleHugoContext(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { if !entering { return ast.WalkContinue, nil From ca4fc587c368e5a4f85a6514b9fd5e00153847ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 5 Nov 2024 09:57:12 +0100 Subject: [PATCH 035/470] common/hugo: Add withdeploy to the version string printed in hugo version --- common/hugo/vars_withdeploy.go | 19 +++++++++++++++++++ common/hugo/vars_withdeploy_off.go | 19 +++++++++++++++++++ common/hugo/version.go | 3 +++ 3 files changed, 41 insertions(+) create mode 100644 common/hugo/vars_withdeploy.go create mode 100644 common/hugo/vars_withdeploy_off.go diff --git a/common/hugo/vars_withdeploy.go b/common/hugo/vars_withdeploy.go new file mode 100644 index 000000000..88ce9a1cd --- /dev/null +++ b/common/hugo/vars_withdeploy.go @@ -0,0 +1,19 @@ +// Copyright 2024 The Hugo Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build withdeploy +// +build withdeploy + +package hugo + +var IsWithdeploy = true diff --git a/common/hugo/vars_withdeploy_off.go b/common/hugo/vars_withdeploy_off.go new file mode 100644 index 000000000..935568027 --- /dev/null +++ b/common/hugo/vars_withdeploy_off.go @@ -0,0 +1,19 @@ +// Copyright 2024 The Hugo Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !withdeploy +// +build !withdeploy + +package hugo + +var IsWithdeploy = false diff --git a/common/hugo/version.go b/common/hugo/version.go index 6cabfdbb9..cf5988840 100644 --- a/common/hugo/version.go +++ b/common/hugo/version.go @@ -152,6 +152,9 @@ func BuildVersionString() string { if IsExtended { version += "+extended" } + if IsWithdeploy { + version += "+withdeploy" + } osArch := bi.GoOS + "/" + bi.GoArch From 17e15b2148cee6da923acd7adf2ec31ea6b3415c Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Tue, 5 Nov 2024 11:49:09 +0000 Subject: [PATCH 036/470] releaser: Bump versions for release of 0.137.1 [ci skip] --- common/hugo/version_current.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index b265b6983..cc758c184 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 138, - PatchLevel: 0, - Suffix: "-DEV", + Minor: 137, + PatchLevel: 1, + Suffix: "", } From df8bd4af4f49aec04d039d17ad970058f3b4e1bc Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Tue, 5 Nov 2024 12:04:27 +0000 Subject: [PATCH 037/470] releaser: Prepare repository for 0.138.0-DEV [ci skip] --- common/hugo/version_current.go | 6 +++--- hugoreleaser.env | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index cc758c184..b265b6983 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 137, - PatchLevel: 1, - Suffix: "", + Minor: 138, + PatchLevel: 0, + Suffix: "-DEV", } diff --git a/hugoreleaser.env b/hugoreleaser.env index e19674c16..4bebe0e2a 100644 --- a/hugoreleaser.env +++ b/hugoreleaser.env @@ -1,7 +1,8 @@ # Release env. # These will be replaced by script before release. -HUGORELEASER_TAG=v0.137.0 -HUGORELEASER_COMMITISH=59c115813595cba1b1c0e70b867e734992648d1b +HUGORELEASER_TAG=v0.137.1 +HUGORELEASER_COMMITISH=17e15b2148cee6da923acd7adf2ec31ea6b3415c + From 2c3efc81064a6e0bdde3d02629f06ca87a7d2c08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 5 Nov 2024 16:32:57 +0100 Subject: [PATCH 038/470] Alias Page.Scratch to Page.Store (note) Fixes #13016 --- common/maps/scratch.go | 19 ------------------- hugolib/page.go | 3 +-- hugolib/page__common.go | 6 +++++- hugolib/page__new.go | 1 - hugolib/page_test.go | 26 ++++++++++++++++++++++++++ resources/page/page.go | 4 +++- 6 files changed, 35 insertions(+), 24 deletions(-) diff --git a/common/maps/scratch.go b/common/maps/scratch.go index e9f412540..638377216 100644 --- a/common/maps/scratch.go +++ b/common/maps/scratch.go @@ -28,25 +28,6 @@ type Scratch struct { mu sync.RWMutex } -// Scratcher provides a scratching service. -type Scratcher interface { - // Scratch returns a "scratch pad" that can be used to store state. - Scratch() *Scratch -} - -type scratcher struct { - s *Scratch -} - -func (s scratcher) Scratch() *Scratch { - return s.s -} - -// NewScratcher creates a new Scratcher. -func NewScratcher() Scratcher { - return scratcher{s: NewScratch()} -} - // Add will, for single values, add (using the + operator) the addend to the existing addend (if found). // Supports numeric values and strings. // diff --git a/hugolib/page.go b/hugolib/page.go index 2bc1da044..e4c841966 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -38,7 +38,6 @@ import ( "github.com/gohugoio/hugo/tpl" "github.com/gohugoio/hugo/common/herrors" - "github.com/gohugoio/hugo/common/maps" "github.com/gohugoio/hugo/common/types" "github.com/gohugoio/hugo/source" @@ -149,7 +148,7 @@ func (p *pageState) Key() string { } func (p *pageState) resetBuildState() { - p.Scratcher = maps.NewScratcher() + // Nothing to do for now. } func (p *pageState) reusePageOutputContent() bool { diff --git a/hugolib/page__common.go b/hugolib/page__common.go index d3b0bd112..55465e214 100644 --- a/hugolib/page__common.go +++ b/hugolib/page__common.go @@ -56,7 +56,6 @@ type pageCommon struct { store *maps.Scratch // All of these represents the common parts of a page.Page - maps.Scratcher navigation.PageMenusProvider page.AuthorProvider page.AlternativeOutputFormatsProvider @@ -113,3 +112,8 @@ type pageCommon struct { func (p *pageCommon) Store() *maps.Scratch { return p.store } + +// See issue 13016. +func (p *pageCommon) Scratch() *maps.Scratch { + return p.Store() +} diff --git a/hugolib/page__new.go b/hugolib/page__new.go index 9a4972d07..9a11fa889 100644 --- a/hugolib/page__new.go +++ b/hugolib/page__new.go @@ -184,7 +184,6 @@ func (h *HugoSites) doNewPage(m *pageMeta) (*pageState, *paths.Path, error) { pageCommon: &pageCommon{ FileProvider: m, AuthorProvider: m, - Scratcher: maps.NewScratcher(), store: maps.NewScratch(), Positioner: page.NopPage, InSectionPositioner: page.NopPage, diff --git a/hugolib/page_test.go b/hugolib/page_test.go index 429ab2659..bdd1be6f7 100644 --- a/hugolib/page_test.go +++ b/hugolib/page_test.go @@ -1688,6 +1688,32 @@ title: Scratch Me! b.AssertFileContent("public/scratchme/index.html", "C: cv") } +// Issue 13016. +func TestScratchAliasToStore(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableKinds = ["taxonomy", "term", "page", "section"] +disableLiveReload = true +-- layouts/index.html -- +{{ .Scratch.Set "a" "b" }} +{{ .Store.Set "c" "d" }} +.Scratch eq .Store: {{ eq .Scratch .Store }} +a: {{ .Store.Get "a" }} +c: {{ .Scratch.Get "c" }} + +` + + b := Test(t, files) + + b.AssertFileContent("public/index.html", + ".Scratch eq .Store: true", + "a: b", + "c: d", + ) +} + func TestPageParam(t *testing.T) { t.Parallel() diff --git a/resources/page/page.go b/resources/page/page.go index 20525669c..ea7f4bf1b 100644 --- a/resources/page/page.go +++ b/resources/page/page.go @@ -327,7 +327,9 @@ type PageWithoutContent interface { // Scratch returns a Scratch that can be used to store temporary state. // Note that this Scratch gets reset on server rebuilds. See Store() for a variant that survives. - maps.Scratcher + // Scratch returns a "scratch pad" that can be used to store state. + // Deprecated: From Hugo v0.138.0 this is just an alias for Store. + Scratch() *maps.Scratch // Store returns a Scratch that can be used to store temporary state. // In contrast to Scratch(), this Scratch is not reset on server rebuilds. From 95e2d5beb8cc5937792e1ed15589434987590e39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 6 Nov 2024 10:17:34 +0100 Subject: [PATCH 039/470] Fix concurrent map read and map write in short page lookups Regression introduced in Hugo `v0.137.0`. Fixes #13019 --- common/maps/cache.go | 54 +++++++++++++++++++++++-- hugolib/content_map_page.go | 78 ++++++++++++++++++------------------- hugolib/content_map_test.go | 76 ++++++++++++++++++++++++++++++++++++ lazy/init.go | 2 +- lazy/once.go | 10 ++--- 5 files changed, 170 insertions(+), 50 deletions(-) diff --git a/common/maps/cache.go b/common/maps/cache.go index 0175974b5..cdc31a684 100644 --- a/common/maps/cache.go +++ b/common/maps/cache.go @@ -13,11 +13,14 @@ package maps -import "sync" +import ( + "sync" +) // Cache is a simple thread safe cache backed by a map. type Cache[K comparable, T any] struct { - m map[K]T + m map[K]T + hasBeenInitialized bool sync.RWMutex } @@ -34,11 +37,16 @@ func (c *Cache[K, T]) Get(key K) (T, bool) { return zero, false } c.RLock() - v, found := c.m[key] + v, found := c.get(key) c.RUnlock() return v, found } +func (c *Cache[K, T]) get(key K) (T, bool) { + v, found := c.m[key] + return v, found +} + // GetOrCreate gets the value for the given key if it exists, or creates it if not. func (c *Cache[K, T]) GetOrCreate(key K, create func() (T, error)) (T, error) { c.RLock() @@ -61,13 +69,49 @@ func (c *Cache[K, T]) GetOrCreate(key K, create func() (T, error)) (T, error) { return v, nil } +// InitAndGet initializes the cache if not already done and returns the value for the given key. +// The init state will be reset on Reset or Drain. +func (c *Cache[K, T]) InitAndGet(key K, init func(get func(key K) (T, bool), set func(key K, value T)) error) (T, error) { + var v T + c.RLock() + if !c.hasBeenInitialized { + c.RUnlock() + if err := func() error { + c.Lock() + defer c.Unlock() + // Double check in case another goroutine has initialized it in the meantime. + if !c.hasBeenInitialized { + err := init(c.get, c.set) + if err != nil { + return err + } + c.hasBeenInitialized = true + } + return nil + }(); err != nil { + return v, err + } + // Reacquire the read lock. + c.RLock() + } + + v = c.m[key] + c.RUnlock() + + return v, nil +} + // Set sets the given key to the given value. func (c *Cache[K, T]) Set(key K, value T) { c.Lock() - c.m[key] = value + c.set(key, value) c.Unlock() } +func (c *Cache[K, T]) set(key K, value T) { + c.m[key] = value +} + // ForEeach calls the given function for each key/value pair in the cache. func (c *Cache[K, T]) ForEeach(f func(K, T)) { c.RLock() @@ -81,6 +125,7 @@ func (c *Cache[K, T]) Drain() map[K]T { c.Lock() m := c.m c.m = make(map[K]T) + c.hasBeenInitialized = false c.Unlock() return m } @@ -94,6 +139,7 @@ func (c *Cache[K, T]) Len() int { func (c *Cache[K, T]) Reset() { c.Lock() c.m = make(map[K]T) + c.hasBeenInitialized = false c.Unlock() } diff --git a/hugolib/content_map_page.go b/hugolib/content_map_page.go index 5e8646b21..8c9e4a31a 100644 --- a/hugolib/content_map_page.go +++ b/hugolib/content_map_page.go @@ -37,7 +37,6 @@ import ( "github.com/gohugoio/hugo/hugolib/doctree" "github.com/gohugoio/hugo/hugolib/pagesfromdata" "github.com/gohugoio/hugo/identity" - "github.com/gohugoio/hugo/lazy" "github.com/gohugoio/hugo/media" "github.com/gohugoio/hugo/output" "github.com/gohugoio/hugo/resources" @@ -925,59 +924,58 @@ func newPageMap(i int, s *Site, mcache *dynacache.Cache, pageTrees *pageTrees) * s: s, } - m.pageReverseIndex = &contentTreeReverseIndex{ - initFn: func(rm map[any]contentNodeI) { - add := func(k string, n contentNodeI) { - existing, found := rm[k] - if found && existing != ambiguousContentNode { - rm[k] = ambiguousContentNode - } else if !found { - rm[k] = n + m.pageReverseIndex = newContentTreeTreverseIndex(func(get func(key any) (contentNodeI, bool), set func(key any, val contentNodeI)) { + add := func(k string, n contentNodeI) { + existing, found := get(k) + if found && existing != ambiguousContentNode { + set(k, ambiguousContentNode) + } else if !found { + set(k, n) + } + } + + w := &doctree.NodeShiftTreeWalker[contentNodeI]{ + Tree: m.treePages, + LockType: doctree.LockTypeRead, + Handle: func(s string, n contentNodeI, match doctree.DimensionFlag) (bool, error) { + p := n.(*pageState) + if p.PathInfo() != nil { + add(p.PathInfo().BaseNameNoIdentifier(), p) } - } + return false, nil + }, + } - w := &doctree.NodeShiftTreeWalker[contentNodeI]{ - Tree: m.treePages, - LockType: doctree.LockTypeRead, - Handle: func(s string, n contentNodeI, match doctree.DimensionFlag) (bool, error) { - p := n.(*pageState) - if p.PathInfo() != nil { - add(p.PathInfo().BaseNameNoIdentifier(), p) - } - return false, nil - }, - } - - if err := w.Walk(context.Background()); err != nil { - panic(err) - } - }, - contentTreeReverseIndexMap: &contentTreeReverseIndexMap{}, - } + if err := w.Walk(context.Background()); err != nil { + panic(err) + } + }) return m } +func newContentTreeTreverseIndex(init func(get func(key any) (contentNodeI, bool), set func(key any, val contentNodeI))) *contentTreeReverseIndex { + return &contentTreeReverseIndex{ + initFn: init, + mm: maps.NewCache[any, contentNodeI](), + } +} + type contentTreeReverseIndex struct { - initFn func(rm map[any]contentNodeI) - *contentTreeReverseIndexMap + initFn func(get func(key any) (contentNodeI, bool), set func(key any, val contentNodeI)) + mm *maps.Cache[any, contentNodeI] } func (c *contentTreeReverseIndex) Reset() { - c.init.ResetWithLock().Unlock() + c.mm.Reset() } func (c *contentTreeReverseIndex) Get(key any) contentNodeI { - c.init.Do(func() { - c.m = make(map[any]contentNodeI) - c.initFn(c.contentTreeReverseIndexMap.m) + v, _ := c.mm.InitAndGet(key, func(get func(key any) (contentNodeI, bool), set func(key any, val contentNodeI)) error { + c.initFn(get, set) + return nil }) - return c.m[key] -} - -type contentTreeReverseIndexMap struct { - init lazy.OnceMore - m map[any]contentNodeI + return v } type sitePagesAssembler struct { diff --git a/hugolib/content_map_test.go b/hugolib/content_map_test.go index bf9920071..a9f719f4a 100644 --- a/hugolib/content_map_test.go +++ b/hugolib/content_map_test.go @@ -17,9 +17,11 @@ import ( "fmt" "path/filepath" "strings" + "sync" "testing" qt "github.com/frankban/quicktest" + "github.com/gohugoio/hugo/identity" ) func TestContentMapSite(t *testing.T) { @@ -396,3 +398,77 @@ irrelevant "https://example.org/en/sitemap.xml", ) } + +func TestContentTreeReverseIndex(t *testing.T) { + t.Parallel() + + c := qt.New(t) + + pageReverseIndex := newContentTreeTreverseIndex( + func(get func(key any) (contentNodeI, bool), set func(key any, val contentNodeI)) { + for i := 0; i < 10; i++ { + key := fmt.Sprint(i) + set(key, &testContentNode{key: key}) + } + }, + ) + + for i := 0; i < 10; i++ { + key := fmt.Sprint(i) + v := pageReverseIndex.Get(key) + c.Assert(v, qt.Not(qt.IsNil)) + c.Assert(v.Path(), qt.Equals, key) + } +} + +// Issue 13019. +func TestContentTreeReverseIndexPara(t *testing.T) { + t.Parallel() + + var wg sync.WaitGroup + + for i := 0; i < 10; i++ { + pageReverseIndex := newContentTreeTreverseIndex( + func(get func(key any) (contentNodeI, bool), set func(key any, val contentNodeI)) { + for i := 0; i < 10; i++ { + key := fmt.Sprint(i) + set(key, &testContentNode{key: key}) + } + }, + ) + + for j := 0; j < 10; j++ { + wg.Add(1) + go func(i int) { + defer wg.Done() + pageReverseIndex.Get(fmt.Sprint(i)) + }(j) + } + } +} + +type testContentNode struct { + key string +} + +func (n *testContentNode) GetIdentity() identity.Identity { + return identity.StringIdentity(n.key) +} + +func (n *testContentNode) ForEeachIdentity(cb func(id identity.Identity) bool) bool { + panic("not supported") +} + +func (n *testContentNode) Path() string { + return n.key +} + +func (n *testContentNode) isContentNodeBranch() bool { + return false +} + +func (n *testContentNode) resetBuildState() { +} + +func (n *testContentNode) MarkStale() { +} diff --git a/lazy/init.go b/lazy/init.go index bef3867a9..7b88a5351 100644 --- a/lazy/init.go +++ b/lazy/init.go @@ -36,7 +36,7 @@ type Init struct { prev *Init children []*Init - init OnceMore + init onceMore out any err error f func(context.Context) (any, error) diff --git a/lazy/once.go b/lazy/once.go index dac689df3..cea096652 100644 --- a/lazy/once.go +++ b/lazy/once.go @@ -24,13 +24,13 @@ import ( // * it can be reset, so the action can be repeated if needed // * it has methods to check if it's done or in progress -type OnceMore struct { +type onceMore struct { mu sync.Mutex lock uint32 done uint32 } -func (t *OnceMore) Do(f func()) { +func (t *onceMore) Do(f func()) { if atomic.LoadUint32(&t.done) == 1 { return } @@ -53,15 +53,15 @@ func (t *OnceMore) Do(f func()) { f() } -func (t *OnceMore) InProgress() bool { +func (t *onceMore) InProgress() bool { return atomic.LoadUint32(&t.lock) == 1 } -func (t *OnceMore) Done() bool { +func (t *onceMore) Done() bool { return atomic.LoadUint32(&t.done) == 1 } -func (t *OnceMore) ResetWithLock() *sync.Mutex { +func (t *onceMore) ResetWithLock() *sync.Mutex { t.mu.Lock() defer atomic.StoreUint32(&t.done, 0) return &t.mu From ad82998d54b3f9f8c2741b67356813b55b3134b9 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Wed, 6 Nov 2024 11:22:34 +0000 Subject: [PATCH 040/470] releaser: Bump versions for release of 0.138.0 [ci skip] --- common/hugo/version_current.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index b265b6983..eb754f581 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -19,5 +19,5 @@ var CurrentVersion = Version{ Major: 0, Minor: 138, PatchLevel: 0, - Suffix: "-DEV", + Suffix: "", } From 35afe6fe2ab6b29f4cc1a538ff245ee66b067dd8 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Wed, 6 Nov 2024 11:36:12 +0000 Subject: [PATCH 041/470] releaser: Prepare repository for 0.139.0-DEV [ci skip] --- common/hugo/version_current.go | 4 ++-- hugoreleaser.env | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index eb754f581..955c2f91a 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 138, + Minor: 139, PatchLevel: 0, - Suffix: "", + Suffix: "-DEV", } diff --git a/hugoreleaser.env b/hugoreleaser.env index 4bebe0e2a..d44c55d03 100644 --- a/hugoreleaser.env +++ b/hugoreleaser.env @@ -1,7 +1,8 @@ # Release env. # These will be replaced by script before release. -HUGORELEASER_TAG=v0.137.1 -HUGORELEASER_COMMITISH=17e15b2148cee6da923acd7adf2ec31ea6b3415c +HUGORELEASER_TAG=v0.138.0 +HUGORELEASER_COMMITISH=ad82998d54b3f9f8c2741b67356813b55b3134b9 + From 2b97a2a8bf2dbb9c8277b14f7f7bf824b5a58516 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Thu, 7 Nov 2024 12:19:59 -0800 Subject: [PATCH 042/470] markup/goldmark: Improve the raw HTML omitted warning Closes #13023 --- markup/goldmark/goldmark_integration_test.go | 4 ++-- markup/goldmark/hugocontext/hugocontext.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/markup/goldmark/goldmark_integration_test.go b/markup/goldmark/goldmark_integration_test.go index 82579069b..17b76360d 100644 --- a/markup/goldmark/goldmark_integration_test.go +++ b/markup/goldmark/goldmark_integration_test.go @@ -821,7 +821,7 @@ title: "p1" b := hugolib.Test(t, files, hugolib.TestOptWarn()) b.AssertFileContent("public/p1/index.html", "") - b.AssertLogContains("WARN Raw HTML omitted from \"/content/p1.md\"; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe\nYou can suppress this warning by adding the following to your site configuration:\nignoreLogs = ['warning-goldmark-raw-html']") + b.AssertLogContains("WARN Raw HTML omitted white rendering \"/content/p1.md\"; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe\nYou can suppress this warning by adding the following to your site configuration:\nignoreLogs = ['warning-goldmark-raw-html']") b = hugolib.Test(t, strings.ReplaceAll(files, "markup.goldmark.renderer.unsafe = false", "markup.goldmark.renderer.unsafe = true"), hugolib.TestOptWarn()) b.AssertFileContent("public/p1/index.html", "! ") @@ -845,7 +845,7 @@ title: "p1" b := hugolib.Test(t, files, hugolib.TestOptWarn()) b.AssertFileContent("public/p1/index.html", "") - b.AssertLogContains("WARN Raw HTML omitted from \"/content/p1.md\"; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe\nYou can suppress this warning by adding the following to your site configuration:\nignoreLogs = ['warning-goldmark-raw-html']") + b.AssertLogContains("WARN Raw HTML omitted white rendering \"/content/p1.md\"; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe\nYou can suppress this warning by adding the following to your site configuration:\nignoreLogs = ['warning-goldmark-raw-html']") b = hugolib.Test(t, strings.ReplaceAll(files, "markup.goldmark.renderer.unsafe = false", "markup.goldmark.renderer.unsafe = true"), hugolib.TestOptWarn()) b.AssertFileContent("public/p1/index.html", "! ") diff --git a/markup/goldmark/hugocontext/hugocontext.go b/markup/goldmark/hugocontext/hugocontext.go index a10e095ef..4098392c4 100644 --- a/markup/goldmark/hugocontext/hugocontext.go +++ b/markup/goldmark/hugocontext/hugocontext.go @@ -157,7 +157,7 @@ func (r *hugoContextRenderer) stripHugoCtx(b []byte) ([]byte, bool) { } func (r *hugoContextRenderer) logRawHTMLEmittedWarn(w util.BufWriter) { - r.logger.Warnidf(constants.WarnGoldmarkRawHTML, "Raw HTML omitted from %q; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe", r.getPage(w)) + r.logger.Warnidf(constants.WarnGoldmarkRawHTML, "Raw HTML omitted white rendering %q; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe", r.getPage(w)) } func (r *hugoContextRenderer) getPage(w util.BufWriter) any { From e79ee0d5167707d891c80906e71daa098c9e46af Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Wed, 13 Nov 2024 10:12:26 +0100 Subject: [PATCH 043/470] markup/goldmark: Fix typo in error message --- markup/goldmark/goldmark_integration_test.go | 4 ++-- markup/goldmark/hugocontext/hugocontext.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/markup/goldmark/goldmark_integration_test.go b/markup/goldmark/goldmark_integration_test.go index 17b76360d..794f34150 100644 --- a/markup/goldmark/goldmark_integration_test.go +++ b/markup/goldmark/goldmark_integration_test.go @@ -821,7 +821,7 @@ title: "p1" b := hugolib.Test(t, files, hugolib.TestOptWarn()) b.AssertFileContent("public/p1/index.html", "") - b.AssertLogContains("WARN Raw HTML omitted white rendering \"/content/p1.md\"; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe\nYou can suppress this warning by adding the following to your site configuration:\nignoreLogs = ['warning-goldmark-raw-html']") + b.AssertLogContains("WARN Raw HTML omitted while rendering \"/content/p1.md\"; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe\nYou can suppress this warning by adding the following to your site configuration:\nignoreLogs = ['warning-goldmark-raw-html']") b = hugolib.Test(t, strings.ReplaceAll(files, "markup.goldmark.renderer.unsafe = false", "markup.goldmark.renderer.unsafe = true"), hugolib.TestOptWarn()) b.AssertFileContent("public/p1/index.html", "! ") @@ -845,7 +845,7 @@ title: "p1" b := hugolib.Test(t, files, hugolib.TestOptWarn()) b.AssertFileContent("public/p1/index.html", "") - b.AssertLogContains("WARN Raw HTML omitted white rendering \"/content/p1.md\"; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe\nYou can suppress this warning by adding the following to your site configuration:\nignoreLogs = ['warning-goldmark-raw-html']") + b.AssertLogContains("WARN Raw HTML omitted while rendering \"/content/p1.md\"; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe\nYou can suppress this warning by adding the following to your site configuration:\nignoreLogs = ['warning-goldmark-raw-html']") b = hugolib.Test(t, strings.ReplaceAll(files, "markup.goldmark.renderer.unsafe = false", "markup.goldmark.renderer.unsafe = true"), hugolib.TestOptWarn()) b.AssertFileContent("public/p1/index.html", "! ") diff --git a/markup/goldmark/hugocontext/hugocontext.go b/markup/goldmark/hugocontext/hugocontext.go index 4098392c4..b1f149d0b 100644 --- a/markup/goldmark/hugocontext/hugocontext.go +++ b/markup/goldmark/hugocontext/hugocontext.go @@ -157,7 +157,7 @@ func (r *hugoContextRenderer) stripHugoCtx(b []byte) ([]byte, bool) { } func (r *hugoContextRenderer) logRawHTMLEmittedWarn(w util.BufWriter) { - r.logger.Warnidf(constants.WarnGoldmarkRawHTML, "Raw HTML omitted white rendering %q; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe", r.getPage(w)) + r.logger.Warnidf(constants.WarnGoldmarkRawHTML, "Raw HTML omitted while rendering %q; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe", r.getPage(w)) } func (r *hugoContextRenderer) getPage(w util.BufWriter) any { From de0df119b504a91c9e1f442b07954f366ffb2932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 13 Nov 2024 11:07:57 +0100 Subject: [PATCH 044/470] Squashed 'docs/' changes from ccb1b97cb..159c843fd 159c843fd Fix front matter menu entry example c3a476a19 Document soft deprecation of PAGE.Scratch cdead9785 netlify: Hugo 0.138.0 9169b4da4 Update version references 3bc6bf431 Update embedded.md 5c7743b2e Update creation instructions for the emoji quick reference 109efe3eb Document the comment shortcode 83d7d3005 Update theme d3c205054 netlify: Hugo 0.137.1 545290351 Handle inline HTML content 0204be97d Update theme 18d09235e Remove JS and CSS that prevents FOUC with client side math rendering 63d9dd876 Update RenderShortcodes.md 064b95539 Update output-format-definition.md 3744f3be2 Describe and refer to the extended/deploy edition 3d3302308 netlify: Hugo 0.137.0 b53aedcea Update RenderShortcodes.md b5f289165 Replace HTML comments in markdown with the new comment shortcode c673880b6 Remove superfluous right bracket f80b0c61e Update faq.md 2ede707eb Document installation on NixOS 09b114914 Update theme 76a9f90b2 Update passthrough.md 9f3355630 Update Scratch.md bc080ecaa Update Store.md 1507ede32 Update Scratch.md 54a90f569 Update Store.md 7c9145c43 Fix broken link dd15f183b Update ToMath.md 2b021c34b Move the [build] documentation to its own page cbb6677ec Fix typo ac0969063 Update ToMath.md 7fbdfd7c8 netlify: Hugo 0.136.5 17f54223c Update ToMath.md 4c9c3bb06 Update multilingual.md 1432da7bd Make site and page language methods linkable fd5b746cb Update urls.md a746f1b3a Update urls.md abf8738e2 netlify: Hugo 0.136.4 bd8759996 Update TrimSpace.md 6103c1e84 Documents strings.TrimSpace 533dd3a7b netlify: Hugo 0.136.3 30f3f97cf Update quick-start.md b0d7b41a0 Update configuration-markup.md 760e5e4f0 Update quick-start.md 17daeb866 Update quick-start.md 1e158e723 netlify: Hugo 0.136.2 d32530839 Update theme edb9bee02 Update description of url front matter field e1c576e18 netlify: Hugo 0.136.1 1ad28e1e0 Describe how to configure uglyURLs per section cbbd4c4fe netlify: Hugo 0.136.0 bb7f35e99 Merge branch 'tempv0.136.0' 706110736 docs: Regen CLI docs bf0c7821f Update urls.md 8c544e6c0 Update quick-start.md 8d02733d0 Update Paginator.md a45327aac Update Paginate.md 1377ed4de Clarify date parsing e19fb8043 Document front matter date field aliases a39951847 Update Tailwind CSS installation instructions 3be164c35 Remove duplicate token 05fc815f7 commands: Add "hugo build" as an alias for "hugo" cb3cb504c Update table render hook example efbee0bff Clarify resources.GetRemote 404 handling 4312d49c9 Update compare.Conditional documentation 4a46d53b6 Update theme 93e542d4f netlify: Hugo 0.135.0 b4da1c104 Remvoe some old new-in shortcodes 4c316f051 Update TailwindCSS.md c2fe91509 Update introduction.md 906b7c66b Update configuration.md 5ab6b3cdd Update documentation.md 26fb4bb4c Update documentation.md e9e917f37 Update version refs 83ce07f24 netlify: Hugo 0.134.3 8cb32f802 Update front-matter.md 94d7f576a Update faq.md fafc1d8d9 netlify: Hugo 0.134.2 bfe9cdc3d Update content-adapters.md 9e49ae3e1 Document ignoreLogs configuration setting 6b47a1d57 Update configuration.md fd98a0372 Document CLI options that can be set in configuration 07c2400d8 Document alternative to Summary method d053fa163 Update to reflect changes in v0.134.1 137dc3241 Update ContentWithoutSummary.md e8f6427d9 netlify: Hugo 0.134.1 git-subtree-dir: docs git-subtree-split: 159c843fd79e94a0f49bee74c272cd0cc4a848a2 --- .cspell.json | 4 + README.md | 4 +- .../gohugoioTheme/assets/css/_font-family.css | 8 +- .../assets/images/sponsors/goland.svg | 20 + .../gohugoioTheme/assets/output/css/app.css | 8 +- .../gohugoio/gohugoioTheme/data/sponsors.toml | 12 +- .../layouts/_default/baseof.html | 4 +- .../partials/home-page-sections/sponsors.html | 2 +- .../gohugoioTheme/layouts/partials/math.html | 11 +- .../layouts/partials/social-follow.html | 6 - .../layouts/shortcodes/gomodules-info.html | 2 +- .../shortcodes/module-mounts-note.html | 2 +- _vendor/modules.txt | 2 +- content/en/commands/hugo.md | 25 +- content/en/commands/hugo_build.md | 74 ++++ content/en/commands/hugo_completion.md | 2 +- content/en/commands/hugo_config.md | 6 +- content/en/commands/hugo_config_mounts.md | 2 +- content/en/commands/hugo_convert.md | 6 +- content/en/commands/hugo_convert_toJSON.md | 2 +- content/en/commands/hugo_convert_toTOML.md | 2 +- content/en/commands/hugo_convert_toYAML.md | 2 +- content/en/commands/hugo_deploy.md | 6 +- content/en/commands/hugo_env.md | 6 +- content/en/commands/hugo_gen.md | 8 +- content/en/commands/hugo_gen_chromastyles.md | 2 +- content/en/commands/hugo_gen_doc.md | 2 +- content/en/commands/hugo_gen_man.md | 2 +- content/en/commands/hugo_import.md | 6 +- content/en/commands/hugo_import_jekyll.md | 2 +- content/en/commands/hugo_list.md | 6 +- content/en/commands/hugo_list_all.md | 2 +- content/en/commands/hugo_list_drafts.md | 2 +- content/en/commands/hugo_list_expired.md | 2 +- content/en/commands/hugo_list_future.md | 2 +- content/en/commands/hugo_list_published.md | 2 +- content/en/commands/hugo_mod.md | 4 +- content/en/commands/hugo_mod_clean.md | 2 +- content/en/commands/hugo_mod_get.md | 2 +- content/en/commands/hugo_mod_graph.md | 2 +- content/en/commands/hugo_mod_init.md | 2 +- content/en/commands/hugo_mod_npm.md | 2 +- content/en/commands/hugo_mod_tidy.md | 2 +- content/en/commands/hugo_mod_vendor.md | 2 +- content/en/commands/hugo_mod_verify.md | 2 +- content/en/commands/hugo_new.md | 6 +- content/en/commands/hugo_new_content.md | 4 +- content/en/commands/hugo_new_site.md | 2 +- content/en/commands/hugo_new_theme.md | 2 +- content/en/commands/hugo_server.md | 4 +- content/en/commands/hugo_server_trust.md | 2 +- content/en/commands/hugo_version.md | 6 +- .../en/content-management/content-adapters.md | 4 + content/en/content-management/formats.md | 2 +- content/en/content-management/front-matter.md | 45 ++- .../image-processing/index.md | 2 - content/en/content-management/menus.md | 2 +- content/en/content-management/multilingual.md | 2 +- content/en/content-management/shortcodes.md | 20 + content/en/content-management/summaries.md | 66 +-- content/en/content-management/urls.md | 61 ++- content/en/contribute/development.md | 20 +- content/en/contribute/documentation.md | 24 +- content/en/functions/compare/Conditional.md | 13 +- content/en/functions/css/Sass.md | 12 +- content/en/functions/css/TailwindCSS.md | 7 +- content/en/functions/hugo/Generator.md | 2 +- content/en/functions/hugo/Version.md | 2 +- content/en/functions/resources/Babel.md | 4 +- content/en/functions/resources/FromString.md | 2 +- content/en/functions/resources/GetRemote.md | 4 + content/en/functions/resources/PostCSS.md | 4 +- content/en/functions/resources/ToCSS.md | 16 +- content/en/functions/strings/Chomp.md | 9 +- .../en/functions/strings/ContainsNonSpace.md | 16 +- content/en/functions/strings/Trim.md | 39 +- content/en/functions/strings/TrimLeft.md | 1 + content/en/functions/strings/TrimPrefix.md | 1 + content/en/functions/strings/TrimRight.md | 1 + content/en/functions/strings/TrimSpace.md | 26 ++ content/en/functions/strings/TrimSuffix.md | 1 + content/en/functions/time/AsTime.md | 31 +- content/en/functions/time/Format.md | 18 +- .../_common/parsable-date-time-strings.md | 16 +- content/en/functions/transform/ToMath.md | 6 +- .../en/getting-started/configuration-build.md | 88 ++++ .../getting-started/configuration-markup.md | 2 +- content/en/getting-started/configuration.md | 154 ++++--- content/en/getting-started/glossary.md | 2 +- content/en/getting-started/quick-start.md | 4 +- .../hosting-on-github/index.md | 2 +- .../hosting-on-gitlab.md | 4 +- .../hosting-on-netlify/index.md | 6 +- .../en/hosting-and-deployment/hugo-deploy.md | 9 +- .../en/hugo-pipes/transpile-sass-to-css.md | 12 +- .../en/installation/_common/01-editions.md | 14 +- .../_common/04-build-from-source.md | 17 +- content/en/installation/bsd.md | 5 + content/en/installation/linux.md | 13 + content/en/installation/macos.md | 5 + content/en/installation/windows.md | 4 + .../en/methods/page/ContentWithoutSummary.md | 2 +- content/en/methods/page/Language.md | 25 +- content/en/methods/page/Paginate.md | 2 +- content/en/methods/page/Paginator.md | 2 +- content/en/methods/page/RenderShortcodes.md | 17 +- content/en/methods/page/Scratch.md | 14 +- content/en/methods/page/Store.md | 8 +- content/en/methods/page/Summary.md | 34 +- content/en/methods/page/Truncated.md | 16 +- .../page/_common/output-format-definition.md | 1 - content/en/methods/resource/Colors.md | 2 - content/en/methods/shortcode/Inner.md | 14 +- content/en/methods/shortcode/InnerDeindent.md | 4 +- content/en/methods/shortcode/Parent.md | 2 +- content/en/methods/site/Language.md | 25 +- content/en/methods/site/Taxonomies.md | 7 +- content/en/quick-reference/emojis.md | 79 ++-- content/en/render-hooks/passthrough.md | 2 +- content/en/render-hooks/tables.md | 12 +- content/en/templates/embedded.md | 2 +- content/en/templates/introduction.md | 6 +- content/en/troubleshooting/faq.md | 14 +- data/embedded_template_urls.toml | 1 + go.mod | 2 +- go.sum | 20 +- layouts/shortcodes/img.html | 381 ------------------ netlify.toml | 2 +- 128 files changed, 893 insertions(+), 925 deletions(-) create mode 100644 _vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/goland.svg create mode 100644 content/en/commands/hugo_build.md create mode 100644 content/en/functions/strings/TrimSpace.md create mode 100644 content/en/getting-started/configuration-build.md delete mode 100644 layouts/shortcodes/img.html diff --git a/.cspell.json b/.cspell.json index 01d248e25..6596a160c 100644 --- a/.cspell.json +++ b/.cspell.json @@ -85,6 +85,7 @@ "stringifier", "struct", "toclevels", + "unpublishdate", "zgotmplz", "# ----------------------------------------------------------------------", "# cspell: ignore foreign language words", @@ -129,6 +130,7 @@ "Samsa", "Stucki", "Thénardier", + "WASI", "# ----------------------------------------------------------------------", "# cspell: ignore operating systems and software packages", "# ----------------------------------------------------------------------", @@ -158,10 +160,12 @@ "achristie", "ddmaurier", "dring", + "fleqn", "inor", "jausten", "jdoe", "jsmith", + "leqno", "milli", "rgba", "rsmith", diff --git a/README.md b/README.md index 93eaaf02e..7550a93cd 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,10 @@ A fast and flexible static site generator built with love by [bep], [spf13], and [![Netlify Status](https://api.netlify.com/api/v1/badges/e0dbbfc7-34f1-4393-a679-c16e80162705/deploy-status)](https://app.netlify.com/sites/gohugoio/deploys) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://gohugo.io/contribute/documentation/) -This is the repository for the [Hugo](https://github.com/gohugoio/hugo) documentation site. +This is the repository for the [Hugo](https://github.com/gohugoio/hugo) documentation site. Please see the [contributing] section for guidelines, examples, and process. - - [bep]: https://github.com/bep [spf13]: https://github.com/spf13 [friends]: https://github.com/gohugoio/hugo/graphs/contributors diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/assets/css/_font-family.css b/_vendor/github.com/gohugoio/gohugoioTheme/assets/css/_font-family.css index 440b5efdd..85b3b6c95 100644 --- a/_vendor/github.com/gohugoio/gohugoioTheme/assets/css/_font-family.css +++ b/_vendor/github.com/gohugoio/gohugoioTheme/assets/css/_font-family.css @@ -4,13 +4,7 @@ code, .code, pre code, .highlight pre { } .sans-serif { - font-family: 'Muli', - avenir, - 'helvetica neue', helvetica, - ubuntu, - roboto, noto, - 'segoe ui', arial, - sans-serif; + font-family: 'Muli', Avenir, 'Helvetica Neue', Helvetica, Roboto, Noto, 'Segoe UI', Arial, sans-serif; } diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/goland.svg b/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/goland.svg new file mode 100644 index 000000000..ff3bde8bf --- /dev/null +++ b/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/goland.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/assets/output/css/app.css b/_vendor/github.com/gohugoio/gohugoioTheme/assets/output/css/app.css index 5e0b0c708..b9518491c 100644 --- a/_vendor/github.com/gohugoio/gohugoioTheme/assets/output/css/app.css +++ b/_vendor/github.com/gohugoio/gohugoioTheme/assets/output/css/app.css @@ -5002,13 +5002,7 @@ code, .code, pre code, .highlight pre { font-family: 'inconsolata',Menlo,Monaco,'Courier New',monospace; } .sans-serif { - font-family: 'Muli', - avenir, - 'helvetica neue', helvetica, - ubuntu, - roboto, noto, - 'segoe ui', arial, - sans-serif; + font-family: 'Muli', Avenir, 'Helvetica Neue', Helvetica, Roboto, Noto, 'Segoe UI', Arial, sans-serif; } .serif { font-family: Palatino,"Palatino Linotype","Palatino LT STD","Book Antiqua",Georgia,serif; diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/data/sponsors.toml b/_vendor/github.com/gohugoio/gohugoioTheme/data/sponsors.toml index 33d550449..ca02ecc6f 100644 --- a/_vendor/github.com/gohugoio/gohugoioTheme/data/sponsors.toml +++ b/_vendor/github.com/gohugoio/gohugoioTheme/data/sponsors.toml @@ -15,9 +15,9 @@ link_attr = "style='color: #ffffff; font-weight: bold; text-decoration: none; text-align: center'" [[banners]] - name = "Your Company?" - link = "https://bep.is/en/hugo-sponsor-2023-01/" - utm_campaign = "hugosponsor" - show_on_hover = true - bgcolor = "#4e4f4f" - link_attr = "style='color: #ffffff; font-weight: bold; text-decoration: none; text-align: center'" + name = "GoLand" + title = "The complete IDE crafted for professional Go developers." + no_query_params = true + link = "https://www.jetbrains.com/go/?utm_source=OSS&utm_medium=referral&utm_campaign=hugo" + logo = "images/sponsors/goland.svg" + bgcolor = "#f4f4f4" diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/baseof.html b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/baseof.html index beb2d8619..6992881b6 100644 --- a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/baseof.html +++ b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/baseof.html @@ -106,9 +106,7 @@ + class="ma0 sans-serif bg-primary-color-light{{ with getenv "HUGO_ENV" }} {{ . }}{{ end }}"> {{ partial "hooks/after-body-start.html" . }} {{ block "nav" . }}{{ partial "site-nav.html" . }}{{ end }} {{ block "header" . }}{{ end }} diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/home-page-sections/sponsors.html b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/home-page-sections/sponsors.html index 84033c42c..751ee8894 100644 --- a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/home-page-sections/sponsors.html +++ b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/home-page-sections/sponsors.html @@ -25,7 +25,7 @@ {{ $query_params := .query_params | default "" }} {{ $url := .link }} {{ if not .no_query_params }} - {{ $url = printf "%s?%s%s" .link $query_params (querify "utm_source" (.utm_source | default $utmSource ) "utm_medium" "banner" "utm_campaign" (.utm_campaign | default "hugosponsor") "utm_content" (.utm_content | default "gohugoio")) | safeURL }} + {{ $url = printf "%s?%s%s" .link $query_params (querify "utm_source" (.utm_source | default $utmSource ) "utm_medium" (.utm_medium | default "banner") "utm_campaign" (.utm_campaign | default "hugosponsor") "utm_content" (.utm_content | default "gohugoio")) | safeURL }} {{ end }} {{ $logo := resources.Get .logo }} {{ $gtagID := printf "Sponsor %s %s" .name $gtag | title }} diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/math.html b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/math.html index b1eb5c8db..defcaa055 100644 --- a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/math.html +++ b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/math.html @@ -2,15 +2,8 @@ diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/social-follow.html b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/social-follow.html index 7451c15d6..243b22ccb 100644 --- a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/social-follow.html +++ b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/social-follow.html @@ -1,9 +1,3 @@ - }} +{{% note %}} +Note that the `Site` returned isn't fully built when invoked from the content adapters; if you try to call methods that depends on pages, e.g. `.Site.Pages`, you will get an error saying "this method cannot be called before the site is fully initialized". +{{% /note %}} + ###### Store Returns a persistent “scratch pad” to store and manipulate data. The main use case for this is to transfer values between executions when [EnableAllLanguages](#enablealllanguages) is set. See [examples](/methods/page/store/). diff --git a/content/en/content-management/formats.md b/content/en/content-management/formats.md index e96bc5af3..1132c888c 100644 --- a/content/en/content-management/formats.md +++ b/content/en/content-management/formats.md @@ -59,7 +59,7 @@ Create your content in [HTML] preceded by front matter. The content is typically ### Emacs Org Mode -Create your content in the [Emacs Org Mode] format preceded by front matter. You can use Org Mode keywords for front matter. See [details](/content-management/front-matter/#emacs-org-mode)). +Create your content in the [Emacs Org Mode] format preceded by front matter. You can use Org Mode keywords for front matter. See [details](/content-management/front-matter/#emacs-org-mode). ### AsciiDoc diff --git a/content/en/content-management/front-matter.md b/content/en/content-management/front-matter.md index 3ac2a63bc..5cbf645a5 100644 --- a/content/en/content-management/front-matter.md +++ b/content/en/content-management/front-matter.md @@ -39,7 +39,7 @@ weight = 10 author = 'John Smith' {{< /code-toggle >}} -Front matter fields may be [scalar], [arrays], or [maps] containing [boolean], [integer], [float], or [string] values. Note that the TOML format also supports date/time values using unquoted strings. +Front matter fields may be [boolean], [integer], [float], [string], [arrays], or [maps]. Note that the TOML format also supports unquoted date/time values. [scalar]: /getting-started/glossary/#scalar [arrays]: /getting-started/glossary/#array @@ -80,7 +80,8 @@ The field names below are reserved. For example, you cannot create a custom fiel ###### date -(`string`) The date associated with the page, typically the creation date. Note that the TOML format also supports date/time values using unquoted strings. Access this value from a template using the [`Date`] method on a `Page` object. +(`string`) The date associated with the page, typically the creation date. Note that the TOML format also supports unquoted date/time values. See the [dates](#dates) section for examples. Access this value from a template using the [`Date`] method on a `Page` object. + [`date`]: /methods/page/date/ @@ -99,7 +100,7 @@ If `true`, the page will not be rendered unless you pass the `--buildDrafts` fla ###### expiryDate -(`string`) The page expiration date. On or after the expiration date, the page will not be rendered unless you pass the `--buildExpired` flag to the `hugo` command. Note that the TOML format also supports date/time values using unquoted strings. Access this value from a template using the [`ExpiryDate`] method on a `Page` object. +(`string`) The page expiration date. On or after the expiration date, the page will not be rendered unless you pass the `--buildExpired` flag to the `hugo` command. Note that the TOML format also supports unquoted date/time values. See the [dates](#dates) section for examples. Access this value from a template using the [`ExpiryDate`] method on a `Page` object. [`expirydate`]: /methods/page/expirydate/ @@ -127,6 +128,7 @@ If `true`, the page will not be rendered unless you pass the `--buildDrafts` fla [`keywords`]: /methods/page/keywords/ [taxonomy]: /getting-started/glossary/#taxonomy +{{% comment %}} +{{% /comment %}} ###### lastmod -(`string`) The date that the page was last modified. Note that the TOML format also supports date/time values using unquoted strings. Access this value from a template using the [`Lastmod`] method on a `Page` object. +(`string`) The date that the page was last modified. Note that the TOML format also supports unquoted date/time values. See the [dates](#dates) section for examples. Access this value from a template using the [`Lastmod`] method on a `Page` object. [`lastmod`]: /methods/page/date/ @@ -167,21 +170,27 @@ lang ###### menus -(`string`,`string array`, or `map`) If set, Hugo adds the page to the given menu or menus. See the [menus] page for details. +(`string`, `string array`, or `map`) If set, Hugo adds the page to the given menu or menus. See the [menus] page for details. [menus]: /content-management/menus/#define-in-front-matter +###### modified + +Alias to [lastmod](#lastmod). + ###### outputs (`string array`) The [output formats] to render. [output formats]: /templates/output-formats/ +{{% comment %}} +{{% /comment %}} ###### params @@ -191,12 +200,20 @@ path [page parameters]: #parameters +###### pubdate + +Alias to [publishDate](#publishdate). + ###### publishDate -(`string`) The page publication date. Before the publication date, the page will not be rendered unless you pass the `--buildFuture` flag to the `hugo` command. Note that the TOML format also supports date/time values using unquoted strings. Access this value from a template using the [`PublishDate`] method on a `Page` object. +(`string`) The page publication date. Before the publication date, the page will not be rendered unless you pass the `--buildFuture` flag to the `hugo` command. Note that the TOML format also supports unquoted date/time values. See the [dates](#dates) section for examples. Access this value from a template using the [`PublishDate`] method on a `Page` object. [`publishdate`]: /methods/page/publishdate/ +###### published + +Alias to [publishDate](#publishdate). + ###### resources (`map array`) An array of maps to provide metadata for [page resources]. @@ -242,6 +259,10 @@ path [content type]: /getting-started/glossary/#content-type [`type`]: /methods/page/type/ +###### unpublishdate + +Alias to [expirydate](#expirydate). + ###### url (`string`) Overrides the entire URL path. Applicable to regular pages and section pages. See the [URL management] page for details. @@ -428,3 +449,15 @@ Note that you can also specify array elements on a single line: [content format]: /content-management/formats/ [emacs org mode]: https://orgmode.org/ + +## Dates + +When populating a date field, whether a [custom page parameter](#parameters) or one of the four predefined fields ([`date`](#date), [`expiryDate`](#expirydate), [`lastmod`](#lastmod), [`publishDate`](#publishdate)), use one of these parsable formats: + +{{% include "functions/time/_common/parsable-date-time-strings.md" %}} + +To override the default time zone, set the [`timeZone`](https://gohugo.io/getting-started/configuration/#timezone) in your site configuration. The order of precedence for determining the time zone is: + +1. The time zone offset in the date/time string +2. The time zone specified in your site configuration +3. The `Etc/UTC` time zone diff --git a/content/en/content-management/image-processing/index.md b/content/en/content-management/image-processing/index.md index db786361c..841f12863 100644 --- a/content/en/content-management/image-processing/index.md +++ b/content/en/content-management/image-processing/index.md @@ -205,8 +205,6 @@ Sometimes it can be useful to create the filter chain once and then reuse it. ### Colors -{{< new-in 0.104.0 >}} - `.Colors` returns a slice of hex strings with the dominant colors in the image using a simple histogram method. ```go-html-template diff --git a/content/en/content-management/menus.md b/content/en/content-management/menus.md index 169b6eb05..ff2011d3d 100644 --- a/content/en/content-management/menus.md +++ b/content/en/content-management/menus.md @@ -100,7 +100,7 @@ This front matter menu entry demonstrates some of the available properties: {{< code-toggle file=content/products/software.md fm=true >}} title = 'Software' -[[menus.main]] +[menus.main] parent = 'Products' weight = 20 pre = '' diff --git a/content/en/content-management/multilingual.md b/content/en/content-management/multilingual.md index b8ba80dfd..165b2402e 100644 --- a/content/en/content-management/multilingual.md +++ b/content/en/content-management/multilingual.md @@ -136,7 +136,7 @@ In the example above, all settings except `color` below `params` map to predefin ```go-html-template {{ site.Title }} -{{ site.LanguageCode }} +{{ site.Language.LanguageCode }} {{ site.Params.color }} ``` diff --git a/content/en/content-management/shortcodes.md b/content/en/content-management/shortcodes.md index 847ba2bbb..8e345f2fb 100644 --- a/content/en/content-management/shortcodes.md +++ b/content/en/content-management/shortcodes.md @@ -74,6 +74,26 @@ You can call shortcodes within other shortcodes by creating your own templates t Use these embedded shortcodes as needed. +### comment + +{{< new-in "0.137.1" >}} + +{{% note %}} +To override Hugo's embedded `comment` shortcode, copy the [source code] to a file with the same name in the layouts/shortcodes directory. + +[source code]: {{% eturl comment %}} +{{% /note %}} + +Use the `comment` shortcode to include comments in your Markdown. Hugo excludes the encapsulated text when rendering your site. + +Example usage: + +```text +{{%/* comment */%}} TODO: rewrite the paragraph below. {{%/* /comment */%}} +``` + +Although you can call this shortcode using the `{{}}` notation, computationally it is more efficient to call it using the `{{%/* */%}}` notation as shown above. + ### figure {{% note %}} diff --git a/content/en/content-management/summaries.md b/content/en/content-management/summaries.md index e0b2c9590..07c61d963 100644 --- a/content/en/content-management/summaries.md +++ b/content/en/content-management/summaries.md @@ -12,35 +12,34 @@ weight: 160 toc: true aliases: [/content/summaries/,/content-management/content-summaries/] --- - +{{% comment %}} +{{% /comment %}} -You can define a content summary manually, in front matter, or automatically. A manual content summary takes precedence over a front matter summary, and a front matter summary takes precedence over an automatic summary. +You can define a summary manually, in front matter, or automatically. A manual summary takes precedence over a front matter summary, and a front matter summary takes precedence over an automatic summary. Review the [comparison table](#comparison) below to understand the characteristics of each summary type. ## Manual summary -Use a `` divider to indicate the end of the content summary. Hugo will not render the summary divider itself. +Use a `` divider to indicate the end of the summary. Hugo will not render the summary divider itself. -{{< code file=content/sample.md >}} +{{< code file=content/example.md >}} +++ title: 'Example' date: 2024-05-26T09:10:33-07:00 +++ -Thénardier was not mistaken. The man was sitting there, and letting -Cosette get somewhat rested. +This is the first paragraph. -The inn-keeper walked round the brushwood and presented himself -abruptly to the eyes of those whom he was in search of. +This is the second paragraph. {{< /code >}} -When using the Emacs Org Mode [content format], use a `# more` divider to indicate the end of the content summary. +When using the Emacs Org Mode [content format], use a `# more` divider to indicate the end of the summary. [content format]: /content-management/formats/ @@ -48,46 +47,44 @@ When using the Emacs Org Mode [content format], use a `# more` divider to indica Use front matter to define a summary independent of content. -{{< code file=content/sample.md >}} +{{< code file=content/example.md >}} +++ title: 'Example' date: 2024-05-26T09:10:33-07:00 -summary: 'Learn more about _Les Misérables_ by Victor Hugo.' +summary: 'This summary is independent of the content.' +++ -Thénardier was not mistaken. The man was sitting there, and letting -Cosette get somewhat rested. The inn-keeper walked round the -brushwood and presented himself abruptly to the eyes of those whom -he was in search of. +This is the first paragraph. + +This is the second paragraph. {{< /code >}} ## Automatic summary -If you have not defined the summary manually or in front matter, Hugo automatically defines the summary based on the [`summaryLength`] in your site configuration. +If you do not define the summary manually or in front matter, Hugo automatically defines the summary based on the [`summaryLength`] in your site configuration. [`summaryLength`]: /getting-started/configuration/#summarylength -{{< code file=content/sample.md >}} +{{< code file=content/example.md >}} +++ title: 'Example' date: 2024-05-26T09:10:33-07:00 +++ -Thénardier was not mistaken. The man was sitting there, and letting -Cosette get somewhat rested. The inn-keeper walked round the -brushwood and presented himself abruptly to the eyes of those whom -he was in search of. +This is the first paragraph. + +This is the second paragraph. + +This is the third paragraph. {{< /code >}} -For example, with a `summaryLength` of 10, the automatic summary will be: +For example, with a `summaryLength` of 7, the automatic summary will be: -```text -Thénardier was not mistaken. The man was sitting there, and letting -Cosette get somewhat rested. +```html +

This is the first paragraph.

+

This is the second paragraph.

``` -Note that the `summaryLength` is an approximate number of words. - ## Comparison Each summary type has different characteristics: @@ -115,3 +112,18 @@ Render the summary in a template by calling the [`Summary`] method on a `Page` o {{ end }} ``` + +## Alternative + +Instead of calling the `Summary` method on a `Page` object, use the [`strings.Truncate`] function for granular control of the summary length. For example: + +[`strings.Truncate`]: /functions/strings/truncate/ + +```go-html-template +{{ range site.RegularPages }} +

{{ .LinkTitle }}

+
+ {{ .Content | strings.Truncate 42 }} +
+{{ end }} +``` diff --git a/content/en/content-management/urls.md b/content/en/content-management/urls.md index e3370f956..0f1d93c63 100644 --- a/content/en/content-management/urls.md +++ b/content/en/content-management/urls.md @@ -43,11 +43,45 @@ https://example.org/posts/my-first-post/ Set the `url` in front matter to override the entire path. Use this with either regular pages or section pages. +{{% note %}} +Hugo does not sanitize the `url` front matter field, allowing you to generate: + +- File paths that contain characters reserved by the operating system. For example, file paths on Windows may not contain any of these [reserved characters]. Hugo throws an error if a file path includes a character reserved by the current operating system. +- URLs that contain disallowed characters. For example, the less than sign (`<`) is not allowed in a URL. + +[reserved characters]: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions +{{% /note %}} + +If you set both `slug` and `url` in front matter, the `url` value takes precedence. + +#### Include a colon + +{{< new-in 0.136.0 >}} + +If you need to include a colon in the `url` front matter field, escape it with backslash characters. Use one backslash if you wrap the string within single quotes, or use two backslashes if you wrap the string within double quotes. With YAML front matter, use a single backslash if you omit quotation marks. + +For example, with this front matter: + +{{< code-toggle file=content/example.md fm=true >}} +title: Example +url: "my\\:example" +{{< /code-toggle >}} + +The resulting URL will be: + +```text +https://example.org/my:example/ +``` + +As described above, this will fail on Windows because the colon (`:`) is a reserved character. + +#### File extensions + With this front matter: {{< code-toggle file=content/posts/post-1.md fm=true >}} title = 'My First Article' -url = '/articles/my-first-article' +url = 'articles/my-first-article' {{< /code-toggle >}} The resulting URL will be: @@ -60,7 +94,7 @@ If you include a file extension: {{< code-toggle file=content/posts/post-1.md fm=true >}} title = 'My First Article' -url = '/articles/my-first-article.html' +url = 'articles/my-first-article.html' {{< /code-toggle >}} The resulting URL will be: @@ -69,12 +103,11 @@ The resulting URL will be: https://example.org/articles/my-first-article.html ``` -In a monolingual site, a `url` value with or without a leading slash is relative to the `baseURL`. +#### Leading slashes -In a multilingual site: +With monolingual sites, `url` values with or without a leading slash are relative to the [`baseURL`]. With multilingual sites, `url` values with a leading slash are relative to the `baseURL`, and `url` values without a leading slash are relative to the `baseURL` plus the language prefix. -- A `url` value with a leading slash is relative to the `baseURL`. -- A `url` value without a leading slash is relative to the `baseURL` plus the language prefix. +[`baseURL`]: /getting-started/configuration/#baseurl Site type|Front matter `url`|Resulting URL :--|:--|:-- @@ -83,13 +116,11 @@ monolingual|`about`|`https://example.org/about/` multilingual|`/about`|`https://example.org/about/` multilingual|`about`|`https://example.org/de/about/` -If you set both `slug` and `url` in front matter, the `url` value takes precedence. - #### Permalinks tokens in front matter {{< new-in "0.131.0" >}} -You can also use [Permalinks tokens](#tokens) in the `url` front matter. This is typically used in `cascade` sections: +You can also use [tokens](#tokens) when setting the `url` value. This is typically used in `cascade` sections: {{< code-toggle file=content/foo/bar/_index.md fm=true >}} title ="Bar" @@ -246,9 +277,7 @@ public/ #### Tokens -Use these tokens when defining the URL pattern. These can both be used in the `permalinks` configuration and in the front matter [url](#permalinks-tokens-in-front-matter). - -`:filename` +Use these tokens when defining the URL pattern. You can also use these tokens when setting the [`url`](#permalinks-tokens-in-front-matter) value in front matter. `:year` : The 4-digit year as defined in the front matter `date` field. @@ -313,6 +342,14 @@ By default, Hugo produces pretty URLs. To generate ugly URLs, change your site c uglyURLs = true {{< /code-toggle >}} +You can also enable uglyURLs by section. For example, with a site that contains sections for books and films: + +{{< code-toggle file=hugo >}} +[uglyURLs] +books = true +films = false +{{< /code-toggle >}} + ### Post-processing Hugo provides two mutually exclusive configuration options to alter URLs _after_ it renders a page. diff --git a/content/en/contribute/development.md b/content/en/contribute/development.md index e4b183e93..1680d4a46 100644 --- a/content/en/contribute/development.md +++ b/content/en/contribute/development.md @@ -45,7 +45,7 @@ For a complete guide to contributing to Hugo, see the [Contribution Guide]. ## Prerequisites -To build the extended edition of Hugo from source you must: +To build the extended or extended/deploy edition from source you must: 1. Install [Git] 1. Install [Go] version 1.23.0 or later @@ -97,12 +97,26 @@ Step 4 : Make changes. Step 5 -: Compile and install: +: Compile and install. + +To compile and install the standard edition: + +```text +go install +``` + +To compile and install the extended edition: ```text CGO_ENABLED=1 go install -tags extended ``` +To compile and install the extended/deploy edition: + +```text +CGO_ENABLED=1 go install -tags extended,withdeploy +``` + Step 6 : Test your changes: @@ -158,7 +172,7 @@ CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest To build and install a specific release: ```sh -CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@v0.128.0 +CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@v0.137.1 ``` To build and install at the latest commit on the master branch: diff --git a/content/en/contribute/documentation.md b/content/en/contribute/documentation.md index 408ed505d..580d0b0e2 100644 --- a/content/en/contribute/documentation.md +++ b/content/en/contribute/documentation.md @@ -85,6 +85,24 @@ Yes → Hugo is fast. "It's an adverb, Sam. It's a lazy tool of a weak mind." (Outbreak, 1995). {{% /note %}} +#### Level 6 headings + +Level 6 headings are styled as `dt` elements. This was implemented to support a [glossary] with linkable terms. + +[glossary]: /getting-started/glossary/ + +#### Function and method descriptions + +When adding a page to the [functions] or [methods] section, begin the description with the word "Returns". With functions and methods that return a boolean value, begin the description with the phrase "Reports whether". + +For example: + +- `Returns the URL aliases as defined in front matter.` +- `Reports whether the given page is in the given section.` + +[functions]: /functions +[methods]: /methods + #### Miscellaneous Other guidelines to consider: @@ -97,12 +115,6 @@ Other guidelines to consider: - When including code samples, use short snippets that demonstrate the concept. - The Hugo user community is global; use [basic english](https://simple.wikipedia.org/wiki/Basic_English) when possible. -#### Level 6 headings - -Level 6 headings are styled as `dt` elements. This was implemented to support a [glossary] with linkable terms. - -[glossary]: /getting-started/glossary/ - ## Code examples Indent code by two spaces. With examples of template code, include a space after opening action delimiters, and include a space before closing action delimiters. diff --git a/content/en/functions/compare/Conditional.md b/content/en/functions/compare/Conditional.md index 6d693770d..997b71e94 100644 --- a/content/en/functions/compare/Conditional.md +++ b/content/en/functions/compare/Conditional.md @@ -12,26 +12,17 @@ action: aliases: [/functions/cond] --- -The CONTROL argument is a boolean value that indicates whether the function should return ARG1 or ARG2. If CONTROL is `true`, the function returns ARG1. Otherwise, the function returns ARG2. +If CONTROL is truthy the function returns ARG1, otherwise it returns ARG2. ```go-html-template {{ $qty := 42 }} {{ cond (le $qty 3) "few" "many" }} → many ``` -The CONTROL argument must be either `true` or `false`. To cast a non-boolean value to boolean, pass it through the `not` operator twice. - -```go-html-template -{{ cond (42 | not | not) "truthy" "falsy" }} → truthy -{{ cond ("" | not | not) "truthy" "falsy" }} → falsy -``` - -{{% note %}} -Unlike [ternary operators] in other languages, the `cond` function does not perform [short-circuit evaluation]. The function evaluates both ARG1 and ARG2, regardless of the CONTROL value. +Unlike [ternary operators] in other languages, the `compare.Conditional` function does not perform [short-circuit evaluation]. It evaluates both ARG1 and ARG2 regardless of the CONTROL value. [short-circuit evaluation]: https://en.wikipedia.org/wiki/Short-circuit_evaluation [ternary operators]: https://en.wikipedia.org/wiki/Ternary_conditional_operator -{{% /note %}} Due to the absence of short-circuit evaluation, these examples throw an error: diff --git a/content/en/functions/css/Sass.md b/content/en/functions/css/Sass.md index ef1572ae0..328037bb9 100644 --- a/content/en/functions/css/Sass.md +++ b/content/en/functions/css/Sass.md @@ -32,7 +32,7 @@ toc: true {{ end }} ``` -Transpile Sass to CSS using the LibSass transpiler included in Hugo's extended edition, or [install Dart Sass](#dart-sass) to use the latest features of the Sass language. +Transpile Sass to CSS using the LibSass transpiler included in Hugo's extended and extended/deploy editions, or [install Dart Sass](#dart-sass) to use the latest features of the Sass language. Sass has two forms of syntax: [SCSS] and [indented]. Hugo supports both. @@ -42,7 +42,7 @@ Sass has two forms of syntax: [SCSS] and [indented]. Hugo supports both. ## Options transpiler -: (`string`) The transpiler to use, either `libsass` (default) or `dartsass`. Hugo's extended edition includes the LibSass transpiler. To use the Dart Sass transpiler, see the [installation instructions](#dart-sass) below. +: (`string`) The transpiler to use, either `libsass` (default) or `dartsass`. Hugo's extended and extended/deploy editions include the LibSass transpiler. To use the Dart Sass transpiler, see the [installation instructions](#dart-sass) below. targetPath : (`string`) If not set, the transformed resource's target path will be the original path of the asset file with its extension replaced by `.css`. @@ -141,8 +141,8 @@ To install Dart Sass for your builds on GitLab Pages, the `.gitlab-ci.yml` file ```yaml variables: - HUGO_VERSION: 0.128.0 - DART_SASS_VERSION: 1.77.5 + HUGO_VERSION: 0.137.1 + DART_SASS_VERSION: 1.80.6 GIT_DEPTH: 0 GIT_STRATEGY: clone GIT_SUBMODULE_STRATEGY: recursive @@ -175,8 +175,8 @@ To install Dart Sass for your builds on Netlify, the `netlify.toml` file should ```toml [build.environment] -HUGO_VERSION = "0.128.0" -DART_SASS_VERSION = "1.77.5" +HUGO_VERSION = "0.137.1" +DART_SASS_VERSION = "1.80.6" TZ = "America/Los_Angeles" [build] diff --git a/content/en/functions/css/TailwindCSS.md b/content/en/functions/css/TailwindCSS.md index 143616453..828ac9051 100644 --- a/content/en/functions/css/TailwindCSS.md +++ b/content/en/functions/css/TailwindCSS.md @@ -16,7 +16,7 @@ toc: true {{< new-in 0.128.0 >}} - +{{% todo %}}remove this admonition when feature is stable.{{% /todo %}} {{% note %}} This is an experimental feature pending the release of TailwindCSS v4.0. @@ -31,9 +31,10 @@ To use this function you must install the Tailwind CSS CLI v4.0 or later. You ma [Tailwind CSS documentation]: https://tailwindcss.com/docs/installation {{% note %}} -Use npm to install the CLI prior to the v4.0 release of Tailwind CSS. +Prior to the release of Tailwind CSS v4.0 you must install [v4.0.0-alpha.26](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.0-alpha.26) or later. `npm install --save-dev tailwindcss@next @tailwindcss/cli@next` + {{% /note %}} ## Options @@ -54,7 +55,7 @@ skipInlineImportsNotFound Define a [cache buster] in your site configuration: -[cache buster]: /getting-started/configuration/#configure-cache-busters +[cache buster]: /getting-started/configuration-build/#configure-cache-busters {{< code-toggle file=hugo >}} [[build.cachebusters]] diff --git a/content/en/functions/hugo/Generator.md b/content/en/functions/hugo/Generator.md index 5538903ed..f8d20559b 100644 --- a/content/en/functions/hugo/Generator.md +++ b/content/en/functions/hugo/Generator.md @@ -11,5 +11,5 @@ action: --- ```go-html-template -{{ hugo.Generator }} → +{{ hugo.Generator }} → ``` diff --git a/content/en/functions/hugo/Version.md b/content/en/functions/hugo/Version.md index 988e8ad88..c1aee8e3f 100644 --- a/content/en/functions/hugo/Version.md +++ b/content/en/functions/hugo/Version.md @@ -11,5 +11,5 @@ action: --- ```go-html-template -{{ hugo.Version }} → 0.128.0 +{{ hugo.Version }} → 0.137.1 ``` diff --git a/content/en/functions/resources/Babel.md b/content/en/functions/resources/Babel.md index b2b51ae97..3e98ba3fe 100644 --- a/content/en/functions/resources/Babel.md +++ b/content/en/functions/resources/Babel.md @@ -15,9 +15,9 @@ expiryDate: 2025-06-24 # deprecated 2024-06-24 --- {{% deprecated-in 0.128.0 %}} -Use [js.Babel] instead. +Use [`js.Babel`] instead. -[js.Babel]: /functions/js/babel/ +[`js.Babel`]: /functions/js/babel/ {{% /deprecated-in %}} ```go-html-template diff --git a/content/en/functions/resources/FromString.md b/content/en/functions/resources/FromString.md index 8801de6e4..be30367db 100644 --- a/content/en/functions/resources/FromString.md +++ b/content/en/functions/resources/FromString.md @@ -24,7 +24,7 @@ Let's say you need to publish a file named "site.json" in the root of your publi ```json { "build_date": "2024-02-19T12:27:05-08:00", - "hugo_version": "0.128.0", + "hugo_version": "0.137.1", "last_modified": "2024-02-19T12:01:42-08:00" } ``` diff --git a/content/en/functions/resources/GetRemote.md b/content/en/functions/resources/GetRemote.md index 556bfbeca..2179415dd 100644 --- a/content/en/functions/resources/GetRemote.md +++ b/content/en/functions/resources/GetRemote.md @@ -102,6 +102,10 @@ The [`Err`] method on a resource returned by the `resources.GetRemote` function [`Err`]: /methods/resource/err/ +{{% note %}} +Hugo does not classify an HTTP response with status code 404 as an error. In this case the function returns nil. +{{% /note %}} + ```go-html-template {{ $url := "https://broken-example.org/images/a.jpg" }} {{ with resources.GetRemote $url }} diff --git a/content/en/functions/resources/PostCSS.md b/content/en/functions/resources/PostCSS.md index f495b16fe..2389d2ff5 100644 --- a/content/en/functions/resources/PostCSS.md +++ b/content/en/functions/resources/PostCSS.md @@ -16,9 +16,9 @@ expiryDate: 2025-06-24 # deprecated 2024-06-24 --- {{% deprecated-in 0.128.0 %}} -Use [css.PostCSS] instead. +Use [`css.PostCSS`] instead. -[css.PostCSS]: /functions/css/postcss/ +[`css.PostCSS`]: /functions/css/postcss/ {{% /deprecated-in %}} ```go-html-template diff --git a/content/en/functions/resources/ToCSS.md b/content/en/functions/resources/ToCSS.md index bd98dab19..5db634f93 100644 --- a/content/en/functions/resources/ToCSS.md +++ b/content/en/functions/resources/ToCSS.md @@ -16,9 +16,9 @@ expiryDate: 2025-06-24 # deprecated 2024-06-24 --- {{% deprecated-in 0.128.0 %}} -Use [css.Sass] instead. +Use [`css.Sass`] instead. -[css.Sass]: /functions/css/sass/ +[`css.Sass`]: /functions/css/sass/ {{% /deprecated-in %}} ```go-html-template @@ -36,7 +36,7 @@ Use [css.Sass] instead. {{ end }} ``` -Transpile Sass to CSS using the LibSass transpiler included in Hugo's extended edition, or [install Dart Sass](#dart-sass) to use the latest features of the Sass language. +Transpile Sass to CSS using the LibSass transpiler included in Hugo's extended and extended/deploy editions, or [install Dart Sass](#dart-sass) to use the latest features of the Sass language. Sass has two forms of syntax: [SCSS] and [indented]. Hugo supports both. @@ -46,7 +46,7 @@ Sass has two forms of syntax: [SCSS] and [indented]. Hugo supports both. ## Options transpiler -: (`string`) The transpiler to use, either `libsass` (default) or `dartsass`. Hugo's extended edition includes the LibSass transpiler. To use the Dart Sass transpiler, see the [installation instructions](#dart-sass) below. +: (`string`) The transpiler to use, either `libsass` (default) or `dartsass`. Hugo's extended and extended/deploy editions include the LibSass transpiler. To use the Dart Sass transpiler, see the [installation instructions](#dart-sass) below. targetPath : (`string`) If not set, the transformed resource's target path will be the original path of the asset file with its extension replaced by `.css`. @@ -145,8 +145,8 @@ To install Dart Sass for your builds on GitLab Pages, the `.gitlab-ci.yml` file ```yaml variables: - HUGO_VERSION: 0.128.0 - DART_SASS_VERSION: 1.77.5 + HUGO_VERSION: 0.137.1 + DART_SASS_VERSION: 1.80.6 GIT_DEPTH: 0 GIT_STRATEGY: clone GIT_SUBMODULE_STRATEGY: recursive @@ -179,8 +179,8 @@ To install Dart Sass for your builds on Netlify, the `netlify.toml` file should ```toml [build.environment] -HUGO_VERSION = "0.128.0" -DART_SASS_VERSION = "1.77.5" +HUGO_VERSION = "0.137.1" +DART_SASS_VERSION = "1.80.6" TZ = "America/Los_Angeles" [build] diff --git a/content/en/functions/strings/Chomp.md b/content/en/functions/strings/Chomp.md index 349f1e9b7..8024758ba 100644 --- a/content/en/functions/strings/Chomp.md +++ b/content/en/functions/strings/Chomp.md @@ -7,6 +7,7 @@ action: aliases: [chomp] related: - functions/strings/Trim + - functions/strings/TrimSpace - functions/strings/TrimLeft - functions/strings/TrimPrefix - functions/strings/TrimRight @@ -19,9 +20,9 @@ aliases: [/functions/chomp] If the argument is of type `template.HTML`, returns `template.HTML`, else returns a `string`. ```go-html-template -{{ chomp | "foo\n" }} → foo -{{ chomp | "foo\n\n" }} → foo +{{ chomp "foo\n" }} → foo +{{ chomp "foo\n\n" }} → foo -{{ chomp | "foo\r\n" }} → foo -{{ chomp | "foo\r\n\r\n" }} → foo +{{ chomp "foo\r\n" }} → foo +{{ chomp "foo\r\n\r\n" }} → foo ``` diff --git a/content/en/functions/strings/ContainsNonSpace.md b/content/en/functions/strings/ContainsNonSpace.md index d4c72eea0..81e11a5ba 100644 --- a/content/en/functions/strings/ContainsNonSpace.md +++ b/content/en/functions/strings/ContainsNonSpace.md @@ -1,6 +1,6 @@ --- title: strings.ContainsNonSpace -description: Reports whether the given string contains any non-space characters as defined by Unicode's White Space property. +description: Reports whether the given string contains any non-space characters as defined by Unicode. categories: [] keywords: [] action: @@ -18,18 +18,12 @@ aliases: [/functions/strings.containsnonspace] {{< new-in 0.111.0 >}} +Whitespace characters include `\t`, `\n`, `\v`, `\f`, `\r`, and characters in the [Unicode Space Separator] category. + +[Unicode Space Separator]: https://www.compart.com/en/unicode/category/Zs + ```go-html-template {{ strings.ContainsNonSpace "\n" }} → false {{ strings.ContainsNonSpace " " }} → false {{ strings.ContainsNonSpace "\n abc" }} → true ``` - -Common whitespace characters include: - -```text -'\t', '\n', '\v', '\f', '\r', ' ' -``` - -See the [Unicode Character Database] for a complete list. - -[Unicode Character Database]: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt diff --git a/content/en/functions/strings/Trim.md b/content/en/functions/strings/Trim.md index 9a87ff206..a8c4cf92d 100644 --- a/content/en/functions/strings/Trim.md +++ b/content/en/functions/strings/Trim.md @@ -7,6 +7,7 @@ action: aliases: [trim] related: - functions/strings/Chomp + - functions/strings/TrimSpace - functions/strings/TrimLeft - functions/strings/TrimPrefix - functions/strings/TrimRight @@ -19,41 +20,3 @@ aliases: [/functions/trim] ```go-html-template {{ trim "++foo--" "+-" }} → foo ``` - -To remove leading and trailing newline characters and carriage returns: - -```go-html-template -{{ trim "\nfoo\n" "\n\r" }} → foo -{{ trim "\n\nfoo\n\n" "\n\r" }} → foo - -{{ trim "\r\nfoo\r\n" "\n\r" }} → foo -{{ trim "\r\n\r\nfoo\r\n\r\n" "\n\r" }} → foo -``` - -The `strings.Trim` function is commonly used in shortcodes to remove leading and trailing newlines characters and carriage returns from the content within the opening and closing shortcode tags. - -For example, with this Markdown: - -```text -{{}} -Able was I ere I saw Elba. -{{}} -``` - -The value of `.Inner` in the shortcode template is: - -```text -\nAble was I ere I saw Elba.\n -``` - -If authored on a Windows system the value of `.Inner` might, depending on the editor configuration, be: - -```text -\r\nAble was I ere I saw Elba.\r\n -``` - -This construct is common in shortcode templates: - -```go-html-template -{{ trim .Inner "\n\r" }} -``` diff --git a/content/en/functions/strings/TrimLeft.md b/content/en/functions/strings/TrimLeft.md index 07cdf0064..d94aa05a3 100644 --- a/content/en/functions/strings/TrimLeft.md +++ b/content/en/functions/strings/TrimLeft.md @@ -8,6 +8,7 @@ action: related: - functions/strings/Chomp - functions/strings/Trim + - functions/strings/TrimSpace - functions/strings/TrimPrefix - functions/strings/TrimRight - functions/strings/TrimSuffix diff --git a/content/en/functions/strings/TrimPrefix.md b/content/en/functions/strings/TrimPrefix.md index 917cf06f5..331c52a03 100644 --- a/content/en/functions/strings/TrimPrefix.md +++ b/content/en/functions/strings/TrimPrefix.md @@ -8,6 +8,7 @@ action: related: - functions/strings/Chomp - functions/strings/Trim + - functions/strings/TrimSpace - functions/strings/TrimLeft - functions/strings/TrimRight - functions/strings/TrimSuffix diff --git a/content/en/functions/strings/TrimRight.md b/content/en/functions/strings/TrimRight.md index b244925ef..f36597d3d 100644 --- a/content/en/functions/strings/TrimRight.md +++ b/content/en/functions/strings/TrimRight.md @@ -8,6 +8,7 @@ action: related: - functions/strings/Chomp - functions/strings/Trim + - functions/strings/TrimSpace - functions/strings/TrimLeft - functions/strings/TrimPrefix - functions/strings/TrimSuffix diff --git a/content/en/functions/strings/TrimSpace.md b/content/en/functions/strings/TrimSpace.md new file mode 100644 index 000000000..eef4e8121 --- /dev/null +++ b/content/en/functions/strings/TrimSpace.md @@ -0,0 +1,26 @@ +--- +title: strings.TrimSpace +description: Returns the given string, removing leading and trailing whitespace as defined by Unicode. +categories: [] +keywords: [] +action: + related: + - functions/strings/Chomp + - functions/strings/Trim + - functions/strings/TrimLeft + - functions/strings/TrimPrefix + - functions/strings/TrimRight + - functions/strings/TrimSuffix + returnType: string + signatures: [strings.TrimSpace INPUT] +--- + +{{< new-in 0.136.3 >}} + +Whitespace characters include `\t`, `\n`, `\v`, `\f`, `\r`, and characters in the [Unicode Space Separator] category. + +[Unicode Space Separator]: https://www.compart.com/en/unicode/category/Zs + +```go-html-template +{{ strings.TrimSpace "\n\r\t foo \n\r\t" }} → foo +``` diff --git a/content/en/functions/strings/TrimSuffix.md b/content/en/functions/strings/TrimSuffix.md index 704bbd2d2..d612ae695 100644 --- a/content/en/functions/strings/TrimSuffix.md +++ b/content/en/functions/strings/TrimSuffix.md @@ -8,6 +8,7 @@ action: related: - functions/strings/Chomp - functions/strings/Trim + - functions/strings/TrimSpace - functions/strings/TrimLeft - functions/strings/TrimPrefix - functions/strings/TrimRight diff --git a/content/en/functions/time/AsTime.md b/content/en/functions/time/AsTime.md index 23e5304a5..70b2bd1f3 100644 --- a/content/en/functions/time/AsTime.md +++ b/content/en/functions/time/AsTime.md @@ -21,41 +21,34 @@ toc: true Hugo provides [functions] and [methods] to format, localize, parse, compare, and manipulate date/time values. Before you can do any of these with string representations of date/time values, you must first convert them to [`time.Time`] values using the `time.AsTime` function. ```go-html-template -{{ $t := "2023-10-15T14:20:28-07:00" }} -{{ time.AsTime $t }} → 2023-10-15 14:20:28 -0700 PDT (time.Time) +{{ $t := "2023-10-15T13:18:50-07:00" }} +{{ time.AsTime $t }} → 2023-10-15 13:18:50 -0700 PDT (time.Time) ``` ## Parsable strings -As shown above, the first argument must be a *parsable* string representation of a date/time value. For example: +As shown above, the first argument must be a parsable string representation of a date/time value. For example: {{% include "functions/time/_common/parsable-date-time-strings.md" %}} -## Time zones +To override the default time zone, set the [`timeZone`] in your site configuration or provide a second argument to the `time.AsTime` function. For example: -When the parsable string does not contain a time zone offset, you can do either of the following to assign a time zone other than Etc/UTC: +```go-html-template +{{ time.AsTime "15 Oct 2023" "America/Los_Angeles" }} +``` -- Provide a second argument to the `time.AsTime` function - - ```go-html-template - {{ time.AsTime "15 Oct 2023" "America/Chicago" }} - ``` - -- Set the default time zone in your site configuration - - {{< code-toggle file=hugo >}} - timeZone = 'America/New_York' - {{< /code-toggle >}} +The list of valid time zones may be system dependent, but should include `UTC`, `Local`, or any location in the [IANA Time Zone database]. The order of precedence for determining the time zone is: 1. The time zone offset in the date/time string -2. The time zone provide as the second argument to the `time.AsTime` function +2. The time zone provided as the second argument to the `time.AsTime` function 3. The time zone specified in your site configuration +4. The `Etc/UTC` time zone -The list of valid time zones may be system dependent, but should include `UTC`, `Local`, or any location in the [IANA Time Zone database]. +[IANA Time Zone database]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones [`time.Time`]: https://pkg.go.dev/time#Time +[`timeZone`]: https://gohugo.io/getting-started/configuration/#timezone [functions]: /functions/time/ -[iana time zone database]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones [methods]: /methods/time/ diff --git a/content/en/functions/time/Format.md b/content/en/functions/time/Format.md index 74384959b..b9db6905b 100644 --- a/content/en/functions/time/Format.md +++ b/content/en/functions/time/Format.md @@ -19,21 +19,29 @@ toc: true Use the `time.Format` function with `time.Time` values: ```go-html-template -{{ $t := time.AsTime "2023-02-27T23:44:58-08:00" }} -{{ time.Format "2 Jan 2006" $t }} → 27 Feb 2023 +{{ $t := time.AsTime "2023-10-15T13:18:50-07:00" }} +{{ time.Format "2 Jan 2006" $t }} → 15 Oct 2023 ``` -Or use `time.Format` with a *parsable* string representation of a date/time value: +Or use `time.Format` with a parsable string representation of a date/time value: ```go-html-template -{{ $t := "27 Feb 2023" }} -{{ time.Format "January 2, 2006" $t }} → February 27, 2023 +{{ $t := "15 Oct 2023" }} +{{ time.Format "January 2, 2006" $t }} → October 15, 2023 ``` Examples of parsable string representations: {{% include "functions/time/_common/parsable-date-time-strings.md" %}} +To override the default time zone, set the [`timeZone`] in your site configuration. The order of precedence for determining the time zone is: + +1. The time zone offset in the date/time string +2. The time zone specified in your site configuration +3. The `Etc/UTC` time zone + +[`timeZone`]: https://gohugo.io/getting-started/configuration/#timezone + ## Layout string {{% include "functions/_common/time-layout-string.md" %}} diff --git a/content/en/functions/time/_common/parsable-date-time-strings.md b/content/en/functions/time/_common/parsable-date-time-strings.md index a38b9983e..6d1633a6f 100644 --- a/content/en/functions/time/_common/parsable-date-time-strings.md +++ b/content/en/functions/time/_common/parsable-date-time-strings.md @@ -2,13 +2,13 @@ # Do not remove front matter. --- -String representation|Time zone +Format|Time zone :--|:-- -2023-10-15T14:20:28-07:00|America/Los_Angeles -2023-10-15T13:18:50-0700|America/Los_Angeles -2023-10-15T13:18:50Z|Etc/UTC -2023-10-15T13:18:50|Etc/UTC -2023-10-15|Etc/UTC -15 Oct 2023|Etc/UTC +`2023-10-15T13:18:50-07:00`|`America/Los_Angeles` +`2023-10-15T13:18:50-0700`|`America/Los_Angeles` +`2023-10-15T13:18:50Z`|`Etc/UTC` +`2023-10-15T13:18:50`|Default is `Etc/UTC` +`2023-10-15`|Default is `Etc/UTC` +`15 Oct 2023`|Default is `Etc/UTC` -The last four examples are not fully qualified. Without a time zone offset, the time zone is set to Etc/UTC (Coordinated Universal Time). +The last three examples are not fully qualified, and default to the `Etc/UTC` time zone. diff --git a/content/en/functions/transform/ToMath.md b/content/en/functions/transform/ToMath.md index db93a7382..bbdc7b289 100644 --- a/content/en/functions/transform/ToMath.md +++ b/content/en/functions/transform/ToMath.md @@ -2,7 +2,7 @@ title: transform.ToMath description: Renders a math expression using KaTeX. categories: [] -keywords: [] +keywords: [math,katex] action: aliases: [] related: @@ -36,7 +36,7 @@ These are a subset of the [KaTeX options]. output : (`string`). Determines the markup language of the output. One of `html`, `mathml`, or `htmlAndMathml`. Default is `mathml`. - + {{% comment %}}Indent to prevent splitting the description list.{{% / comment %}} With `html` and `htmlAndMathml` you must include KaTeX CSS within the `head` element of your base template. For example: @@ -94,7 +94,7 @@ There are 3 ways to handle errors from KaTeX: 1. Let KaTeX throw an error and make the build fail. This is the default behavior. 1. Handle the error in your template. See the render hook example below. -1. Set the `throwOnError` option to `false` to make KaTeX render the expression as an error instead of throwing an error. See [options]. +1. Set the `throwOnError` option to `false` to make KaTeX render the expression as an error instead of throwing an error. See [options](#options). {{< code file=layouts/_default/_markup/render-passthrough-inline.html copy=true >}} {{ with transform.ToMath .Inner }} diff --git a/content/en/getting-started/configuration-build.md b/content/en/getting-started/configuration-build.md new file mode 100644 index 000000000..cc64b51d7 --- /dev/null +++ b/content/en/getting-started/configuration-build.md @@ -0,0 +1,88 @@ +--- +title: Configure build +description: Configure global build options. +categories: [getting started,fundamentals] +keywords: [build,buildStats,cache] +menu: + docs: + parent: getting-started + weight: 60 +weight: 60 +slug: configuration-build +toc: true +--- + +The `build` configuration section contains global build-related configuration options. + +{{< code-toggle config=build />}} + +#### buildStats + +See [Configure buildStats](#configure-build-stats). + +#### cachebusters + +See [Configure Cache Busters](#configure-cache-busters). + +#### noJSConfigInAssets + +(`bool`) If `true`, turns off writing a `jsconfig.json` into your `/assets` folder with mapping of imports from running [js.Build](/hugo-pipes/js). This file is intended to help with intellisense/navigation inside code editors such as [VS Code](https://code.visualstudio.com/). Note that if you do not use `js.Build`, no file will be written. + +#### useResourceCacheWhen + +(`string`) When to use the cached resources in `/resources/_gen` for PostCSS and ToCSS. Valid values are `never`, `always` and `fallback`. The last value means that the cache will be tried if PostCSS/extended version is not available. + + +## Configure cache busters + +{{< new-in 0.112.0 >}} + +The `build.cachebusters` configuration option was added to support development using Tailwind 3.x's JIT compiler where a `build` configuration may look like this: + +{{< code-toggle file=hugo >}} +[build] + [build.buildStats] + enable = true + [[build.cachebusters]] + source = "assets/watching/hugo_stats\\.json" + target = "styles\\.css" + [[build.cachebusters]] + source = "(postcss|tailwind)\\.config\\.js" + target = "css" + [[build.cachebusters]] + source = "assets/.*\\.(js|ts|jsx|tsx)" + target = "js" + [[build.cachebusters]] + source = "assets/.*\\.(.*)$" + target = "$1" +{{< /code-toggle >}} + +When `buildStats` {{< new-in 0.115.1 >}} is enabled, Hugo writes a `hugo_stats.json` file on each build with HTML classes etc. that's used in the rendered output. Changes to this file will trigger a rebuild of the `styles.css` file. You also need to add `hugo_stats.json` to Hugo's server watcher. See [Hugo Starter Tailwind Basic](https://github.com/bep/hugo-starter-tailwind-basic) for a running example. + +source +: A regexp matching file(s) relative to one of the virtual component directories in Hugo, typically `assets/...`. + +target +: A regexp matching the keys in the resource cache that should be expired when `source` changes. You can use the matching regexp groups from `source` in the expression, e.g. `$1`. + +## Configure build stats + +{{< code-toggle config=build.buildStats />}} + +{{< new-in 0.115.1 >}} + +If `enable` is set to `true`, creates a `hugo_stats.json` file in the root of your project. This file contains arrays of the `class` attributes, `id` attributes, and tags of every HTML element within your published site. Use this file as data source when [removing unused CSS] from your site. This process is also known as pruning, purging, or tree shaking. + +[removing unused CSS]: /hugo-pipes/postprocess/#css-purging-with-postcss + +Exclude `class` attributes, `id` attributes, or tags from `hugo_stats.json` with the `disableClasses`, `disableIDs`, and `disableTags` keys. + +{{% note %}} +Given that CSS purging is typically limited to production builds, place the `buildStats` object below [config/production]. + +[config/production]: /getting-started/configuration/#configuration-directory + +Built for speed, there may be "false positive" detections (e.g., HTML elements that are not HTML elements) while parsing the published site. These "false positives" are infrequent and inconsequential. +{{% /note %}} + +Due to the nature of partial server builds, new HTML entities are added while the server is running, but old values will not be removed until you restart the server or run a regular `hugo` build. \ No newline at end of file diff --git a/content/en/getting-started/configuration-markup.md b/content/en/getting-started/configuration-markup.md index 0046ff1ed..bcc997519 100644 --- a/content/en/getting-started/configuration-markup.md +++ b/content/en/getting-started/configuration-markup.md @@ -238,7 +238,7 @@ This is the default configuration for the AsciiDoc renderer: ###### attributes -(`map`) A map of key-value pairs, each a document attributes. See Asciidoctor’s [attributes]. +(`map`) A map of key-value pairs, each a document attribute. See Asciidoctor’s [attributes]. [attributes]: https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#attributes-and-substitutions diff --git a/content/en/getting-started/configuration.md b/content/en/getting-started/configuration.md index b0a6cae66..342804a72 100644 --- a/content/en/getting-started/configuration.md +++ b/content/en/getting-started/configuration.md @@ -228,6 +228,10 @@ See [Configure Build](#configure-build). See [Configure File Caches](#configure-file-caches). +###### canonifyURLs + +(`bool`) See [details](/content-management/urls/#canonical-urls) before enabling this feature. Default is `false`. + ###### capitalizeListTitles {{< new-in 0.123.3 >}} @@ -246,10 +250,6 @@ For a website in a single language, define the `[[cascade]]` in [Front Matter](/ To remain consistent and prevent unexpected behavior, do not mix these strategies. {{% /note %}} -###### canonifyURLs - -(`bool`) See [details](/content-management/urls/#canonical-urls) before enabling this feature. Default is `false`. - ###### cleanDestinationDir (`bool`) When building, removes files from destination not found in static directories. Default is `false`. @@ -288,6 +288,10 @@ To remain consistent and prevent unexpected behavior, do not mix these strategie [kinds]: /getting-started/glossary/#page-kind +###### disableLanguages + +See [disable a language](/content-management/multilingual/#disable-a-language). + ###### disableLiveReload (`bool`) Disable automatic live reloading of browser window. Default is `false`. @@ -312,6 +316,9 @@ To remain consistent and prevent unexpected behavior, do not mix these strategie (`bool`) Enable generation of `robots.txt` file. Default is `false`. +###### environment + +(`string`) Build environment. Default is `production` when running `hugo` and `development` when running `hugo server`. See [Configuration directory](https://gohugo.io/getting-started/configuration/#configuration-directory). ###### frontmatter See [Front matter Configuration](#configure-front-matter). @@ -320,6 +327,22 @@ See [Front matter Configuration](#configure-front-matter). (`bool`) If true, auto-detect Chinese/Japanese/Korean Languages in the content. This will make `.Summary` and `.WordCount` behave correctly for CJK languages. Default is `false`. +###### ignoreCache + +(`bool`) Ignore the cache directory. Default is `false`. + +###### ignoreLogs +(`string slice`) A slice of message identifiers corresponding to warnings and errors you wish to suppress. See [`erroridf`] and [`warnidf`]. + +[`erroridf`]: /functions/fmt/erroridf/ +[`warnidf`]: /functions/fmt/warnidf/ + +###### ignoreVendorPaths + +(`string`) Ignore vendored modules that match the given [Glob] pattern within the `_vendor` directory. + +[Glob]: https://github.com/gobwas/glob?tab=readme-ov-file#example] + ###### imaging See [image processing configuration](/content-management/image-processing/#imaging-configuration). @@ -338,9 +361,9 @@ When present in the root of the configuration, this value is ignored if one or m See [Configure Languages](/content-management/multilingual/#configure-languages). -###### disableLanguages +###### layoutDir -See [Disable a Language](/content-management/multilingual/#disable-a-language) +(`string`) The directory that contains templates. Default is `layouts`. ###### markup @@ -366,6 +389,10 @@ Module configuration see [module configuration](/hugo-modules/configuration/). (`string`) The editor to use when creating new content. +###### noBuildLock + +(`bool`) Don't create `.hugo_build.lock` file. Default is `false`. + ###### noChmod (`bool`) Don't sync permission mode of files. Default is `false`. @@ -386,6 +413,10 @@ See [configure page](#configure-page). See [configure pagination](/templates/pagination/#configuration). +###### panicOnWarning + +(`bool`) Whether to panic on first WARNING. Default is `false`. + ###### permalinks See [Content Management](/content-management/urls/#permalinks). @@ -394,6 +425,18 @@ See [Content Management](/content-management/urls/#permalinks). (`bool`) Whether to pluralize automatic list titles. Applicable to section pages. Default is `true`. +###### printI18nWarnings + +(`bool`) Whether to log WARNINGs for each missing translation. Default is `false`. + +###### printPathWarnings + +(`bool`) Whether to log WARNINGs when Hugo publishes two or more files to the same path. Default is `false`. + +###### printUnusedTemplates + +(`bool`) Whether to log WARNINGs for each unused template. Default is `false`. + ###### publishDir (`string`) The directory to where Hugo will write the final static site (the HTML files etc.). Default is `public`. @@ -414,12 +457,6 @@ See [Related Content](/content-management/related/#configure-related-content). (`bool`) See [details](/content-management/urls/#relative-urls) before enabling this feature. Default is `false`. -###### renderSegments - -{{< new-in 0.124.0 >}} - -(`string slice`) A list of segments to render. If not set, everything will be rendered. This is more commonly set in a CLI flag, e.g. `hugo --renderSegments segment1,segment2`. The segment names must match the names in the [segments](#configure-segments) configuration. - ###### removePathAccents (`bool`) Removes [non-spacing marks](https://www.compart.com/en/unicode/category/Mn) from [composite characters](https://en.wikipedia.org/wiki/Precomposed_character) in content paths. Default is `false`. @@ -428,6 +465,12 @@ See [Related Content](/content-management/related/#configure-related-content). content/post/hügó.md → https://example.org/post/hugo/ ``` +###### renderSegments + +{{< new-in 0.124.0 >}} + +(`string slice`) A list of segments to render. If not set, everything will be rendered. This is more commonly set in a CLI flag, e.g. `hugo --renderSegments segment1,segment2`. The segment names must match the names in the [segments](#configure-segments) configuration. + ###### sectionPagesMenu See [Menus](/content-management/menus/#define-automatically). @@ -446,14 +489,23 @@ Default [sitemap configuration](/templates/sitemap/#configuration). ###### summaryLength -(`int`) Applicable to automatic summaries, the approximate number of words to render when calling the [`Summary`] method on a `Page` object. Default is `70`. +(`int`) Applicable to [automatic summaries], the minimum number of words to render when calling the [`Summary`] method on a `Page` object. In this case the `Summary` method returns the content, truncated to the paragraph closest to the `summaryLength`. +[automatic summaries]: /content-management/summaries/#automatic-summary [`Summary`]: /methods/page/summary/ ###### taxonomies See [Configure Taxonomies](/content-management/taxonomies#configure-taxonomies). +###### templateMetrics + +(`bool`) Whether to print template execution metrics to the console. Default is `false`. See [Template metrics](/troubleshooting/performance/#template-metrics). + +###### templateMetricsHints + +(`bool`) Whether to print template execution improvement hints to the console. Applicable when `templateMetrics` is `true`. Default is `false`. See [Template metrics](/troubleshooting/performance/#template-metrics). + ###### theme See [module configuration](/hugo-modules/configuration/#module-configuration-imports) for how to import a theme. @@ -468,7 +520,11 @@ See [module configuration](/hugo-modules/configuration/#module-configuration-imp ###### timeZone -(`string`) The time zone (or location), e.g. `Europe/Oslo`, used to parse front matter dates without such information and in the [`time`] function. The list of valid values may be system dependent, but should include `UTC`, `Local`, and any location in the [IANA Time Zone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). +(`string`) The time zone used to parse dates without time zone offsets, including front matter date fields and values passed to the [`time.AsTime`] and [`time.Format`] template functions. The list of valid values may be system dependent, but should include `UTC`, `Local`, and any location in the [IANA Time Zone Database]. For example, `America/Los_Angeles` and `Europe/Oslo` are valid time zones. + +[`time.AsTime`]: /functions/time/astime/ +[`time.Format`]: /functions/time/format/ +[IANA Time Zone Database]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones ###### title @@ -480,7 +536,7 @@ See [module configuration](/hugo-modules/configuration/#module-configuration-imp ###### uglyURLs -(`bool`) When enabled, creates URL of the form `/filename.html` instead of `/filename/`. Default is `false`. +(`bool` or `map`) Whether to generate uglyURLs. Default is `false`. See [details](/content-management/urls/#appearance). ###### watch @@ -546,69 +602,8 @@ These settings do not apply to the [`Next`] or [`Prev`] methods on a `Pages` obj ## Configure build -The `build` configuration section contains global build-related configuration options. +See [Configure Build](/getting-started/configuration-build/). -{{< code-toggle config=build />}} - -buildStats {{< new-in 0.115.1 >}} -: When enabled, creates a `hugo_stats.json` file in the root of your project. This file contains arrays of the `class` attributes, `id` attributes, and tags of every HTML element within your published site. Use this file as data source when [removing unused CSS] from your site. This process is also known as pruning, purging, or tree shaking. - -[removing unused CSS]: /hugo-pipes/postprocess/#css-purging-with-postcss - -Exclude `class` attributes, `id` attributes, or tags from `hugo_stats.json` with the `disableClasses`, `disableIDs`, and `disableTags` keys. - -{{% note %}} -With v0.115.0 and earlier this feature was enabled by setting `writeStats` to `true`. Although still functional, the `writeStats` key will be deprecated in a future release. - -Given that CSS purging is typically limited to production builds, place the `buildStats` object below [config/production]. - -[config/production]: /getting-started/configuration/#configuration-directory - -Built for speed, there may be "false positive" detections (e.g., HTML elements that are not HTML elements) while parsing the published site. These "false positives" are infrequent and inconsequential. -{{% /note %}} - -Due to the nature of partial server builds, new HTML entities are added while the server is running, but old values will not be removed until you restart the server or run a regular `hugo` build. - -cachebusters -: See [Configure Cache Busters](#configure-cache-busters) - -noJSConfigInAssets -: Turn off writing a `jsconfig.json` into your `/assets` folder with mapping of imports from running [js.Build](/hugo-pipes/js). This file is intended to help with intellisense/navigation inside code editors such as [VS Code](https://code.visualstudio.com/). Note that if you do not use `js.Build`, no file will be written. - -useResourceCacheWhen -: When to use the cached resources in `/resources/_gen` for PostCSS and ToCSS. Valid values are `never`, `always` and `fallback`. The last value means that the cache will be tried if PostCSS/extended version is not available. - -## Configure cache busters - -{{< new-in 0.112.0 >}} - -The `build.cachebusters` configuration option was added to support development using Tailwind 3.x's JIT compiler where a `build` configuration may look like this: - -{{< code-toggle file=hugo >}} -[build] - [build.buildStats] - enable = true - [[build.cachebusters]] - source = "assets/watching/hugo_stats\\.json" - target = "styles\\.css" - [[build.cachebusters]] - source = "(postcss|tailwind)\\.config\\.js" - target = "css" - [[build.cachebusters]] - source = "assets/.*\\.(js|ts|jsx|tsx)" - target = "js" - [[build.cachebusters]] - source = "assets/.*\\.(.*)$" - target = "$1" -{{< /code-toggle >}} - -When `buildStats` {{< new-in 0.115.1 >}} is enabled, Hugo writes a `hugo_stats.json` file on each build with HTML classes etc. that's used in the rendered output. Changes to this file will trigger a rebuild of the `styles.css` file. You also need to add `hugo_stats.json` to Hugo's server watcher. See [Hugo Starter Tailwind Basic](https://github.com/bep/hugo-starter-tailwind-basic) for a running example. - -source -: A regexp matching file(s) relative to one of the virtual component directories in Hugo, typically `assets/...`. - -target -: A regexp matching the keys in the resource cache that should be expired when `source` changes. You can use the matching regexp groups from `source` in the expression, e.g. `$1`. ## Configure server @@ -748,7 +743,7 @@ HUGO_NUMWORKERMULTIPLIER ## Configure with environment variables -In addition to the 3 configuration options already mentioned, configuration key-values can be defined through operating system environment variables. +Configuration key-values can be defined through operating system environment variables. For example, the following command will effectively set a website's title on Unix-like systems: @@ -885,7 +880,6 @@ If this is not set, Hugo will use, in order of preference: If you want to know the current value of `cacheDir`, you can run `hugo config`, e.g: `hugo config | grep cachedir`. -[`time`]: /functions/time/astime/ [`.Site.Params`]: /method/site/params/ [directory structure]: /getting-started/directory-structure/ [lookup order]: /templates/lookup-order/ @@ -919,7 +913,7 @@ The caching in Hugo is layered: ``` Dynacache -: A in memory LRU cache that gets evicted on changes, [Cache Buster](#configure-cache-busters) matches and in low memory situations. +: A in memory LRU cache that gets evicted on changes, [Cache Buster](/getting-started/configuration-build/#configure-cache-busters) matches and in low memory situations. HTTP Cache : Enables HTTP cache behavior (RFC 9111) for remote resources. This works best for resources with properly set up HTTP cache headers. The HTTP cache uses the [file cache] to store and serve cached resources. diff --git a/content/en/getting-started/glossary.md b/content/en/getting-started/glossary.md index cdd9c58ee..0e63c790d 100644 --- a/content/en/getting-started/glossary.md +++ b/content/en/getting-started/glossary.md @@ -223,7 +223,7 @@ Adaptation of a site to meet language and regional requirements. This includes t {{< new-in 0.123.0 >}} -A page or page resource identifier derived from the file path, excluding its extension and language identifier. This value is neither a file path nor a URL. Starting with a file path relative to the content directory, Hugo determines the logical path by stripping the file extension and language identifier, converting to lower case, then replacing spaces with hyphens. See [examples](/methods/page/path/#examples). +A page or page resource identifier derived from the file path, excluding its extension and language identifier. This value is neither a file path nor a URL. Starting with a file path relative to the content directory, Hugo determines the logical path by stripping the file extension and language identifier, converting to lower case, then replacing spaces with hyphens. {{% comment %}}{{% /comment %}} See [examples](/methods/page/path/#examples). ###### map diff --git a/content/en/getting-started/quick-start.md b/content/en/getting-started/quick-start.md index 6e67cb73b..bdb3247ba 100644 --- a/content/en/getting-started/quick-start.md +++ b/content/en/getting-started/quick-start.md @@ -10,7 +10,7 @@ menu: weight: 20 toc: true aliases: [/quickstart/,/overview/quickstart/] -minVersion: v0.112.0 +minVersion: v0.128.0 --- In this tutorial you will: @@ -24,7 +24,7 @@ In this tutorial you will: Before you begin this tutorial you must: -1. [Install Hugo] (extended edition, {{% param "minVersion" %}} or later) +1. [Install Hugo] (extended or extended/deploy edition, {{% param "minVersion" %}} or later) 1. [Install Git] You must also be comfortable working from the command line. diff --git a/content/en/hosting-and-deployment/hosting-on-github/index.md b/content/en/hosting-and-deployment/hosting-on-github/index.md index 03cb95bb8..28c5ff841 100644 --- a/content/en/hosting-and-deployment/hosting-on-github/index.md +++ b/content/en/hosting-and-deployment/hosting-on-github/index.md @@ -97,7 +97,7 @@ jobs: build: runs-on: ubuntu-latest env: - HUGO_VERSION: 0.128.0 + HUGO_VERSION: 0.137.1 steps: - name: Install Hugo CLI run: | diff --git a/content/en/hosting-and-deployment/hosting-on-gitlab.md b/content/en/hosting-and-deployment/hosting-on-gitlab.md index 440bbc13d..d455c83e5 100644 --- a/content/en/hosting-and-deployment/hosting-on-gitlab.md +++ b/content/en/hosting-and-deployment/hosting-on-gitlab.md @@ -27,8 +27,8 @@ Define your [CI/CD](https://docs.gitlab.com/ee/ci/quick_start/) jobs by creating {{< code file=.gitlab-ci.yml copy=true >}} variables: - DART_SASS_VERSION: 1.77.5 - HUGO_VERSION: 0.128.0 + DART_SASS_VERSION: 1.80.6 + HUGO_VERSION: 0.137.1 NODE_VERSION: 20.x GIT_DEPTH: 0 GIT_STRATEGY: clone diff --git a/content/en/hosting-and-deployment/hosting-on-netlify/index.md b/content/en/hosting-and-deployment/hosting-on-netlify/index.md index 66382b7e3..a63451062 100644 --- a/content/en/hosting-and-deployment/hosting-on-netlify/index.md +++ b/content/en/hosting-and-deployment/hosting-on-netlify/index.md @@ -101,7 +101,7 @@ Create a new file named netlify.toml in the root of your project directory. In i {{< code file=netlify.toml >}} [build.environment] -HUGO_VERSION = "0.128.0" +HUGO_VERSION = "0.137.1" TZ = "America/Los_Angeles" [build] @@ -113,8 +113,8 @@ If your site requires Dart Sass to transpile Sass to CSS, the configuration file {{< code file=netlify.toml >}} [build.environment] -HUGO_VERSION = "0.128.0" -DART_SASS_VERSION = "1.77.5" +HUGO_VERSION = "0.137.1" +DART_SASS_VERSION = "1.80.6" TZ = "America/Los_Angeles" [build] diff --git a/content/en/hosting-and-deployment/hugo-deploy.md b/content/en/hosting-and-deployment/hugo-deploy.md index db2448ee7..a7925a666 100644 --- a/content/en/hosting-and-deployment/hugo-deploy.md +++ b/content/en/hosting-and-deployment/hugo-deploy.md @@ -1,6 +1,6 @@ --- title: Hugo Deploy -description: Upload your site to GCS, S3, or Azure +description: Deploy your site directly to a Google Cloud Storage bucket, an AWS S3 bucket, or an Azure Storage container. categories: [hosting and deployment] keywords: [deployment,s3,gcs,azure] menu: @@ -11,8 +11,13 @@ weight: 20 toc: true --- -You can use the "hugo deploy" command to upload your site directly to a Google Cloud Storage (GCS) bucket, an AWS S3 bucket, and/or an Azure Storage container. +Use the `hugo deploy` command to deploy your site directly to a Google Cloud Storage bucket, an AWS S3 bucket, or an Azure Storage container +{{% note %}} +This feature requires the Hugo extended/deploy edition. See the [installation] section for details. + +[installation]: /installation/ +{{% /note %}} ## Assumptions diff --git a/content/en/hugo-pipes/transpile-sass-to-css.md b/content/en/hugo-pipes/transpile-sass-to-css.md index ee4b1295d..df7eaa2a9 100644 --- a/content/en/hugo-pipes/transpile-sass-to-css.md +++ b/content/en/hugo-pipes/transpile-sass-to-css.md @@ -20,7 +20,7 @@ aliases: [/hugo-pipes/transform-to-css/] ## Usage -Transpile Sass to CSS using the LibSass transpiler included in Hugo's extended edition, or [install Dart Sass](#dart-sass) to use the latest features of the Sass language. +Transpile Sass to CSS using the LibSass transpiler included in Hugo's extended and extended/deploy editions, or [install Dart Sass](#dart-sass) to use the latest features of the Sass language. ```go-html-template {{ $opts := dict "transpiler" "libsass" "targetPath" "css/style.css" }} @@ -37,7 +37,7 @@ Sass has two forms of syntax: [SCSS] and [indented]. Hugo supports both. ## Options transpiler -: (`string`) The transpiler to use, either `libsass` (default) or `dartsass`. Hugo's extended edition includes the LibSass transpiler. To use the Dart Sass transpiler, see the [installation instructions](#dart-sass) below. +: (`string`) The transpiler to use, either `libsass` (default) or `dartsass`. Hugo's extended and extended/deploy editions include the LibSass transpiler. To use the Dart Sass transpiler, see the [installation instructions](#dart-sass) below. targetPath : (`string`) If not set, the transformed resource's target path will be the original path of the asset file with its extension replaced by `.css`. @@ -136,8 +136,8 @@ To install Dart Sass for your builds on GitLab Pages, the `.gitlab-ci.yml` file ```yaml variables: - HUGO_VERSION: 0.128.0 - DART_SASS_VERSION: 1.77.5 + HUGO_VERSION: 0.137.1 + DART_SASS_VERSION: 1.80.6 GIT_DEPTH: 0 GIT_STRATEGY: clone GIT_SUBMODULE_STRATEGY: recursive @@ -170,8 +170,8 @@ To install Dart Sass for your builds on Netlify, the `netlify.toml` file should ```toml [build.environment] -HUGO_VERSION = "0.128.0" -DART_SASS_VERSION = "1.77.5" +HUGO_VERSION = "0.137.1" +DART_SASS_VERSION = "1.80.6" TZ = "America/Los_Angeles" [build] diff --git a/content/en/installation/_common/01-editions.md b/content/en/installation/_common/01-editions.md index deec8cc83..7a80a522e 100644 --- a/content/en/installation/_common/01-editions.md +++ b/content/en/installation/_common/01-editions.md @@ -2,15 +2,15 @@ # Do not remove front matter. --- -## Editions +Hugo is available in three editions: standard, extended, and extended/deploy. While the standard edition provides core functionality, the extended and extended/deploy editions offer advanced features. -Hugo is available in two editions: standard and extended. With the extended edition you can: - -- Encode to the WebP format when [processing images]. You can decode WebP images with either edition. -- [Transpile Sass to CSS] using the embedded LibSass transpiler. The extended edition is not required to use the [Dart Sass] transpiler. - -We recommend that you install the extended edition. +Feature|extended edition|extended/deploy edition +:--|:-:|:-: +Encode to the WebP format when [processing images]. You can decode WebP images with any edition.|:heavy_check_mark:|:heavy_check_mark: +[Transpile Sass to CSS] using the embedded LibSass transpiler. You can use the [Dart Sass] transpiler with any edition.|:heavy_check_mark:|:heavy_check_mark: +Deploy your site directly to a Google Cloud Storage bucket, an AWS S3 bucket, or an Azure Storage container. See [details].|:x:|:heavy_check_mark: [dart sass]: /hugo-pipes/transpile-sass-to-css/#dart-sass [processing images]: /content-management/image-processing/ [transpile sass to css]: /hugo-pipes/transpile-sass-to-css/ +[details]: /hosting-and-deployment/hugo-deploy/ diff --git a/content/en/installation/_common/04-build-from-source.md b/content/en/installation/_common/04-build-from-source.md index 63be3e456..6829c50ce 100644 --- a/content/en/installation/_common/04-build-from-source.md +++ b/content/en/installation/_common/04-build-from-source.md @@ -4,7 +4,7 @@ ## Build from source -To build the extended edition of Hugo from source you must: +To build the extended or extended/deploy edition from source you must: 1. Install [Git] 1. Install [Go] version 1.20 or later @@ -13,11 +13,22 @@ To build the extended edition of Hugo from source you must: > The install directory is controlled by the `GOPATH` and `GOBIN` environment variables. If `GOBIN` is set, binaries are installed to that directory. If `GOPATH` is set, binaries are installed to the bin subdirectory of the first directory in the `GOPATH` list. Otherwise, binaries are installed to the bin subdirectory of the default `GOPATH` (`$HOME/go` or `%USERPROFILE%\go`). -Then build and test: +To build the standard edition: + +```sh +go install github.com/gohugoio/hugo@latest +``` + +To build the extended edition: ```sh CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest -hugo version +``` + +To build the extended/deploy edition: + +```sh +CGO_ENABLED=1 go install -tags extended,withdeploy github.com/gohugoio/hugo@latest ``` [Clang]: https://clang.llvm.org/ diff --git a/content/en/installation/bsd.md b/content/en/installation/bsd.md index 6d00b8b98..1b2589c75 100644 --- a/content/en/installation/bsd.md +++ b/content/en/installation/bsd.md @@ -10,8 +10,13 @@ menu: weight: 50 toc: true --- + +## Editions + {{% include "installation/_common/01-editions.md" %}} +Unless your specific deployment needs require the extended/deploy edition, we recommend the extended edition. + {{% include "installation/_common/02-prerequisites.md" %}} {{% include "installation/_common/03-prebuilt-binaries.md" %}} diff --git a/content/en/installation/linux.md b/content/en/installation/linux.md index 769011212..2403bf47b 100644 --- a/content/en/installation/linux.md +++ b/content/en/installation/linux.md @@ -10,8 +10,13 @@ menu: weight: 30 toc: true --- + +## Editions + {{% include "installation/_common/01-editions.md" %}} +Unless your specific deployment needs require the extended/deploy edition, we recommend the extended edition. + {{% include "installation/_common/02-prerequisites.md" %}} {{% include "installation/_common/03-prebuilt-binaries.md" %}} @@ -157,6 +162,14 @@ Derivatives of the [Gentoo] distribution of Linux include [Calculate Linux], [Fu [Gentoo]: https://www.gentoo.org/ [USE]: https://packages.gentoo.org/packages/www-apps/hugo +### NixOS + +The NixOS distribution of Linux includes Hugo in its package repository. To install the extended edition of Hugo: + +```sh +nix-env -iA nixos.hugo +``` + ### openSUSE Derivatives of the [openSUSE] distribution of Linux include [GeckoLinux], [Linux Karmada], and others. To install the extended edition of Hugo: diff --git a/content/en/installation/macos.md b/content/en/installation/macos.md index fa6029679..dace545db 100644 --- a/content/en/installation/macos.md +++ b/content/en/installation/macos.md @@ -10,8 +10,13 @@ menu: weight: 20 toc: true --- + +## Editions + {{% include "installation/_common/01-editions.md" %}} +Unless your specific deployment needs require the extended/deploy edition, we recommend the extended edition. + {{% include "installation/_common/02-prerequisites.md" %}} {{% include "installation/_common/03-prebuilt-binaries.md" %}} diff --git a/content/en/installation/windows.md b/content/en/installation/windows.md index 719264550..e04268cd2 100644 --- a/content/en/installation/windows.md +++ b/content/en/installation/windows.md @@ -15,8 +15,12 @@ toc: true Hugo v0.121.1 and later require at least Windows 10 or Windows Server 2016. {{% /note %}} +## Editions + {{% include "installation/_common/01-editions.md" %}} +Unless your specific deployment needs require the extended/deploy edition, we recommend the extended edition. + {{% include "installation/_common/02-prerequisites.md" %}} {{% include "installation/_common/03-prebuilt-binaries.md" %}} diff --git a/content/en/methods/page/ContentWithoutSummary.md b/content/en/methods/page/ContentWithoutSummary.md index 5080f6717..44d660cef 100644 --- a/content/en/methods/page/ContentWithoutSummary.md +++ b/content/en/methods/page/ContentWithoutSummary.md @@ -25,4 +25,4 @@ Applicable when using manual or automatic [content summaries], the `ContentWitho {{ .ContentWithoutSummary }} ``` -The `ContentWithoutSummary` method returns an empty string if you define the content summary in front matter. +The `ContentWithoutSummary` method returns the same as `Content` if you define the content summary in front matter. diff --git a/content/en/methods/page/Language.md b/content/en/methods/page/Language.md index 321b44e56..e12fc2e62 100644 --- a/content/en/methods/page/Language.md +++ b/content/en/methods/page/Language.md @@ -26,36 +26,41 @@ languageName = 'Deutsch' weight = 2 {{< /code-toggle >}} -Lang -: (`string`) The language tag as defined by [RFC 5646]. +###### Lang + +(`string`) The language tag as defined by [RFC 5646]. ```go-html-template {{ .Language.Lang }} → de ``` -LanguageCode -: (`string`) The language code from the site configuration. Falls back to `Lang` if not defined. +###### LanguageCode + +(`string`) The language code from the site configuration. Falls back to `Lang` if not defined. ```go-html-template {{ .Language.LanguageCode }} → de-DE ``` -LanguageDirection -: (`string`) The language direction from the site configuration, either `ltr` or `rtl`. +###### LanguageDirection + +(`string`) The language direction from the site configuration, either `ltr` or `rtl`. ```go-html-template {{ .Language.LanguageDirection }} → ltr ``` -LanguageName -: (`string`) The language name from the site configuration. +###### LanguageName + +(`string`) The language name from the site configuration. ```go-html-template {{ .Language.LanguageName }} → Deutsch ``` -Weight -: (`int`) The language weight from the site configuration which determines its order in the slice of languages returned by the `Languages` method on a `Site` object. +###### Weight + +(`int`) The language weight from the site configuration which determines its order in the slice of languages returned by the `Languages` method on a `Site` object. ```go-html-template {{ .Language.Weight }} → 2 diff --git a/content/en/methods/page/Paginate.md b/content/en/methods/page/Paginate.md index d9acb6b93..02daa64b4 100644 --- a/content/en/methods/page/Paginate.md +++ b/content/en/methods/page/Paginate.md @@ -10,7 +10,7 @@ action: signatures: ['PAGE.Paginate COLLECTION [N]'] --- -[Pagination] is the process of splitting a list page into two or more pagers, where each pager contains a subset of the page collection and navigation links to other pagers. +Pagination is the process of splitting a list page into two or more pagers, where each pager contains a subset of the page collection and navigation links to other pagers. By default, the number of elements on each pager is determined by your [site configuration]. The default is `10`. Override that value by providing a second argument, an integer, when calling the `Paginate` method. diff --git a/content/en/methods/page/Paginator.md b/content/en/methods/page/Paginator.md index f57e2437e..3dd959006 100644 --- a/content/en/methods/page/Paginator.md +++ b/content/en/methods/page/Paginator.md @@ -10,7 +10,7 @@ action: signatures: [PAGE.Paginator] --- -[Pagination] is the process of splitting a list page into two or more pagers, where each pager contains a subset of the page collection and navigation links to other pagers. +Pagination is the process of splitting a list page into two or more pagers, where each pager contains a subset of the page collection and navigation links to other pagers. The number of elements on each pager is determined by your [site configuration]. The default is `10`. diff --git a/content/en/methods/page/RenderShortcodes.md b/content/en/methods/page/RenderShortcodes.md index 9679fc8d5..e95e0683e 100644 --- a/content/en/methods/page/RenderShortcodes.md +++ b/content/en/methods/page/RenderShortcodes.md @@ -32,9 +32,9 @@ For example: Then call the shortcode in your Markdown: {{< code file=content/about.md lang=md >}} -{{%/* include "/snippets/services.md" */%}} -{{%/* include "/snippets/values.md" */%}} -{{%/* include "/snippets/leadership.md" */%}} +{{%/* include "/snippets/services" */%}} +{{%/* include "/snippets/values" */%}} +{{%/* include "/snippets/leadership" */%}} {{< /code >}} Each of the included Markdown files can contain calls to other shortcodes. @@ -79,3 +79,14 @@ An *emphasized* word. ``` Note that the shortcode within the content file was rendered, but the surrounding Markdown was preserved. + + +## Limitations + +The primary use case for `.RenderShortcodes` is inclusion of Markdown content. If you try to use `.RenderShortcodes` inside `HTML` blocks when inside Markdown, you will get a warning similar to this: + +``` +WARN .RenderShortcodes detected inside HTML block in "/content/mypost.md"; this may not be what you intended ... +``` + +The above warning can be turned off is this is what you really want. diff --git a/content/en/methods/page/Scratch.md b/content/en/methods/page/Scratch.md index 8fef31893..41b1d17fd 100644 --- a/content/en/methods/page/Scratch.md +++ b/content/en/methods/page/Scratch.md @@ -13,6 +13,16 @@ toc: true aliases: [/extras/scratch/,/doc/scratch/,/functions/scratch] --- +{{% deprecated-in 0.138.0 %}} +Use the [`PAGE.Store`] method instead. + +This is a soft deprecation. This method will be removed in a future release, but the removal date has not been established. Although Hugo will not emit a warning if you continue to use this method, you should begin using `PAGE.Store` as soon as possible. + +Beginning with v0.138.0 the `PAGE.Scratch` method is aliased to `PAGE.Store`. + +[`PAGE.Store`]: /methods/page/store/ +{{% /deprecated-in %}} + The `Scratch` method on a `Page` object creates a [scratch pad] to store and manipulate data. To create a scratch pad that is not reset on server rebuilds, use the [`Store`] method instead. To create a locally scoped scratch pad that is not attached to a `Page` object, use the [`newScratch`] function. @@ -25,7 +35,7 @@ To create a locally scoped scratch pad that is not attached to a `Page` object, ## Determinate values -The `Scratch` method is often used to set scratch pad values within a shortcode, a partial template called by a shortcode, or by a Markdown render hook. In all three cases, the scratch pad values are not determinate until Hugo renders the page content. +The `Scratch` method is often used to set scratch pad values within a shortcode, a partial template called by a shortcode, or by a Markdown render hook. In all three cases, the scratch pad values are indeterminate until Hugo renders the page content. If you need to access a scratch pad value from a parent template, and the parent template has not yet rendered the page content, you can trigger content rendering by assigning the returned value to a [noop] variable: @@ -36,7 +46,7 @@ If you need to access a scratch pad value from a parent template, and the parent {{ .Store.Get "mykey" }} ``` -You can also trigger content rendering with the `FuzzyWordCount`, `Len`, `Plain`, `PlainWords`, `ReadingTime`, `Summary`, `Truncated`, and `WordCount` methods. For example: +You can also trigger content rendering with the `ContentWithoutSummary`, `FuzzyWordCount`, `Len`, `Plain`, `PlainWords`, `ReadingTime`, `Summary`, `Truncated`, and `WordCount` methods. For example: ```go-html-template {{ $noop := .WordCount }} diff --git a/content/en/methods/page/Store.md b/content/en/methods/page/Store.md index e7090fe79..a81fa71a3 100644 --- a/content/en/methods/page/Store.md +++ b/content/en/methods/page/Store.md @@ -13,9 +13,7 @@ toc: true aliases: [/functions/store] --- -The `Store` method on a `Page` object creates a persistent [scratch pad] to store and manipulate data. In contrast with the [`Scratch`] method, the scratch pad created by the `Store` method is not reset on server rebuilds. - -To create a locally scoped scratch pad that is not attached to a `Page` object, use the [`newScratch`] function. +The `Store` method on a `Page` object creates a persistent [scratch pad] to store and manipulate data. To create a locally scoped scratch pad that is not attached to a `Page` object, use the [`newScratch`] function. [`Scratch`]: /methods/page/scratch/ [`newScratch`]: /functions/collections/newscratch/ @@ -106,7 +104,7 @@ Removes the given key. ## Determinate values -The `Store` method is often used to set scratch pad values within a shortcode, a partial template called by a shortcode, or by a Markdown render hook. In all three cases, the scratch pad values are not determinate until Hugo renders the page content. +The `Store` method is often used to set scratch pad values within a shortcode, a partial template called by a shortcode, or by a Markdown render hook. In all three cases, the scratch pad values are indeterminate until Hugo renders the page content. If you need to access a scratch pad value from a parent template, and the parent template has not yet rendered the page content, you can trigger content rendering by assigning the returned value to a [noop] variable: @@ -117,7 +115,7 @@ If you need to access a scratch pad value from a parent template, and the parent {{ .Store.Get "mykey" }} ``` -You can also trigger content rendering with the `FuzzyWordCount`, `Len`, `Plain`, `PlainWords`, `ReadingTime`, `Summary`, `Truncated`, and `WordCount` methods. For example: +You can also trigger content rendering with the `ContentWithoutSummary`, `FuzzyWordCount`, `Len`, `Plain`, `PlainWords`, `ReadingTime`, `Summary`, `Truncated`, and `WordCount` methods. For example: ```go-html-template {{ $noop := .WordCount }} diff --git a/content/en/methods/page/Summary.md b/content/en/methods/page/Summary.md index e4542d258..490b201d0 100644 --- a/content/en/methods/page/Summary.md +++ b/content/en/methods/page/Summary.md @@ -1,25 +1,27 @@ --- title: Summary -description: Returns the content summary of the given page. +description: Returns the summary of the given page. categories: [] keywords: [] action: related: - methods/page/Truncated + - methods/page/Content + - methods/page/ContentWithoutSummary - methods/page/Description returnType: template.HTML signatures: [PAGE.Summary] --- - - +{{% comment %}} +Do not remove the manual summary divider below. +If you do, you will break its first literal usage on this page. +{{% /comment %}} -There are three ways to define the [content summary]: +You can define a [summary] manually, in front matter, or automatically. A manual summary takes precedence over a front matter summary, and a front matter summary takes precedence over an automatic summary. -1. Let Hugo create the summary based on the first 70 words. You can change the number of words by setting the `summaryLength` in your site configuration. -2. Manually split the content with a `` tag in Markdown. Everything before the tag is included in the summary. -3. Create a `summary` field in front matter. +[summary]: /content-management/summaries/ To list the pages in a section with a summary beneath each link: @@ -30,4 +32,20 @@ To list the pages in a section with a summary beneath each link: {{ end }} ``` -[content summary]: /content-management/summaries/ +Depending on content length and how you define the summary, the summary may be equivalent to the content itself. To determine whether the content length exceeds the summary length, use the [`Truncated`] method on a `Page` object. This is useful for conditionally rendering a “read more” link: + +[`Truncated`]: /methods/page/truncated + +```go-html-template +{{ range .Pages }} +

{{ .LinkTitle }}

+ {{ .Summary }} + {{ if .Truncated }} + Read more... + {{ end }} +{{ end }} +``` + +{{% note %}} +The `Truncated` method returns `false` if you define the summary in front matter. +{{% /note %}} diff --git a/content/en/methods/page/Truncated.md b/content/en/methods/page/Truncated.md index 0785f40cb..b4ec7ce16 100644 --- a/content/en/methods/page/Truncated.md +++ b/content/en/methods/page/Truncated.md @@ -10,17 +10,11 @@ action: signatures: [PAGE.Truncated] --- -There are three ways to define the [content summary]: +You can define a [summary] manually, in front matter, or automatically. A manual summary takes precedence over a front matter summary, and a front matter summary takes precedence over an automatic summary. -1. Let Hugo create the summary based on the first 70 words. You can change the number of words by setting the `summaryLength` in your site configuration. -2. Manually split the content with a `<--more-->` tag in Markdown. Everything before the tag is included in the summary. -3. Create a `summary` field in front matter. +[summary]: /content-management/summaries/ -{{% note %}} -The `Truncated` method returns `false` if you define the summary in front matter. -{{% /note %}} - -The `Truncated` method returns `true` if the content length exceeds the summary length. This is useful for rendering a "read more" link: +The `Truncated` method returns `true` if the content length exceeds the summary length. This is useful for conditionally rendering a "read more" link: ```go-html-template {{ range .Pages }} @@ -32,4 +26,6 @@ The `Truncated` method returns `true` if the content length exceeds the summary {{ end }} ``` -[content summary]: /content-management/summaries/ +{{% note %}} +The `Truncated` method returns `false` if you define the summary in front matter. +{{% /note %}} diff --git a/content/en/methods/page/_common/output-format-definition.md b/content/en/methods/page/_common/output-format-definition.md index 412c5cee6..d21211a3d 100644 --- a/content/en/methods/page/_common/output-format-definition.md +++ b/content/en/methods/page/_common/output-format-definition.md @@ -1,7 +1,6 @@ --- # Do not remove front matter. --- - Hugo generates one or more files per page when building a site. For example, when rendering home, [section], [taxonomy], and [term] pages, Hugo generates an HTML file and an RSS file. Both HTML and RSS are built-in _output formats_. Create multiple output formats, and control generation based on [page kind], or by enabling one or more output formats for one or more pages. See [details]. [section]: /getting-started/glossary/#section diff --git a/content/en/methods/resource/Colors.md b/content/en/methods/resource/Colors.md index b062210ba..9ee71ba7d 100644 --- a/content/en/methods/resource/Colors.md +++ b/content/en/methods/resource/Colors.md @@ -11,8 +11,6 @@ toc: true math: true --- -{{< new-in 0.104.0 >}} - The `Resources.Colors` method returns a slice of the most dominant colors in an image, ordered from most dominant to least dominant. This method is fast, but if you also downsize your image you can improve performance by extracting the colors from the scaled image. {{% include "methods/resource/_common/global-page-remote-resources.md" %}} diff --git a/content/en/methods/shortcode/Inner.md b/content/en/methods/shortcode/Inner.md index 9271adb34..a428720d7 100644 --- a/content/en/methods/shortcode/Inner.md +++ b/content/en/methods/shortcode/Inner.md @@ -29,7 +29,7 @@ With this shortcode:
{{ . }}
{{ end }}
- {{ trim .Inner "\r\n" }} + {{ .Inner | strings.TrimSpace }}
{{< /code >}} @@ -46,9 +46,9 @@ Is rendered to: ``` {{% note %}} -Content between opening and closing shortcode tags may include leading and/or trailing newlines, depending on placement within the Markdown. Use the [`trim`] function as shown above to remove both carriage returns and newlines. +Content between opening and closing shortcode tags may include leading and/or trailing newlines, depending on placement within the Markdown. Use the [`strings.TrimSpace`] function as shown above to remove both carriage returns and newlines. -[`trim`]: /functions/strings/trim/ +[`strings.TrimSpace`]: /functions/strings/trimspace/ {{% /note %}} {{% note %}} @@ -68,7 +68,7 @@ Let's modify the example above to pass the value returned by `Inner` through the
{{ . }}
{{ end }}
- {{ trim .Inner "\r\n" | .Page.RenderString }} + {{ .Inner | strings.TrimSpace | .Page.RenderString }}
{{< /code >}} @@ -119,7 +119,7 @@ Second, because we are rendering the entire shortcode as Markdown, we must adher {{ end }}
- {{ trim .Inner "\r\n" }} + {{ .Inner | strings.TrimSpace }}
{{< /code >}} @@ -136,9 +136,9 @@ The difference between this and the previous example is subtle but required. Not +
{{ . }}
{{ end }}
-- {{ trim .Inner "\r\n" | .Page.RenderString }} +- {{ .Inner | strings.TrimSpace | .Page.RenderString }} + -+ {{ trim .Inner "\r\n" }} ++ {{ .Inner | strings.TrimSpace }}
``` diff --git a/content/en/methods/shortcode/InnerDeindent.md b/content/en/methods/shortcode/InnerDeindent.md index b5f5cf206..ab4263709 100644 --- a/content/en/methods/shortcode/InnerDeindent.md +++ b/content/en/methods/shortcode/InnerDeindent.md @@ -38,7 +38,7 @@ With this shortcode, calling `Inner` instead of `InnerDeindent`: {{< code file=layouts/shortcodes/gallery.html >}} {{< /code >}} @@ -69,7 +69,7 @@ Although technically correct per the CommonMark specification, this is not what {{< code file=layouts/shortcodes/gallery.html >}} {{< /code >}} diff --git a/content/en/methods/shortcode/Parent.md b/content/en/methods/shortcode/Parent.md index c500af375..53fac8237 100644 --- a/content/en/methods/shortcode/Parent.md +++ b/content/en/methods/shortcode/Parent.md @@ -21,7 +21,7 @@ Welcome. Today is {{}}. {{< code file=layouts/shortcodes/greeting.html >}}
- {{ trim .Inner "\r\n" | .Page.RenderString }} + {{ .Inner | strings.TrimSpace | .Page.RenderString }}
{{< /code >}} diff --git a/content/en/methods/site/Language.md b/content/en/methods/site/Language.md index 7179038e4..2400c225a 100644 --- a/content/en/methods/site/Language.md +++ b/content/en/methods/site/Language.md @@ -27,36 +27,41 @@ languageName = 'Deutsch' weight = 1 {{< /code-toggle >}} -Lang -: (`string`) The language tag as defined by [RFC 5646]. +###### Lang + +(`string`) The language tag as defined by [RFC 5646]. ```go-html-template {{ .Site.Language.Lang }} → de ``` -LanguageCode -: (`string`) The language code from the site configuration. Falls back to `Lang` if not defined. +###### LanguageCode + +(`string`) The language code from the site configuration. Falls back to `Lang` if not defined. ```go-html-template {{ .Site.Language.LanguageCode }} → de-DE ``` -LanguageDirection -: (`string`) The language direction from the site configuration, either `ltr` or `rtl`. +###### LanguageDirection + +(`string`) The language direction from the site configuration, either `ltr` or `rtl`. ```go-html-template {{ .Site.Language.LanguageDirection }} → ltr ``` -LanguageName -: (`string`) The language name from the site configuration. +###### LanguageName + +(`string`) The language name from the site configuration. ```go-html-template {{ .Site.Language.LanguageName }} → Deutsch ``` -Weight -: (`int`) The language weight from the site configuration which determines its order in the slice of languages returned by the `Languages` method on a `Site` object. +###### Weight + +(`int`) The language weight from the site configuration which determines its order in the slice of languages returned by the `Languages` method on a `Site` object. ```go-html-template {{ .Site.Language.Weight }} → 1 diff --git a/content/en/methods/site/Taxonomies.md b/content/en/methods/site/Taxonomies.md index d23a0908f..4690e6da5 100644 --- a/content/en/methods/site/Taxonomies.md +++ b/content/en/methods/site/Taxonomies.md @@ -9,12 +9,9 @@ action: signatures: [SITE.Taxonomies] --- - +{{% /comment %}} Conceptually, the `Taxonomies` method on a `Site` object returns a data structure such as: diff --git a/content/en/quick-reference/emojis.md b/content/en/quick-reference/emojis.md index 4c31c5d76..d2e73843f 100644 --- a/content/en/quick-reference/emojis.md +++ b/content/en/quick-reference/emojis.md @@ -53,7 +53,7 @@ To process an emoji shortcode from within a template, use the [`emojify`] functi [`emojify`]: /functions/transform/emojify/ [`RenderString`]: /methods/page/renderstring/ - + 4. Search/replace (regex) "
" "" +{{% /comment %}} ## Table of Contents @@ -106,7 +107,7 @@ Then... | - | :-: | - | :-: | - | - | | [top](#smileys--emotion) | :grinning: | `:grinning:` | :smiley: | `:smiley:` | [top](#table-of-contents) | | [top](#smileys--emotion) | :smile: | `:smile:` | :grin: | `:grin:` | [top](#table-of-contents) | -| [top](#smileys--emotion) | :laughing: | `:laughing:`
`:satisfied:` | :sweat_smile: | `:sweat_smile:` | [top](#table-of-contents) | +| [top](#smileys--emotion) | :laughing: | `:laughing:` `:satisfied:` | :sweat_smile: | `:sweat_smile:` | [top](#table-of-contents) | | [top](#smileys--emotion) | :rofl: | `:rofl:` | :joy: | `:joy:` | [top](#table-of-contents) | | [top](#smileys--emotion) | :slightly_smiling_face: | `:slightly_smiling_face:` | :upside_down_face: | `:upside_down_face:` | [top](#table-of-contents) | | [top](#smileys--emotion) | :melting_face: | `:melting_face:` | :wink: | `:wink:` | [top](#table-of-contents) | @@ -206,7 +207,7 @@ Then... | | ico | shortcode | ico | shortcode | | | - | :-: | - | :-: | - | - | -| [top](#smileys--emotion) | :triumph: | `:triumph:` | :pout: | `:pout:`
`:rage:` | [top](#table-of-contents) | +| [top](#smileys--emotion) | :triumph: | `:triumph:` | :pout: | `:pout:` `:rage:` | [top](#table-of-contents) | | [top](#smileys--emotion) | :angry: | `:angry:` | :cursing_face: | `:cursing_face:` | [top](#table-of-contents) | | [top](#smileys--emotion) | :smiling_imp: | `:smiling_imp:` | :imp: | `:imp:` | [top](#table-of-contents) | | [top](#smileys--emotion) | :skull: | `:skull:` | :skull_and_crossbones: | `:skull_and_crossbones:` | [top](#table-of-contents) | @@ -215,7 +216,7 @@ Then... | | ico | shortcode | ico | shortcode | | | - | :-: | - | :-: | - | - | -| [top](#smileys--emotion) | :hankey: | `:hankey:`
`:poop:`
`:shit:` | :clown_face: | `:clown_face:` | [top](#table-of-contents) | +| [top](#smileys--emotion) | :hankey: | `:hankey:` `:poop:` `:shit:` | :clown_face: | `:clown_face:` | [top](#table-of-contents) | | [top](#smileys--emotion) | :japanese_ogre: | `:japanese_ogre:` | :japanese_goblin: | `:japanese_goblin:` | [top](#table-of-contents) | | [top](#smileys--emotion) | :ghost: | `:ghost:` | :alien: | `:alien:` | [top](#table-of-contents) | | [top](#smileys--emotion) | :space_invader: | `:space_invader:` | :robot: | `:robot:` | [top](#table-of-contents) | @@ -260,7 +261,7 @@ Then... | | ico | shortcode | ico | shortcode | | | - | :-: | - | :-: | - | - | | [top](#smileys--emotion) | :kiss: | `:kiss:` | :100: | `:100:` | [top](#table-of-contents) | -| [top](#smileys--emotion) | :anger: | `:anger:` | :boom: | `:boom:`
`:collision:` | [top](#table-of-contents) | +| [top](#smileys--emotion) | :anger: | `:anger:` | :boom: | `:boom:` `:collision:` | [top](#table-of-contents) | | [top](#smileys--emotion) | :dizzy: | `:dizzy:` | :sweat_drops: | `:sweat_drops:` | [top](#table-of-contents) | | [top](#smileys--emotion) | :dash: | `:dash:` | :hole: | `:hole:` | [top](#table-of-contents) | | [top](#smileys--emotion) | :speech_balloon: | `:speech_balloon:` | :eye_speech_bubble: | `:eye_speech_bubble:` | [top](#table-of-contents) | @@ -291,7 +292,7 @@ Then... | | ico | shortcode | ico | shortcode | | | - | :-: | - | :-: | - | - | | [top](#people--body) | :wave: | `:wave:` | :raised_back_of_hand: | `:raised_back_of_hand:` | [top](#table-of-contents) | -| [top](#people--body) | :raised_hand_with_fingers_splayed: | `:raised_hand_with_fingers_splayed:` | :hand: | `:hand:`
`:raised_hand:` | [top](#table-of-contents) | +| [top](#people--body) | :raised_hand_with_fingers_splayed: | `:raised_hand_with_fingers_splayed:` | :hand: | `:hand:` `:raised_hand:` | [top](#table-of-contents) | | [top](#people--body) | :vulcan_salute: | `:vulcan_salute:` | :rightwards_hand: | `:rightwards_hand:` | [top](#table-of-contents) | | [top](#people--body) | :leftwards_hand: | `:leftwards_hand:` | :palm_down_hand: | `:palm_down_hand:` | [top](#table-of-contents) | | [top](#people--body) | :palm_up_hand: | `:palm_up_hand:` | :leftwards_pushing_hand: | `:leftwards_pushing_hand:` | [top](#table-of-contents) | @@ -312,7 +313,7 @@ Then... | | ico | shortcode | ico | shortcode | | | - | :-: | - | :-: | - | - | | [top](#people--body) | :point_left: | `:point_left:` | :point_right: | `:point_right:` | [top](#table-of-contents) | -| [top](#people--body) | :point_up_2: | `:point_up_2:` | :fu: | `:fu:`
`:middle_finger:` | [top](#table-of-contents) | +| [top](#people--body) | :point_up_2: | `:point_up_2:` | :fu: | `:fu:` `:middle_finger:` | [top](#table-of-contents) | | [top](#people--body) | :point_down: | `:point_down:` | :point_up: | `:point_up:` | [top](#table-of-contents) | | [top](#people--body) | :index_pointing_at_the_viewer: | `:index_pointing_at_the_viewer:` | | | [top](#table-of-contents) | @@ -320,8 +321,8 @@ Then... | | ico | shortcode | ico | shortcode | | | - | :-: | - | :-: | - | - | -| [top](#people--body) | :+1: | `:+1:`
`:thumbsup:` | :-1: | `:-1:`
`:thumbsdown:` | [top](#table-of-contents) | -| [top](#people--body) | :fist: | `:fist:`
`:fist_raised:` | :facepunch: | `:facepunch:`
`:fist_oncoming:`
`:punch:` | [top](#table-of-contents) | +| [top](#people--body) | :+1: | `:+1:` `:thumbsup:` | :-1: | `:-1:` `:thumbsdown:` | [top](#table-of-contents) | +| [top](#people--body) | :fist: | `:fist:` `:fist_raised:` | :facepunch: | `:facepunch:` `:fist_oncoming:` `:punch:` | [top](#table-of-contents) | | [top](#people--body) | :fist_left: | `:fist_left:` | :fist_right: | `:fist_right:` | [top](#table-of-contents) | ### Hands @@ -369,7 +370,7 @@ Then... | [top](#people--body) | :person_red_hair: | `:person_red_hair:` | :curly_haired_woman: | `:curly_haired_woman:` | [top](#table-of-contents) | | [top](#people--body) | :person_curly_hair: | `:person_curly_hair:` | :white_haired_woman: | `:white_haired_woman:` | [top](#table-of-contents) | | [top](#people--body) | :person_white_hair: | `:person_white_hair:` | :bald_woman: | `:bald_woman:` | [top](#table-of-contents) | -| [top](#people--body) | :person_bald: | `:person_bald:` | :blond_haired_woman: | `:blond_haired_woman:`
`:blonde_woman:` | [top](#table-of-contents) | +| [top](#people--body) | :person_bald: | `:person_bald:` | :blond_haired_woman: | `:blond_haired_woman:` `:blonde_woman:` | [top](#table-of-contents) | | [top](#people--body) | :blond_haired_man: | `:blond_haired_man:` | :older_adult: | `:older_adult:` | [top](#table-of-contents) | | [top](#people--body) | :older_man: | `:older_man:` | :older_woman: | `:older_woman:` | [top](#table-of-contents) | @@ -380,11 +381,11 @@ Then... | [top](#people--body) | :frowning_person: | `:frowning_person:` | :frowning_man: | `:frowning_man:` | [top](#table-of-contents) | | [top](#people--body) | :frowning_woman: | `:frowning_woman:` | :pouting_face: | `:pouting_face:` | [top](#table-of-contents) | | [top](#people--body) | :pouting_man: | `:pouting_man:` | :pouting_woman: | `:pouting_woman:` | [top](#table-of-contents) | -| [top](#people--body) | :no_good: | `:no_good:` | :ng_man: | `:ng_man:`
`:no_good_man:` | [top](#table-of-contents) | -| [top](#people--body) | :ng_woman: | `:ng_woman:`
`:no_good_woman:` | :ok_person: | `:ok_person:` | [top](#table-of-contents) | +| [top](#people--body) | :no_good: | `:no_good:` | :ng_man: | `:ng_man:` `:no_good_man:` | [top](#table-of-contents) | +| [top](#people--body) | :ng_woman: | `:ng_woman:` `:no_good_woman:` | :ok_person: | `:ok_person:` | [top](#table-of-contents) | | [top](#people--body) | :ok_man: | `:ok_man:` | :ok_woman: | `:ok_woman:` | [top](#table-of-contents) | -| [top](#people--body) | :information_desk_person: | `:information_desk_person:`
`:tipping_hand_person:` | :sassy_man: | `:sassy_man:`
`:tipping_hand_man:` | [top](#table-of-contents) | -| [top](#people--body) | :sassy_woman: | `:sassy_woman:`
`:tipping_hand_woman:` | :raising_hand: | `:raising_hand:` | [top](#table-of-contents) | +| [top](#people--body) | :information_desk_person: | `:information_desk_person:` `:tipping_hand_person:` | :sassy_man: | `:sassy_man:` `:tipping_hand_man:` | [top](#table-of-contents) | +| [top](#people--body) | :sassy_woman: | `:sassy_woman:` `:tipping_hand_woman:` | :raising_hand: | `:raising_hand:` | [top](#table-of-contents) | | [top](#people--body) | :raising_hand_man: | `:raising_hand_man:` | :raising_hand_woman: | `:raising_hand_woman:` | [top](#table-of-contents) | | [top](#people--body) | :deaf_person: | `:deaf_person:` | :deaf_man: | `:deaf_man:` | [top](#table-of-contents) | | [top](#people--body) | :deaf_woman: | `:deaf_woman:` | :bow: | `:bow:` | [top](#table-of-contents) | @@ -421,7 +422,7 @@ Then... | [top](#people--body) | :astronaut: | `:astronaut:` | :man_astronaut: | `:man_astronaut:` | [top](#table-of-contents) | | [top](#people--body) | :woman_astronaut: | `:woman_astronaut:` | :firefighter: | `:firefighter:` | [top](#table-of-contents) | | [top](#people--body) | :man_firefighter: | `:man_firefighter:` | :woman_firefighter: | `:woman_firefighter:` | [top](#table-of-contents) | -| [top](#people--body) | :cop: | `:cop:`
`:police_officer:` | :policeman: | `:policeman:` | [top](#table-of-contents) | +| [top](#people--body) | :cop: | `:cop:` `:police_officer:` | :policeman: | `:policeman:` | [top](#table-of-contents) | | [top](#people--body) | :policewoman: | `:policewoman:` | :detective: | `:detective:` | [top](#table-of-contents) | | [top](#people--body) | :male_detective: | `:male_detective:` | :female_detective: | `:female_detective:` | [top](#table-of-contents) | | [top](#people--body) | :guard: | `:guard:` | :guardsman: | `:guardsman:` | [top](#table-of-contents) | @@ -434,7 +435,7 @@ Then... | [top](#people--body) | :woman_with_headscarf: | `:woman_with_headscarf:` | :person_in_tuxedo: | `:person_in_tuxedo:` | [top](#table-of-contents) | | [top](#people--body) | :man_in_tuxedo: | `:man_in_tuxedo:` | :woman_in_tuxedo: | `:woman_in_tuxedo:` | [top](#table-of-contents) | | [top](#people--body) | :person_with_veil: | `:person_with_veil:` | :man_with_veil: | `:man_with_veil:` | [top](#table-of-contents) | -| [top](#people--body) | :bride_with_veil: | `:bride_with_veil:`
`:woman_with_veil:` | :pregnant_woman: | `:pregnant_woman:` | [top](#table-of-contents) | +| [top](#people--body) | :bride_with_veil: | `:bride_with_veil:` `:woman_with_veil:` | :pregnant_woman: | `:pregnant_woman:` | [top](#table-of-contents) | | [top](#people--body) | :pregnant_man: | `:pregnant_man:` | :pregnant_person: | `:pregnant_person:` | [top](#table-of-contents) | | [top](#people--body) | :breast_feeding: | `:breast_feeding:` | :woman_feeding_baby: | `:woman_feeding_baby:` | [top](#table-of-contents) | | [top](#people--body) | :man_feeding_baby: | `:man_feeding_baby:` | :person_feeding_baby: | `:person_feeding_baby:` | [top](#table-of-contents) | @@ -476,8 +477,8 @@ Then... | [top](#people--body) | :person_in_motorized_wheelchair: | `:person_in_motorized_wheelchair:` | :man_in_motorized_wheelchair: | `:man_in_motorized_wheelchair:` | [top](#table-of-contents) | | [top](#people--body) | :woman_in_motorized_wheelchair: | `:woman_in_motorized_wheelchair:` | :person_in_manual_wheelchair: | `:person_in_manual_wheelchair:` | [top](#table-of-contents) | | [top](#people--body) | :man_in_manual_wheelchair: | `:man_in_manual_wheelchair:` | :woman_in_manual_wheelchair: | `:woman_in_manual_wheelchair:` | [top](#table-of-contents) | -| [top](#people--body) | :runner: | `:runner:`
`:running:` | :running_man: | `:running_man:` | [top](#table-of-contents) | -| [top](#people--body) | :running_woman: | `:running_woman:` | :dancer: | `:dancer:`
`:woman_dancing:` | [top](#table-of-contents) | +| [top](#people--body) | :runner: | `:runner:` `:running:` | :running_man: | `:running_man:` | [top](#table-of-contents) | +| [top](#people--body) | :running_woman: | `:running_woman:` | :dancer: | `:dancer:` `:woman_dancing:` | [top](#table-of-contents) | | [top](#people--body) | :man_dancing: | `:man_dancing:` | :business_suit_levitating: | `:business_suit_levitating:` | [top](#table-of-contents) | | [top](#people--body) | :dancers: | `:dancers:` | :dancing_men: | `:dancing_men:` | [top](#table-of-contents) | | [top](#people--body) | :dancing_women: | `:dancing_women:` | :sauna_person: | `:sauna_person:` | [top](#table-of-contents) | @@ -497,8 +498,8 @@ Then... | [top](#people--body) | :rowboat: | `:rowboat:` | :rowing_man: | `:rowing_man:` | [top](#table-of-contents) | | [top](#people--body) | :rowing_woman: | `:rowing_woman:` | :swimmer: | `:swimmer:` | [top](#table-of-contents) | | [top](#people--body) | :swimming_man: | `:swimming_man:` | :swimming_woman: | `:swimming_woman:` | [top](#table-of-contents) | -| [top](#people--body) | :bouncing_ball_person: | `:bouncing_ball_person:` | :basketball_man: | `:basketball_man:`
`:bouncing_ball_man:` | [top](#table-of-contents) | -| [top](#people--body) | :basketball_woman: | `:basketball_woman:`
`:bouncing_ball_woman:` | :weight_lifting: | `:weight_lifting:` | [top](#table-of-contents) | +| [top](#people--body) | :bouncing_ball_person: | `:bouncing_ball_person:` | :basketball_man: | `:basketball_man:` `:bouncing_ball_man:` | [top](#table-of-contents) | +| [top](#people--body) | :basketball_woman: | `:basketball_woman:` `:bouncing_ball_woman:` | :weight_lifting: | `:weight_lifting:` | [top](#table-of-contents) | | [top](#people--body) | :weight_lifting_man: | `:weight_lifting_man:` | :weight_lifting_woman: | `:weight_lifting_woman:` | [top](#table-of-contents) | | [top](#people--body) | :bicyclist: | `:bicyclist:` | :biking_man: | `:biking_man:` | [top](#table-of-contents) | | [top](#people--body) | :biking_woman: | `:biking_woman:` | :mountain_bicyclist: | `:mountain_bicyclist:` | [top](#table-of-contents) | @@ -599,7 +600,7 @@ Then... | [top](#animals--nature) | :koala: | `:koala:` | :panda_face: | `:panda_face:` | [top](#table-of-contents) | | [top](#animals--nature) | :sloth: | `:sloth:` | :otter: | `:otter:` | [top](#table-of-contents) | | [top](#animals--nature) | :skunk: | `:skunk:` | :kangaroo: | `:kangaroo:` | [top](#table-of-contents) | -| [top](#animals--nature) | :badger: | `:badger:` | :feet: | `:feet:`
`:paw_prints:` | [top](#table-of-contents) | +| [top](#animals--nature) | :badger: | `:badger:` | :feet: | `:feet:` `:paw_prints:` | [top](#table-of-contents) | ### Animal Bird @@ -637,7 +638,7 @@ Then... | | ico | shortcode | ico | shortcode | | | - | :-: | - | :-: | - | - | | [top](#animals--nature) | :whale: | `:whale:` | :whale2: | `:whale2:` | [top](#table-of-contents) | -| [top](#animals--nature) | :dolphin: | `:dolphin:`
`:flipper:` | :seal: | `:seal:` | [top](#table-of-contents) | +| [top](#animals--nature) | :dolphin: | `:dolphin:` `:flipper:` | :seal: | `:seal:` | [top](#table-of-contents) | | [top](#animals--nature) | :fish: | `:fish:` | :tropical_fish: | `:tropical_fish:` | [top](#table-of-contents) | | [top](#animals--nature) | :blowfish: | `:blowfish:` | :shark: | `:shark:` | [top](#table-of-contents) | | [top](#animals--nature) | :octopus: | `:octopus:` | :shell: | `:shell:` | [top](#table-of-contents) | @@ -649,7 +650,7 @@ Then... | - | :-: | - | :-: | - | - | | [top](#animals--nature) | :snail: | `:snail:` | :butterfly: | `:butterfly:` | [top](#table-of-contents) | | [top](#animals--nature) | :bug: | `:bug:` | :ant: | `:ant:` | [top](#table-of-contents) | -| [top](#animals--nature) | :bee: | `:bee:`
`:honeybee:` | :beetle: | `:beetle:` | [top](#table-of-contents) | +| [top](#animals--nature) | :bee: | `:bee:` `:honeybee:` | :beetle: | `:beetle:` | [top](#table-of-contents) | | [top](#animals--nature) | :lady_beetle: | `:lady_beetle:` | :cricket: | `:cricket:` | [top](#table-of-contents) | | [top](#animals--nature) | :cockroach: | `:cockroach:` | :spider: | `:spider:` | [top](#table-of-contents) | | [top](#animals--nature) | :spider_web: | `:spider_web:` | :scorpion: | `:scorpion:` | [top](#table-of-contents) | @@ -696,7 +697,7 @@ Then... | | ico | shortcode | ico | shortcode | | | - | :-: | - | :-: | - | - | | [top](#food--drink) | :grapes: | `:grapes:` | :melon: | `:melon:` | [top](#table-of-contents) | -| [top](#food--drink) | :watermelon: | `:watermelon:` | :mandarin: | `:mandarin:`
`:orange:`
`:tangerine:` | [top](#table-of-contents) | +| [top](#food--drink) | :watermelon: | `:watermelon:` | :mandarin: | `:mandarin:` `:orange:` `:tangerine:` | [top](#table-of-contents) | | [top](#food--drink) | :lemon: | `:lemon:` | :banana: | `:banana:` | [top](#table-of-contents) | | [top](#food--drink) | :pineapple: | `:pineapple:` | :mango: | `:mango:` | [top](#table-of-contents) | | [top](#food--drink) | :apple: | `:apple:` | :green_apple: | `:green_apple:` | [top](#table-of-contents) | @@ -797,7 +798,7 @@ Then... | - | :-: | - | :-: | - | - | | [top](#food--drink) | :chopsticks: | `:chopsticks:` | :plate_with_cutlery: | `:plate_with_cutlery:` | [top](#table-of-contents) | | [top](#food--drink) | :fork_and_knife: | `:fork_and_knife:` | :spoon: | `:spoon:` | [top](#table-of-contents) | -| [top](#food--drink) | :hocho: | `:hocho:`
`:knife:` | :jar: | `:jar:` | [top](#table-of-contents) | +| [top](#food--drink) | :hocho: | `:hocho:` `:knife:` | :jar: | `:jar:` | [top](#table-of-contents) | | [top](#food--drink) | :amphora: | `:amphora:` | | | [top](#table-of-contents) | ## Travel & Places @@ -889,7 +890,7 @@ Then... | [top](#travel--places) | :ambulance: | `:ambulance:` | :fire_engine: | `:fire_engine:` | [top](#table-of-contents) | | [top](#travel--places) | :police_car: | `:police_car:` | :oncoming_police_car: | `:oncoming_police_car:` | [top](#table-of-contents) | | [top](#travel--places) | :taxi: | `:taxi:` | :oncoming_taxi: | `:oncoming_taxi:` | [top](#table-of-contents) | -| [top](#travel--places) | :car: | `:car:`
`:red_car:` | :oncoming_automobile: | `:oncoming_automobile:` | [top](#table-of-contents) | +| [top](#travel--places) | :car: | `:car:` `:red_car:` | :oncoming_automobile: | `:oncoming_automobile:` | [top](#table-of-contents) | | [top](#travel--places) | :blue_car: | `:blue_car:` | :pickup_truck: | `:pickup_truck:` | [top](#table-of-contents) | | [top](#travel--places) | :truck: | `:truck:` | :articulated_lorry: | `:articulated_lorry:` | [top](#table-of-contents) | | [top](#travel--places) | :tractor: | `:tractor:` | :racing_car: | `:racing_car:` | [top](#table-of-contents) | @@ -909,7 +910,7 @@ Then... | | ico | shortcode | ico | shortcode | | | - | :-: | - | :-: | - | - | | [top](#travel--places) | :anchor: | `:anchor:` | :ring_buoy: | `:ring_buoy:` | [top](#table-of-contents) | -| [top](#travel--places) | :boat: | `:boat:`
`:sailboat:` | :canoe: | `:canoe:` | [top](#table-of-contents) | +| [top](#travel--places) | :boat: | `:boat:` `:sailboat:` | :canoe: | `:canoe:` | [top](#table-of-contents) | | [top](#travel--places) | :speedboat: | `:speedboat:` | :passenger_ship: | `:passenger_ship:` | [top](#table-of-contents) | | [top](#travel--places) | :ferry: | `:ferry:` | :motor_boat: | `:motor_boat:` | [top](#table-of-contents) | | [top](#travel--places) | :ship: | `:ship:` | | | [top](#table-of-contents) | @@ -958,7 +959,7 @@ Then... | | ico | shortcode | ico | shortcode | | | - | :-: | - | :-: | - | - | | [top](#travel--places) | :new_moon: | `:new_moon:` | :waxing_crescent_moon: | `:waxing_crescent_moon:` | [top](#table-of-contents) | -| [top](#travel--places) | :first_quarter_moon: | `:first_quarter_moon:` | :moon: | `:moon:`
`:waxing_gibbous_moon:` | [top](#table-of-contents) | +| [top](#travel--places) | :first_quarter_moon: | `:first_quarter_moon:` | :moon: | `:moon:` `:waxing_gibbous_moon:` | [top](#table-of-contents) | | [top](#travel--places) | :full_moon: | `:full_moon:` | :waning_gibbous_moon: | `:waning_gibbous_moon:` | [top](#table-of-contents) | | [top](#travel--places) | :last_quarter_moon: | `:last_quarter_moon:` | :waning_crescent_moon: | `:waning_crescent_moon:` | [top](#table-of-contents) | | [top](#travel--places) | :crescent_moon: | `:crescent_moon:` | :new_moon_with_face: | `:new_moon_with_face:` | [top](#table-of-contents) | @@ -1087,7 +1088,7 @@ Then... | [top](#objects) | :eyeglasses: | `:eyeglasses:` | :dark_sunglasses: | `:dark_sunglasses:` | [top](#table-of-contents) | | [top](#objects) | :goggles: | `:goggles:` | :lab_coat: | `:lab_coat:` | [top](#table-of-contents) | | [top](#objects) | :safety_vest: | `:safety_vest:` | :necktie: | `:necktie:` | [top](#table-of-contents) | -| [top](#objects) | :shirt: | `:shirt:`
`:tshirt:` | :jeans: | `:jeans:` | [top](#table-of-contents) | +| [top](#objects) | :shirt: | `:shirt:` `:tshirt:` | :jeans: | `:jeans:` | [top](#table-of-contents) | | [top](#objects) | :scarf: | `:scarf:` | :gloves: | `:gloves:` | [top](#table-of-contents) | | [top](#objects) | :coat: | `:coat:` | :socks: | `:socks:` | [top](#table-of-contents) | | [top](#objects) | :dress: | `:dress:` | :kimono: | `:kimono:` | [top](#table-of-contents) | @@ -1097,7 +1098,7 @@ Then... | [top](#objects) | :folding_hand_fan: | `:folding_hand_fan:` | :purse: | `:purse:` | [top](#table-of-contents) | | [top](#objects) | :handbag: | `:handbag:` | :pouch: | `:pouch:` | [top](#table-of-contents) | | [top](#objects) | :shopping: | `:shopping:` | :school_satchel: | `:school_satchel:` | [top](#table-of-contents) | -| [top](#objects) | :thong_sandal: | `:thong_sandal:` | :mans_shoe: | `:mans_shoe:`
`:shoe:` | [top](#table-of-contents) | +| [top](#objects) | :thong_sandal: | `:thong_sandal:` | :mans_shoe: | `:mans_shoe:` `:shoe:` | [top](#table-of-contents) | | [top](#objects) | :athletic_shoe: | `:athletic_shoe:` | :hiking_boot: | `:hiking_boot:` | [top](#table-of-contents) | | [top](#objects) | :flat_shoe: | `:flat_shoe:` | :high_heel: | `:high_heel:` | [top](#table-of-contents) | | [top](#objects) | :sandal: | `:sandal:` | :ballet_shoes: | `:ballet_shoes:` | [top](#table-of-contents) | @@ -1145,7 +1146,7 @@ Then... | | ico | shortcode | ico | shortcode | | | - | :-: | - | :-: | - | - | | [top](#objects) | :iphone: | `:iphone:` | :calling: | `:calling:` | [top](#table-of-contents) | -| [top](#objects) | :phone: | `:phone:`
`:telephone:` | :telephone_receiver: | `:telephone_receiver:` | [top](#table-of-contents) | +| [top](#objects) | :phone: | `:phone:` `:telephone:` | :telephone_receiver: | `:telephone_receiver:` | [top](#table-of-contents) | | [top](#objects) | :pager: | `:pager:` | :fax: | `:fax:` | [top](#table-of-contents) | ### Computer @@ -1171,14 +1172,14 @@ Then... | [top](#objects) | :vhs: | `:vhs:` | :mag: | `:mag:` | [top](#table-of-contents) | | [top](#objects) | :mag_right: | `:mag_right:` | :candle: | `:candle:` | [top](#table-of-contents) | | [top](#objects) | :bulb: | `:bulb:` | :flashlight: | `:flashlight:` | [top](#table-of-contents) | -| [top](#objects) | :izakaya_lantern: | `:izakaya_lantern:`
`:lantern:` | :diya_lamp: | `:diya_lamp:` | [top](#table-of-contents) | +| [top](#objects) | :izakaya_lantern: | `:izakaya_lantern:` `:lantern:` | :diya_lamp: | `:diya_lamp:` | [top](#table-of-contents) | ### Book Paper | | ico | shortcode | ico | shortcode | | | - | :-: | - | :-: | - | - | | [top](#objects) | :notebook_with_decorative_cover: | `:notebook_with_decorative_cover:` | :closed_book: | `:closed_book:` | [top](#table-of-contents) | -| [top](#objects) | :book: | `:book:`
`:open_book:` | :green_book: | `:green_book:` | [top](#table-of-contents) | +| [top](#objects) | :book: | `:book:` `:open_book:` | :green_book: | `:green_book:` | [top](#table-of-contents) | | [top](#objects) | :blue_book: | `:blue_book:` | :orange_book: | `:orange_book:` | [top](#table-of-contents) | | [top](#objects) | :books: | `:books:` | :notebook: | `:notebook:` | [top](#table-of-contents) | | [top](#objects) | :ledger: | `:ledger:` | :page_with_curl: | `:page_with_curl:` | [top](#table-of-contents) | @@ -1201,7 +1202,7 @@ Then... | | ico | shortcode | ico | shortcode | | | - | :-: | - | :-: | - | - | -| [top](#objects) | :envelope: | `:envelope:` | :e-mail: | `:e-mail:`
`:email:` | [top](#table-of-contents) | +| [top](#objects) | :envelope: | `:envelope:` | :e-mail: | `:e-mail:` `:email:` | [top](#table-of-contents) | | [top](#objects) | :incoming_envelope: | `:incoming_envelope:` | :envelope_with_arrow: | `:envelope_with_arrow:` | [top](#table-of-contents) | | [top](#objects) | :outbox_tray: | `:outbox_tray:` | :inbox_tray: | `:inbox_tray:` | [top](#table-of-contents) | | [top](#objects) | :package: | `:package:` | :mailbox: | `:mailbox:` | [top](#table-of-contents) | @@ -1216,7 +1217,7 @@ Then... | [top](#objects) | :pencil2: | `:pencil2:` | :black_nib: | `:black_nib:` | [top](#table-of-contents) | | [top](#objects) | :fountain_pen: | `:fountain_pen:` | :pen: | `:pen:` | [top](#table-of-contents) | | [top](#objects) | :paintbrush: | `:paintbrush:` | :crayon: | `:crayon:` | [top](#table-of-contents) | -| [top](#objects) | :memo: | `:memo:`
`:pencil:` | | | [top](#table-of-contents) | +| [top](#objects) | :memo: | `:memo:` `:pencil:` | | | [top](#table-of-contents) | ### Office @@ -1427,7 +1428,7 @@ Then... | - | :-: | - | :-: | - | - | | [top](#symbols) | :bangbang: | `:bangbang:` | :interrobang: | `:interrobang:` | [top](#table-of-contents) | | [top](#symbols) | :question: | `:question:` | :grey_question: | `:grey_question:` | [top](#table-of-contents) | -| [top](#symbols) | :grey_exclamation: | `:grey_exclamation:` | :exclamation: | `:exclamation:`
`:heavy_exclamation_mark:` | [top](#table-of-contents) | +| [top](#symbols) | :grey_exclamation: | `:grey_exclamation:` | :exclamation: | `:exclamation:` `:heavy_exclamation_mark:` | [top](#table-of-contents) | | [top](#symbols) | :wavy_dash: | `:wavy_dash:` | | | [top](#table-of-contents) | ### Currency @@ -1566,11 +1567,11 @@ Then... | [top](#flags) | :ecuador: | `:ecuador:` | :estonia: | `:estonia:` | [top](#table-of-contents) | | [top](#flags) | :egypt: | `:egypt:` | :western_sahara: | `:western_sahara:` | [top](#table-of-contents) | | [top](#flags) | :eritrea: | `:eritrea:` | :es: | `:es:` | [top](#table-of-contents) | -| [top](#flags) | :ethiopia: | `:ethiopia:` | :eu: | `:eu:`
`:european_union:` | [top](#table-of-contents) | +| [top](#flags) | :ethiopia: | `:ethiopia:` | :eu: | `:eu:` `:european_union:` | [top](#table-of-contents) | | [top](#flags) | :finland: | `:finland:` | :fiji: | `:fiji:` | [top](#table-of-contents) | | [top](#flags) | :falkland_islands: | `:falkland_islands:` | :micronesia: | `:micronesia:` | [top](#table-of-contents) | | [top](#flags) | :faroe_islands: | `:faroe_islands:` | :fr: | `:fr:` | [top](#table-of-contents) | -| [top](#flags) | :gabon: | `:gabon:` | :gb: | `:gb:`
`:uk:` | [top](#table-of-contents) | +| [top](#flags) | :gabon: | `:gabon:` | :gb: | `:gb:` `:uk:` | [top](#table-of-contents) | | [top](#flags) | :grenada: | `:grenada:` | :georgia: | `:georgia:` | [top](#table-of-contents) | | [top](#flags) | :french_guiana: | `:french_guiana:` | :guernsey: | `:guernsey:` | [top](#table-of-contents) | | [top](#flags) | :ghana: | `:ghana:` | :gibraltar: | `:gibraltar:` | [top](#table-of-contents) | diff --git a/content/en/render-hooks/passthrough.md b/content/en/render-hooks/passthrough.md index 3b82116e6..f4b954c24 100755 --- a/content/en/render-hooks/passthrough.md +++ b/content/en/render-hooks/passthrough.md @@ -95,7 +95,7 @@ Hugo populates the `Attributes` map for _block_ passthrough elements. Markdown a ###### Type -(`bool`) The passthrough element type, either `block` or `inline`. +(`string`) The passthrough element type, either `block` or `inline`. ## Example diff --git a/content/en/render-hooks/tables.md b/content/en/render-hooks/tables.md index 41eadad7b..b8a792747 100755 --- a/content/en/render-hooks/tables.md +++ b/content/en/render-hooks/tables.md @@ -82,7 +82,11 @@ In its default configuration, Hugo renders Markdown tables according to the [Git {{- range .THead }} {{- range . }} - + {{- .Text -}} {{- end }} @@ -93,7 +97,11 @@ In its default configuration, Hugo renders Markdown tables according to the [Git {{- range .TBody }} {{- range . }} - + {{- .Text -}} {{- end }} diff --git a/content/en/templates/embedded.md b/content/en/templates/embedded.md index 888f4f342..2c386b5df 100644 --- a/content/en/templates/embedded.md +++ b/content/en/templates/embedded.md @@ -82,7 +82,7 @@ Provide your tracking ID in your configuration file: {{< code-toggle file=hugo >}} [services.googleAnalytics] -ID = "G-MEASUREMENT_ID" +id = "G-MEASUREMENT_ID" {{}} To use this value in your own template, access the configured ID with `{{ site.Config.Services.GoogleAnalytics.ID }}`. diff --git a/content/en/templates/introduction.md b/content/en/templates/introduction.md index 0a3ff2b0f..e5650149a 100644 --- a/content/en/templates/introduction.md +++ b/content/en/templates/introduction.md @@ -199,11 +199,11 @@ Remember that the piped value becomes the final argument to the function or meth You can split a template action over two or more lines. For example, these are equivalent: ```go-html-template -{{ $v := or .Site.Language.LanguageName .Site.Language.Lang }} +{{ $v := or $arg1 $arg2 }} {{ $v := or - .Site.Language.LanguageName - .Site.Language.Lang + $arg1 + $arg2 }} ``` diff --git a/content/en/troubleshooting/faq.md b/content/en/troubleshooting/faq.md index 0fd67264c..3fd48c62d 100644 --- a/content/en/troubleshooting/faq.md +++ b/content/en/troubleshooting/faq.md @@ -16,17 +16,17 @@ Hugo’s [forum] is an active community of users and developers who answer quest These are just a few of the questions most frequently asked by new users. -###### An error message indicates that a feature is not available. Why? +###### An error message indicates that a feature is not available. Why? {#feature-not-available} -Hugo is available in two editions: standard and extended. With the extended edition you can (a) encode to the WebP format when processing images, and (b) transpile Sass to CSS using the embedded LibSass transpiler. The extended edition is not required to use the Dart Sass transpiler. +{{% include "installation/_common/01-editions.md" %}} -When you attempt to perform either of the operations above with the standard edition, Hugo throws this error: +When you attempt to use a feature that is not available in the edition that you installed, Hugo throws this error: ```go-html-template -Error: this feature is not available in your current Hugo version +this feature is not available in this edition of Hugo ``` -To resolve, uninstall the standard edition, then install the extended edition. See the [installation] section for details. +To resolve, install a different edition based on the feature table above. See the [installation] section for details. ###### Why do I see "Page Not Found" when visiting the home page? @@ -61,7 +61,7 @@ A directory with an index.md file is a [leaf bundle]. A directory with an _index [branch bundle]: /getting-started/glossary/#branch-bundle [leaf bundle]: /getting-started/glossary/#leaf-bundle -###### Why is my partial template not rendered as expected? {#foo} +###### Why is my partial template not rendered as expected? You may have neglected to pass the required [context] when calling the partial. For example: @@ -126,7 +126,7 @@ You can trigger content rendering with other methods as well. See next FAQ. ###### Which page methods trigger content rendering? -The following methods on a `Page` object trigger content rendering: `Content`, `FuzzyWordCount`, `Len`, `Plain`, `PlainWords`, `ReadingTime`, `Summary`, `Truncated`, and `WordCount`. +The following methods on a `Page` object trigger content rendering: `Content`, `ContentWithoutSummary`, `FuzzyWordCount`, `Len`, `Plain`, `PlainWords`, `ReadingTime`, `Summary`, `Truncated`, and `WordCount`. {{% note %}} For other questions please visit the [forum]. A quick search of over 20,000 topics will often answer your question. Please be sure to read about [requesting help] before asking your first question. diff --git a/data/embedded_template_urls.toml b/data/embedded_template_urls.toml index 7bb2e4eee..38b437fe1 100644 --- a/data/embedded_template_urls.toml +++ b/data/embedded_template_urls.toml @@ -24,6 +24,7 @@ 'render-codeblock-goat' = '_default/_markup/render-codeblock-goat.html' # Shortcodes +'comment' = 'shortcodes/comment.html' 'figure' = 'shortcodes/figure.html' 'gist' = 'shortcodes/gist.html' 'highlight' = 'shortcodes/highlight.html' diff --git a/go.mod b/go.mod index 7fd269069..a9d63af19 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/gohugoio/hugoDocs go 1.16 -require github.com/gohugoio/gohugoioTheme v0.0.0-20240815082608-66ccd383a90f // indirect +require github.com/gohugoio/gohugoioTheme v0.0.0-20241105120803-6c6e5fb8f8af // indirect diff --git a/go.sum b/go.sum index 4e5e32477..5c0e10736 100644 --- a/go.sum +++ b/go.sum @@ -1,16 +1,4 @@ -github.com/gohugoio/gohugoioTheme v0.0.0-20240426212330-f38e99e0d88d h1:EaFz80Aqh3Ej20VmUSNe3K+F0NbT8UueXLP/VqkK9Dw= -github.com/gohugoio/gohugoioTheme v0.0.0-20240426212330-f38e99e0d88d/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= -github.com/gohugoio/gohugoioTheme v0.0.0-20240508091825-b23e8e2d2419 h1:cQ/44eDHK0tVImTtSx/9sWWZv+RynH/oB4R7ASbQNAE= -github.com/gohugoio/gohugoioTheme v0.0.0-20240508091825-b23e8e2d2419/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= -github.com/gohugoio/gohugoioTheme v0.0.0-20240619093131-b595d5fb8c52 h1:dPJxUU4SevIZ7OS1DIVOrJ7p8I/QM00pXGRfAtKgQmU= -github.com/gohugoio/gohugoioTheme v0.0.0-20240619093131-b595d5fb8c52/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= -github.com/gohugoio/gohugoioTheme v0.0.0-20240622143740-53a4bdb8c0fb h1:gOIE1eFXILxCio/QOm3oLYcYmsis2CD099dXbXpjprA= -github.com/gohugoio/gohugoioTheme v0.0.0-20240622143740-53a4bdb8c0fb/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= -github.com/gohugoio/gohugoioTheme v0.0.0-20240623150114-cc7096eab3fd h1:I8X7c0oBRWXy83BL2ODSk7v0xPXDnp2hcFWpCcN+Kyc= -github.com/gohugoio/gohugoioTheme v0.0.0-20240623150114-cc7096eab3fd/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= -github.com/gohugoio/gohugoioTheme v0.0.0-20240728210410-d42c342ce472 h1:AYZUibKKFRBp2VCQpDHW+JmQKvCvyhX7z7/SOLUSCcw= -github.com/gohugoio/gohugoioTheme v0.0.0-20240728210410-d42c342ce472/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= -github.com/gohugoio/gohugoioTheme v0.0.0-20240812175901-cc0ef8e4a14a h1:E3JbZo69eqFBz6B+meQlKyy/ZBZQ73ldVDw8TADiIrQ= -github.com/gohugoio/gohugoioTheme v0.0.0-20240812175901-cc0ef8e4a14a/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= -github.com/gohugoio/gohugoioTheme v0.0.0-20240815082608-66ccd383a90f h1:Eo5z3uUYfmrtIxQvHm388dFOERZwWGTjLuUO6vobzLc= -github.com/gohugoio/gohugoioTheme v0.0.0-20240815082608-66ccd383a90f/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= +github.com/gohugoio/gohugoioTheme v0.0.0-20241105040910-e9dac9458255 h1:kaSc7cVAifWPRzmECr7il0YXgXBM+H2ZrGcNnb03S8k= +github.com/gohugoio/gohugoioTheme v0.0.0-20241105040910-e9dac9458255/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= +github.com/gohugoio/gohugoioTheme v0.0.0-20241105120803-6c6e5fb8f8af h1:H8Oa4AEJs2yz8w1Gq9hEGBJNukkKo05OAaIEsHMd63k= +github.com/gohugoio/gohugoioTheme v0.0.0-20241105120803-6c6e5fb8f8af/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html deleted file mode 100644 index 34476b3d8..000000000 --- a/layouts/shortcodes/img.html +++ /dev/null @@ -1,381 +0,0 @@ -{{- /* -Renders the given image using the given filter, if any. - -@param {string} src The path to the image which must be a remote, page, or global resource. -@param {string} [filter] The filter to apply to the image (case-insensitive). -@param {string} [filterArgs] A comma-delimited list of arguments to pass to the filter. -@param {bool} [example=false] If true, renders a before/after example. -@param {int} [exampleWidth=384] Image width, in pixels, when rendering a before/after example. - -@returns {template.HTML} - -@examples - - {{< img src="zion-national-park.jpg" >}} - - {{< img src="zion-national-park.jpg" alt="Zion National Park" >}} - - {{< img - src="zion-national-park.jpg" - alt="Zion National Park" - filter="grayscale" - >}} - - {{< img - src="zion-national-park.jpg" - alt="Zion National Park" - filter="process" - filterArgs="resize 400x webp" - >}} - - {{< img - src="zion-national-park.jpg" - alt="Zion National Park" - filter="colorize" - filterArgs="180,50,20" - >}} - - {{< img - src="zion-national-park.jpg" - alt="Zion National Park" - filter="grayscale" - example=true - >}} - - {{< img - src="zion-national-park.jpg" - alt="Zion National Park" - filter="grayscale" - example=true - exampleWidth=400 - >}} - - When using the text filter, provide the arguments in this order: - - 0. The text - 1. The horizontal offset, in pixels, relative to the left of the image (default 20) - 2. The vertical offset, in pixels, relative to the top of the image (default 20) - 3. The font size in pixels (default 64) - 4. The line height (default 1.2) - 5. The font color (default #ffffff) - - {{< img - src="images/examples/zion-national-park.jpg" - alt="Zion National Park" - filter="Text" - filterArgs="Zion National Park,25,250,56" - example=true - >}} - - When using the padding filter, provide all arguments in this order: - - 0. Padding top - 1. Padding right - 2. Padding bottom - 3. Padding right - 4. Canvas color - - {{< img - src="images/examples/zion-national-park.jpg" - alt="Zion National Park" - filter="Padding" - filterArgs="20,50,20,50,#0705" - example=true - >}} - -*/}} - -{{- /* Initialize. */}} -{{- $alt := "" }} -{{- $src := "" }} -{{- $filter := "" }} -{{- $filterArgs := slice }} -{{- $example := false }} -{{- $exampleWidth := 384 }} - -{{- /* Default values to use with the text filter. */}} -{{ $textFilterOpts := dict - "xOffset" 20 - "yOffset" 20 - "fontSize" 64 - "lineHeight" 1.2 - "fontColor" "#ffffff" - "fontPath" "https://github.com/google/fonts/raw/main/ofl/lato/Lato-Regular.ttf" -}} - -{{- /* Get and validate parameters. */}} -{{- with .Get "alt" }} - {{- $alt = .}} -{{- end }} - -{{- with .Get "src" }} - {{- $src = . }} -{{- else }} - {{- errorf "The %q shortcode requires a file parameter. See %s" .Name .Position }} -{{- end }} - -{{- with .Get "filter" }} - {{- $filter = . | lower }} -{{- end }} - -{{- $validFilters := slice - "autoorient" "brightness" "colorbalance" "colorize" "contrast" "dither" - "gamma" "gaussianblur" "grayscale" "hue" "invert" "none" "opacity" "overlay" - "padding" "pixelate" "process" "saturation" "sepia" "sigmoid" "text" - "unsharpmask" -}} - -{{- with $filter }} - {{- if not (in $validFilters .) }} - {{- errorf "The filter passed to the %q shortcode is invalid. The filter must be one of %s. See %s" $.Name (delimit $validFilters ", " ", or ") $.Position }} - {{- end }} -{{- end }} - -{{- with .Get "filterArgs" }} - {{- $filterArgs = split . "," }} - {{- $filterArgs = apply $filterArgs "trim" "." " " }} -{{- end }} - -{{- if in (slice "false" false 0) (.Get "example") }} - {{- $example = false }} -{{- else if in (slice "true" true 1) (.Get "example")}} - {{- $example = true }} -{{- end }} - -{{- with .Get "exampleWidth" }} - {{- $exampleWidth = . | int }} -{{- end }} - -{{- /* Get image. */}} -{{- $ctx := dict "page" .Page "src" $src "name" .Name "position" .Position }} -{{- $i := partial "inline/get-resource.html" $ctx }} - -{{- /* Resize if rendering before/after examples. */}} -{{- if $example }} - {{- $i = $i.Resize (printf "%dx" $exampleWidth) }} -{{- end }} - -{{- /* Create filter. */}} -{{- $f := "" }} -{{- $ctx := dict "filter" $filter "args" $filterArgs "name" .Name "position" .Position }} -{{- if eq $filter "autoorient" }} - {{- $ctx = merge $ctx (dict "argsRequired" 0) }} - {{- template "validate-arg-count" $ctx }} - {{- $f = images.AutoOrient }} -{{- else if eq $filter "brightness" }} - {{- $ctx = merge $ctx (dict "argsRequired" 1) }} - {{- template "validate-arg-count" $ctx }} - {{- $filterArgs = apply $filterArgs "float" "." }} - {{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" -100 "max" 100) }} - {{- template "validate-arg-value" $ctx }} - {{- $f = images.Brightness (index $filterArgs 0) }} -{{- else if eq $filter "colorbalance" }} - {{- $ctx = merge $ctx (dict "argsRequired" 3) }} - {{- template "validate-arg-count" $ctx }} - {{- $filterArgs = apply $filterArgs "float" "." }} - {{- $ctx = merge $ctx (dict "argName" "percentage red" "argValue" (index $filterArgs 0) "min" -100 "max" 500) }} - {{- template "validate-arg-value" $ctx }} - {{- $ctx = merge $ctx (dict "argName" "percentage green" "argValue" (index $filterArgs 1) "min" -100 "max" 500) }} - {{- template "validate-arg-value" $ctx }} - {{- $ctx = merge $ctx (dict "argName" "percentage blue" "argValue" (index $filterArgs 2) "min" -100 "max" 500) }} - {{- template "validate-arg-value" $ctx }} - {{- $f = images.ColorBalance (index $filterArgs 0) (index $filterArgs 1) (index $filterArgs 2) }} -{{- else if eq $filter "colorize" }} - {{- $ctx = merge $ctx (dict "argsRequired" 3) }} - {{- template "validate-arg-count" $ctx }} - {{- $filterArgs = apply $filterArgs "float" "." }} - {{- $ctx = merge $ctx (dict "argName" "hue" "argValue" (index $filterArgs 0) "min" 0 "max" 360) }} - {{- template "validate-arg-value" $ctx }} - {{- $ctx = merge $ctx (dict "argName" "saturation" "argValue" (index $filterArgs 1) "min" 0 "max" 100) }} - {{- template "validate-arg-value" $ctx }} - {{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 2) "min" 0 "max" 100) }} - {{- template "validate-arg-value" $ctx }} - {{- $f = images.Colorize (index $filterArgs 0) (index $filterArgs 1) (index $filterArgs 2) }} -{{- else if eq $filter "contrast" }} - {{- $ctx = merge $ctx (dict "argsRequired" 1) }} - {{- template "validate-arg-count" $ctx }} - {{- $filterArgs = apply $filterArgs "float" "." }} - {{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" -100 "max" 100) }} - {{- template "validate-arg-value" $ctx }} - {{- $f = images.Contrast (index $filterArgs 0) }} -{{- else if eq $filter "dither" }} - {{- $f = images.Dither }} -{{- else if eq $filter "gamma" }} - {{- $ctx = merge $ctx (dict "argsRequired" 1) }} - {{- template "validate-arg-count" $ctx }} - {{- $filterArgs = apply $filterArgs "float" "." }} - {{- $ctx = merge $ctx (dict "argName" "gamma" "argValue" (index $filterArgs 0) "min" 0 "max" 100) }} - {{- template "validate-arg-value" $ctx }} - {{- $f = images.Gamma (index $filterArgs 0) }} -{{- else if eq $filter "gaussianblur" }} - {{- $ctx = merge $ctx (dict "argsRequired" 1) }} - {{- template "validate-arg-count" $ctx }} - {{- $filterArgs = apply $filterArgs "float" "." }} - {{- $ctx = merge $ctx (dict "argName" "sigma" "argValue" (index $filterArgs 0) "min" 0 "max" 1000) }} - {{- template "validate-arg-value" $ctx }} - {{- $f = images.GaussianBlur (index $filterArgs 0) }} -{{- else if eq $filter "grayscale" }} - {{- $ctx = merge $ctx (dict "argsRequired" 0) }} - {{- template "validate-arg-count" $ctx }} - {{- $f = images.Grayscale }} -{{- else if eq $filter "hue" }} - {{- $ctx = merge $ctx (dict "argsRequired" 1) }} - {{- template "validate-arg-count" $ctx }} - {{- $filterArgs = apply $filterArgs "float" "." }} - {{- $ctx = merge $ctx (dict "argName" "shift" "argValue" (index $filterArgs 0) "min" -180 "max" 180) }} - {{- template "validate-arg-value" $ctx }} - {{- $f = images.Hue (index $filterArgs 0) }} -{{- else if eq $filter "invert" }} - {{- $ctx = merge $ctx (dict "argsRequired" 0) }} - {{- template "validate-arg-count" $ctx }} - {{- $f = images.Invert }} -{{- else if eq $filter "opacity" }} - {{- $ctx = merge $ctx (dict "argsRequired" 1) }} - {{- template "validate-arg-count" $ctx }} - {{- $filterArgs = apply $filterArgs "float" "." }} - {{- $ctx = merge $ctx (dict "argName" "opacity" "argValue" (index $filterArgs 0) "min" 0 "max" 1) }} - {{- template "validate-arg-value" $ctx }} - {{- $f = images.Opacity (index $filterArgs 0) }} -{{- else if eq $filter "overlay" }} - {{- $ctx = merge $ctx (dict "argsRequired" 3) }} - {{- template "validate-arg-count" $ctx }} - {{- $ctx := dict "src" (index $filterArgs 0) "name" .Name "position" .Position }} - {{- $overlayImg := partial "inline/get-resource.html" $ctx }} - {{- $f = images.Overlay $overlayImg (index $filterArgs 1 | float ) (index $filterArgs 2 | float) }} -{{- else if eq $filter "padding" }} - {{- $ctx = merge $ctx (dict "argsRequired" 5) }} - {{- template "validate-arg-count" $ctx }} - {{- $f = images.Padding - (index $filterArgs 0 | int) - (index $filterArgs 1 | int) - (index $filterArgs 2 | int) - (index $filterArgs 3 | int) - (index $filterArgs 4) - }} -{{- else if eq $filter "pixelate" }} - {{- $ctx = merge $ctx (dict "argsRequired" 1) }} - {{- template "validate-arg-count" $ctx }} - {{- $filterArgs = apply $filterArgs "float" "." }} - {{- $ctx = merge $ctx (dict "argName" "size" "argValue" (index $filterArgs 0) "min" 0 "max" 1000) }} - {{- template "validate-arg-value" $ctx }} - {{- $f = images.Pixelate (index $filterArgs 0) }} -{{- else if eq $filter "process" }} - {{- $ctx = merge $ctx (dict "argsRequired" 1) }} - {{- template "validate-arg-count" $ctx }} - {{- $f = images.Process (index $filterArgs 0) }} -{{- else if eq $filter "saturation" }} - {{- $ctx = merge $ctx (dict "argsRequired" 1) }} - {{- template "validate-arg-count" $ctx }} - {{- $filterArgs = apply $filterArgs "float" "." }} - {{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" -100 "max" 500) }} - {{- template "validate-arg-value" $ctx }} - {{- $f = images.Saturation (index $filterArgs 0) }} -{{- else if eq $filter "sepia" }} - {{- $ctx = merge $ctx (dict "argsRequired" 1) }} - {{- template "validate-arg-count" $ctx }} - {{- $filterArgs = apply $filterArgs "float" "." }} - {{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" 0 "max" 100) }} - {{- template "validate-arg-value" $ctx }} - {{- $f = images.Sepia (index $filterArgs 0) }} -{{- else if eq $filter "sigmoid" }} - {{- $ctx = merge $ctx (dict "argsRequired" 2) }} - {{- template "validate-arg-count" $ctx }} - {{- $filterArgs = apply $filterArgs "float" "." }} - {{- $ctx = merge $ctx (dict "argName" "midpoint" "argValue" (index $filterArgs 0) "min" 0 "max" 1) }} - {{- template "validate-arg-value" $ctx }} - {{- $ctx = merge $ctx (dict "argName" "factor" "argValue" (index $filterArgs 1) "min" -10 "max" 10) }} - {{- template "validate-arg-value" $ctx }} - {{- $f = images.Sigmoid (index $filterArgs 0) (index $filterArgs 1) }} -{{- else if eq $filter "text" }} - {{- $ctx = merge $ctx (dict "argsRequired" 1) }} - {{- template "validate-arg-count" $ctx }} - {{- $ctx := dict "src" $textFilterOpts.fontPath "name" .Name "position" .Position }} - {{- $font := or (partial "inline/get-resource.html" $ctx) }} - {{- $fontSize := or (index $filterArgs 3 | int) $textFilterOpts.fontSize }} - {{- $lineHeight := math.Max (or (index $filterArgs 4 | float) $textFilterOpts.lineHeight) 1 }} - {{- $opts := dict - "x" (or (index $filterArgs 1 | int) $textFilterOpts.xOffset) - "y" (or (index $filterArgs 2 | int) $textFilterOpts.yOffset) - "size" $fontSize - "linespacing" (mul (sub $lineHeight 1) $fontSize) - "color" (or (index $filterArgs 5) $textFilterOpts.fontColor) - "font" $font - }} - {{- $f = images.Text (index $filterArgs 0) $opts }} -{{- else if eq $filter "unsharpmask" }} - {{- $ctx = merge $ctx (dict "argsRequired" 3) }} - {{- template "validate-arg-count" $ctx }} - {{- $filterArgs = apply $filterArgs "float" "." }} - {{- $ctx = merge $ctx (dict "argName" "sigma" "argValue" (index $filterArgs 0) "min" 0 "max" 500) }} - {{- template "validate-arg-value" $ctx }} - {{- $ctx = merge $ctx (dict "argName" "amount" "argValue" (index $filterArgs 1) "min" 0 "max" 100) }} - {{- template "validate-arg-value" $ctx }} - {{- $ctx = merge $ctx (dict "argName" "threshold" "argValue" (index $filterArgs 2) "min" 0 "max" 1) }} - {{- template "validate-arg-value" $ctx }} - {{- $f = images.UnsharpMask (index $filterArgs 0) (index $filterArgs 1) (index $filterArgs 2) }} -{{- end }} - -{{- /* Apply filter. */}} -{{- $fi := $i }} -{{- with $f }} - {{- $fi = $i.Filter . }} -{{- end }} - -{{- /* Render. */}} -{{- if $example }} -

Original

- {{ $alt }} -

Processed

- {{ $alt }} -{{- else -}} - {{ $alt }} -{{- end }} - -{{- define "validate-arg-count" }} - {{- $msg := "When using the %q filter, the %q shortcode requires an args parameter with %d %s. See %s" }} - {{- if lt (len .args) .argsRequired }} - {{- $text := "values" }} - {{- if eq 1 .argsRequired }} - {{- $text = "value" }} - {{- end }} - {{- errorf $msg .filter .name .argsRequired $text .position }} - {{- end }} -{{- end }} - -{{- define "validate-arg-value" }} - {{- $msg := "The %q argument passed to the %q shortcode is invalid. Expected a value in the range [%v,%v], but received %v. See %s" }} - {{- if or (lt .argValue .min) (gt .argValue .max) }} - {{- errorf $msg .argName .name .min .max .argValue .position }} - {{- end }} -{{- end }} - -{{- define "partials/inline/get-resource.html" }} - {{- $r := "" }} - {{- $u := urls.Parse .src }} - {{- $msg := "The %q shortcode was unable to resolve %s. See %s" }} - {{- if $u.IsAbs }} - {{- with resources.GetRemote $u.String }} - {{- with .Err }} - {{- errorf "%s" }} - {{- else }} - {{- /* This is a remote resource. */}} - {{- $r = . }} - {{- end }} - {{- else }} - {{- errorf $msg $.name $u.String $.position }} - {{- end }} - {{- else }} - {{- with .page.Resources.Get (strings.TrimPrefix "./" $u.Path) }} - {{- /* This is a page resource. */}} - {{- $r = . }} - {{- else }} - {{- with resources.Get $u.Path }} - {{- /* This is a global resource. */}} - {{- $r = . }} - {{- else }} - {{- errorf $msg $.name $u.Path $.position }} - {{- end }} - {{- end }} - {{- end }} - {{- return $r}} -{{- end -}} diff --git a/netlify.toml b/netlify.toml index 2780fe747..5079ac44d 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,7 +3,7 @@ command = "hugo --gc --minify" [build.environment] - HUGO_VERSION = "0.134.0" + HUGO_VERSION = "0.138.0" [context.production.environment] HUGO_ENV = "production" From a7df536a52912f34d7d20c970c38590bf5e0c513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 13 Nov 2024 11:07:32 +0100 Subject: [PATCH 045/470] Add site.Store and hugo.Store and Shortcode.Store Closes #13021 --- common/hugo/hugo.go | 10 +++++++++ common/maps/scratch.go | 8 ++++++- hugolib/page_test.go | 49 ++++++++++++++++++++++++++++++++++++++++++ hugolib/shortcode.go | 34 +++++++++++++++++++++-------- hugolib/site.go | 6 ++++++ resources/page/page.go | 4 +--- resources/page/site.go | 10 +++++++++ 7 files changed, 108 insertions(+), 13 deletions(-) diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go index f21103940..dd43cf7b6 100644 --- a/common/hugo/hugo.go +++ b/common/hugo/hugo.go @@ -33,6 +33,7 @@ import ( "github.com/gohugoio/hugo/common/hcontext" "github.com/gohugoio/hugo/common/hexec" "github.com/gohugoio/hugo/common/loggers" + "github.com/gohugoio/hugo/common/maps" "github.com/gohugoio/hugo/hugofs/files" "github.com/spf13/afero" @@ -55,6 +56,8 @@ var ( vendorInfo string ) +var _ maps.StoreProvider = (*HugoInfo)(nil) + // HugoInfo contains information about the current Hugo environment type HugoInfo struct { CommitHash string @@ -72,6 +75,8 @@ type HugoInfo struct { conf ConfigProvider deps []*Dependency + store *maps.Scratch + // Context gives access to some of the context scoped variables. Context Context } @@ -116,6 +121,10 @@ func (i HugoInfo) Deps() []*Dependency { return i.deps } +func (i HugoInfo) Store() *maps.Scratch { + return i.store +} + // Deprecated: Use hugo.IsMultihost instead. func (i HugoInfo) IsMultiHost() bool { Deprecate("hugo.IsMultiHost", "Use hugo.IsMultihost instead.", "v0.124.0") @@ -185,6 +194,7 @@ func NewInfo(conf ConfigProvider, deps []*Dependency) HugoInfo { Environment: conf.Environment(), conf: conf, deps: deps, + store: maps.NewScratch(), GoVersion: goVersion, } } diff --git a/common/maps/scratch.go b/common/maps/scratch.go index 638377216..cf5231783 100644 --- a/common/maps/scratch.go +++ b/common/maps/scratch.go @@ -22,7 +22,13 @@ import ( "github.com/gohugoio/hugo/common/math" ) -// Scratch is a writable context used for stateful operations in Page/Node rendering. +type StoreProvider interface { + // Store returns a Scratch that can be used to store temporary state. + // Store is not reset on server rebuilds. + Store() *Scratch +} + +// Scratch is a writable context used for stateful build operations type Scratch struct { values map[string]any mu sync.RWMutex diff --git a/hugolib/page_test.go b/hugolib/page_test.go index bdd1be6f7..39a16d948 100644 --- a/hugolib/page_test.go +++ b/hugolib/page_test.go @@ -1893,3 +1893,52 @@ func TestRenderWithoutArgument(t *testing.T) { b.Assert(err, qt.IsNotNil) } + +// Issue #13021 +func TestAllStores(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableKinds = ["taxonomy", "term", "page", "section"] +disableLiveReload = true +-- content/_index.md -- +--- +title: "Home" +--- +{{< s >}} +-- layouts/shortcodes/s.html -- +{{ if not (.Store.Get "Shortcode") }}{{ .Store.Set "Shortcode" (printf "sh-%s" $.Page.Title) }}{{ end }} +Shortcode: {{ .Store.Get "Shortcode" }}| +-- layouts/index.html -- +{{ .Content }} +{{ if not (.Store.Get "Page") }}{{ .Store.Set "Page" (printf "p-%s" $.Title) }}{{ end }} +{{ if not (hugo.Store.Get "Hugo") }}{{ hugo.Store.Set "Hugo" (printf "h-%s" $.Title) }}{{ end }} +{{ if not (site.Store.Get "Site") }}{{ site.Store.Set "Site" (printf "s-%s" $.Title) }}{{ end }} +Page: {{ .Store.Get "Page" }}| +Hugo: {{ hugo.Store.Get "Hugo" }}| +Site: {{ site.Store.Get "Site" }}| +` + + b := TestRunning(t, files) + + b.AssertFileContent("public/index.html", + ` +Shortcode: sh-Home| +Page: p-Home| +Site: s-Home| +Hugo: h-Home| +`, + ) + + b.EditFileReplaceAll("content/_index.md", "Home", "Homer").Build() + + b.AssertFileContent("public/index.html", + ` +Shortcode: sh-Homer| +Page: p-Homer| +Site: s-Home| +Hugo: h-Home| +`, + ) +} diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go index 8a478c9df..69e891adb 100644 --- a/hugolib/shortcode.go +++ b/hugolib/shortcode.go @@ -43,9 +43,10 @@ import ( ) var ( - _ urls.RefLinker = (*ShortcodeWithPage)(nil) - _ types.Unwrapper = (*ShortcodeWithPage)(nil) - _ text.Positioner = (*ShortcodeWithPage)(nil) + _ urls.RefLinker = (*ShortcodeWithPage)(nil) + _ types.Unwrapper = (*ShortcodeWithPage)(nil) + _ text.Positioner = (*ShortcodeWithPage)(nil) + _ maps.StoreProvider = (*ShortcodeWithPage)(nil) ) // ShortcodeWithPage is the "." context in a shortcode template. @@ -72,7 +73,7 @@ type ShortcodeWithPage struct { posOffset int pos text.Position - scratch *maps.Scratch + store *maps.Scratch } // InnerDeindent returns the (potentially de-indented) inner content of the shortcode. @@ -124,13 +125,19 @@ func (scp *ShortcodeWithPage) RelRef(args map[string]any) (string, error) { return scp.Page.RelRefFrom(args, scp) } +// Store returns this shortcode's Store. +func (scp *ShortcodeWithPage) Store() *maps.Scratch { + if scp.store == nil { + scp.store = maps.NewScratch() + } + return scp.store +} + // Scratch returns a scratch-pad scoped for this shortcode. This can be used // as a temporary storage for variables, counters etc. +// Deprecated: Use Store instead. Note that from the templates this should be considered a "soft deprecation". func (scp *ShortcodeWithPage) Scratch() *maps.Scratch { - if scp.scratch == nil { - scp.scratch = maps.NewScratch() - } - return scp.scratch + return scp.Store() } // Get is a convenience method to look up shortcode parameters by its key. @@ -399,7 +406,16 @@ func doRenderShortcode( hasVariants = hasVariants || more } - data := &ShortcodeWithPage{Ordinal: sc.ordinal, posOffset: sc.pos, indentation: sc.indentation, Params: sc.params, Page: newPageForShortcode(p), Parent: parent, Name: sc.name} + data := &ShortcodeWithPage{ + Ordinal: sc.ordinal, + posOffset: sc.pos, + indentation: sc.indentation, + Params: sc.params, + Page: newPageForShortcode(p), + Parent: parent, + Name: sc.name, + } + if sc.params != nil { data.IsNamedParams = reflect.TypeOf(sc.params).Kind() == reflect.Map } diff --git a/hugolib/site.go b/hugolib/site.go index c5a4956e2..c434ff2b4 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -95,6 +95,7 @@ type Site struct { language *langs.Language languagei int pageMap *pageMap + store *maps.Scratch // The owning container. h *HugoSites @@ -248,6 +249,7 @@ func NewHugoSites(cfg deps.DepsCfg) (*HugoSites, error) { language: language, languagei: i, frontmatterHandler: frontmatterHandler, + store: maps.NewScratch(), } if i == 0 { @@ -614,6 +616,10 @@ func (s *Site) AllRegularPages() page.Pages { return s.h.RegularPages() } +func (s *Site) Store() *maps.Scratch { + return s.store +} + func (s *Site) CheckReady() { if s.state != siteStateReady { panic("this method cannot be called before the site is fully initialized") diff --git a/resources/page/page.go b/resources/page/page.go index ea7f4bf1b..acd4ce313 100644 --- a/resources/page/page.go +++ b/resources/page/page.go @@ -331,9 +331,7 @@ type PageWithoutContent interface { // Deprecated: From Hugo v0.138.0 this is just an alias for Store. Scratch() *maps.Scratch - // Store returns a Scratch that can be used to store temporary state. - // In contrast to Scratch(), this Scratch is not reset on server rebuilds. - Store() *maps.Scratch + maps.StoreProvider RelatedKeywordsProvider diff --git a/resources/page/site.go b/resources/page/site.go index 9f7871a02..4a99982fd 100644 --- a/resources/page/site.go +++ b/resources/page/site.go @@ -135,6 +135,8 @@ type Site interface { // Deprecated: Use .Site.Home.OutputFormats.Get "rss" instead. RSSLink() template.URL + maps.StoreProvider + // For internal use only. // This will panic if the site is not fully initialized. // This is typically used to inform the user in the content adapter templates, @@ -327,6 +329,10 @@ func (s *siteWrapper) RSSLink() template.URL { return s.s.RSSLink() } +func (s *siteWrapper) Store() *maps.Scratch { + return s.s.Store() +} + // For internal use only. func (s *siteWrapper) ForEeachIdentityByName(name string, f func(identity.Identity) bool) { s.s.(identity.ForEeachIdentityByNameProvider).ForEeachIdentityByName(name, f) @@ -491,6 +497,10 @@ func (s testSite) RSSLink() template.URL { return "" } +func (s testSite) Store() *maps.Scratch { + return maps.NewScratch() +} + func (s testSite) CheckReady() { } From 8aba6dc661e71ffb50c3825c445d451ac5db0d7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 13 Nov 2024 14:54:15 +0100 Subject: [PATCH 046/470] parser/metadecoders: Add benchmark --- parser/metadecoders/decoder_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/parser/metadecoders/decoder_test.go b/parser/metadecoders/decoder_test.go index 734713c2e..49f7868cc 100644 --- a/parser/metadecoders/decoder_test.go +++ b/parser/metadecoders/decoder_test.go @@ -306,3 +306,26 @@ func BenchmarkStringifyMapKeysIntegers(b *testing.B) { stringifyMapKeys(maps[i]) } } + +func BenchmarkDecodeYAMLToMap(b *testing.B) { + d := Default + + data := []byte(` +a: + v1: 32 + v2: 43 + v3: "foo" +b: + - a + - b +c: "d" + +`) + + for i := 0; i < b.N; i++ { + _, err := d.UnmarshalToMap(data, YAML) + if err != nil { + b.Fatal(err) + } + } +} From cb6580d008b6aa337e8fef17dfcd25e89b5d2be0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 08:30:13 +0000 Subject: [PATCH 047/470] build(deps): bump github.com/hairyhenderson/go-codeowners Bumps [github.com/hairyhenderson/go-codeowners](https://github.com/hairyhenderson/go-codeowners) from 0.6.0 to 0.6.1. - [Release notes](https://github.com/hairyhenderson/go-codeowners/releases) - [Changelog](https://github.com/hairyhenderson/go-codeowners/blob/main/CHANGELOG.md) - [Commits](https://github.com/hairyhenderson/go-codeowners/compare/v0.6.0...v0.6.1) --- updated-dependencies: - dependency-name: github.com/hairyhenderson/go-codeowners dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 4b1d53a1b..1bba42f1b 100644 --- a/go.mod +++ b/go.mod @@ -46,7 +46,7 @@ require ( github.com/gohugoio/testmodBuilder/mods v0.0.0-20190520184928-c56af20f2e95 github.com/google/go-cmp v0.6.0 github.com/gorilla/websocket v1.5.3 - github.com/hairyhenderson/go-codeowners v0.6.0 + github.com/hairyhenderson/go-codeowners v0.6.1 github.com/jdkato/prose v1.2.1 github.com/kylelemons/godebug v1.1.0 github.com/kyokomi/emoji/v2 v2.2.13 diff --git a/go.sum b/go.sum index cc8b23683..6a52dae25 100644 --- a/go.sum +++ b/go.sum @@ -131,8 +131,6 @@ github.com/bep/goat v0.5.0 h1:S8jLXHCVy/EHIoCY+btKkmcxcXFd34a0Q63/0D4TKeA= github.com/bep/goat v0.5.0/go.mod h1:Md9x7gRxiWKs85yHlVTvHQw9rg86Bm+Y4SuYE8CTH7c= github.com/bep/godartsass v1.2.0 h1:E2VvQrxAHAFwbjyOIExAMmogTItSKodoKuijNrGm5yU= github.com/bep/godartsass v1.2.0/go.mod h1:6LvK9RftsXMxGfsA0LDV12AGc4Jylnu6NgHL+Q5/pE8= -github.com/bep/godartsass/v2 v2.1.0 h1:fq5Y1xYf4diu4tXABiekZUCA+5l/dmNjGKCeQwdy+s0= -github.com/bep/godartsass/v2 v2.1.0/go.mod h1:AcP8QgC+OwOXEq6im0WgDRYK7scDsmZCEW62o1prQLo= github.com/bep/godartsass/v2 v2.2.0 h1:3hO9Dt4BOnxkKmRxc+OpoKVFrDvBycpSCXEdElVAMVI= github.com/bep/godartsass/v2 v2.2.0/go.mod h1:AcP8QgC+OwOXEq6im0WgDRYK7scDsmZCEW62o1prQLo= github.com/bep/golibsass v1.2.0 h1:nyZUkKP/0psr8nT6GR2cnmt99xS93Ji82ZD9AgOK6VI= @@ -143,10 +141,6 @@ github.com/bep/helpers v0.5.0 h1:rneezhnG7GzLFlsEWO/EnleaBRuluBDGFimalO6Y50o= github.com/bep/helpers v0.5.0/go.mod h1:dSqCzIvHbzsk5YOesp1M7sKAq5xUcvANsRoKdawxH4Q= github.com/bep/imagemeta v0.8.1 h1:tjZLPRftjxU7PTI87o5e5WKOFQ4S9S0engiP1OTpJTI= github.com/bep/imagemeta v0.8.1/go.mod h1:5piPAq5Qomh07m/dPPCLN3mDJyFusvUG7VwdRD/vX0s= -github.com/bep/lazycache v0.4.0 h1:X8yVyWNVupPd4e1jV7efi3zb7ZV/qcjKQgIQ5aPbkYI= -github.com/bep/lazycache v0.4.0/go.mod h1:NmRm7Dexh3pmR1EignYR8PjO2cWybFQ68+QgY3VMCSc= -github.com/bep/lazycache v0.6.0 h1:0vCgFo7TBtMQpSx64jnH1sagmw0ZougIFRpsqPHTa5U= -github.com/bep/lazycache v0.6.0/go.mod h1:NmRm7Dexh3pmR1EignYR8PjO2cWybFQ68+QgY3VMCSc= github.com/bep/lazycache v0.7.0 h1:VM257SkkjcR9z55eslXTkUIX8QMNKoqQRNKV/4xIkCY= github.com/bep/lazycache v0.7.0/go.mod h1:NmRm7Dexh3pmR1EignYR8PjO2cWybFQ68+QgY3VMCSc= github.com/bep/logg v0.4.0 h1:luAo5mO4ZkhA5M1iDVDqDqnBBnlHjmtZF6VAyTp+nCQ= @@ -335,8 +329,8 @@ github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/hairyhenderson/go-codeowners v0.6.0 h1:cRCtmNf9Ni1GIeiAAlHX5IEEB2gr61813Kx5JmXxAAk= -github.com/hairyhenderson/go-codeowners v0.6.0/go.mod h1:RFWbGcjlXhRKNezt7AQHmJucY0alk4osN0+RKOsIAa8= +github.com/hairyhenderson/go-codeowners v0.6.1 h1:2OLPpLWFMxkCf9hkYzOexnCGD+kj853OqeoKq7S+9us= +github.com/hairyhenderson/go-codeowners v0.6.1/go.mod h1:RFWbGcjlXhRKNezt7AQHmJucY0alk4osN0+RKOsIAa8= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= From 46e17053c85e61709e2436316b4fc9461e1fcb79 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 08:30:03 +0000 Subject: [PATCH 048/470] build(deps): bump golang.org/x/sync from 0.8.0 to 0.9.0 Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.8.0 to 0.9.0. - [Commits](https://github.com/golang/sync/compare/v0.8.0...v0.9.0) --- updated-dependencies: - dependency-name: golang.org/x/sync dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1bba42f1b..ba3724b78 100644 --- a/go.mod +++ b/go.mod @@ -78,7 +78,7 @@ require ( golang.org/x/image v0.21.0 golang.org/x/mod v0.21.0 golang.org/x/net v0.30.0 - golang.org/x/sync v0.8.0 + golang.org/x/sync v0.9.0 golang.org/x/text v0.19.0 golang.org/x/tools v0.26.0 google.golang.org/api v0.191.0 diff --git a/go.sum b/go.sum index 6a52dae25..814fa1221 100644 --- a/go.sum +++ b/go.sum @@ -623,8 +623,8 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From ce9cf882a54e9c55dcc7970398ae79c3b251f79e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 14 Nov 2024 09:43:37 +0100 Subject: [PATCH 049/470] server: Strip ANSI escape codes from browser error log Fixes #13037 --- common/loggers/handlerterminal.go | 24 +++++++++++----- common/loggers/handlerterminal_test.go | 40 ++++++++++++++++++++++++++ common/loggers/logger.go | 4 +-- 3 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 common/loggers/handlerterminal_test.go diff --git a/common/loggers/handlerterminal.go b/common/loggers/handlerterminal.go index 53f6e41da..c5f8fcce8 100644 --- a/common/loggers/handlerterminal.go +++ b/common/loggers/handlerterminal.go @@ -18,18 +18,19 @@ package loggers import ( "fmt" "io" + "regexp" "strings" "sync" "github.com/bep/logg" ) -// newNoColoursHandler creates a new NoColoursHandler -func newNoColoursHandler(outWriter, errWriter io.Writer, noLevelPrefix bool, predicate func(*logg.Entry) bool) *noColoursHandler { +// newNoAnsiEscapeHandler creates a new noAnsiEscapeHandler +func newNoAnsiEscapeHandler(outWriter, errWriter io.Writer, noLevelPrefix bool, predicate func(*logg.Entry) bool) *noAnsiEscapeHandler { if predicate == nil { predicate = func(e *logg.Entry) bool { return true } } - return &noColoursHandler{ + return &noAnsiEscapeHandler{ noLevelPrefix: noLevelPrefix, outWriter: outWriter, errWriter: errWriter, @@ -37,7 +38,7 @@ func newNoColoursHandler(outWriter, errWriter io.Writer, noLevelPrefix bool, pre } } -type noColoursHandler struct { +type noAnsiEscapeHandler struct { mu sync.Mutex outWriter io.Writer // Defaults to os.Stdout. errWriter io.Writer // Defaults to os.Stderr. @@ -45,7 +46,7 @@ type noColoursHandler struct { noLevelPrefix bool } -func (h *noColoursHandler) HandleLog(e *logg.Entry) error { +func (h *noAnsiEscapeHandler) HandleLog(e *logg.Entry) error { if !h.predicate(e) { return nil } @@ -71,10 +72,12 @@ func (h *noColoursHandler) HandleLog(e *logg.Entry) error { prefix = prefix + ": " } + msg := stripANSI(e.Message) + if h.noLevelPrefix { - fmt.Fprintf(w, "%s%s", prefix, e.Message) + fmt.Fprintf(w, "%s%s", prefix, msg) } else { - fmt.Fprintf(w, "%s %s%s", levelString[e.Level], prefix, e.Message) + fmt.Fprintf(w, "%s %s%s", levelString[e.Level], prefix, msg) } for _, field := range e.Fields { @@ -88,3 +91,10 @@ func (h *noColoursHandler) HandleLog(e *logg.Entry) error { return nil } + +var ansiRe = regexp.MustCompile(`\x1b\[[0-9;]*m`) + +// stripANSI removes ANSI escape codes from s. +func stripANSI(s string) string { + return ansiRe.ReplaceAllString(s, "") +} diff --git a/common/loggers/handlerterminal_test.go b/common/loggers/handlerterminal_test.go new file mode 100644 index 000000000..f45ce80df --- /dev/null +++ b/common/loggers/handlerterminal_test.go @@ -0,0 +1,40 @@ +// Copyright 2024 The Hugo Authors. All rights reserved. +// Some functions in this file (see comments) is based on the Go source code, +// copyright The Go Authors and governed by a BSD-style license. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package loggers + +import ( + "bytes" + "testing" + + "github.com/bep/logg" + qt "github.com/frankban/quicktest" + "github.com/gohugoio/hugo/common/terminal" +) + +func TestNoAnsiEscapeHandler(t *testing.T) { + c := qt.New(t) + + test := func(s string) { + c.Assert(stripANSI(terminal.Notice(s)), qt.Equals, s) + } + test(`error in "file.md:1:2"`) + + var buf bytes.Buffer + h := newNoAnsiEscapeHandler(&buf, &buf, false, nil) + h.HandleLog(&logg.Entry{Message: terminal.Notice(`error in "file.md:1:2"`), Level: logg.LevelInfo}) + + c.Assert(buf.String(), qt.Equals, "INFO error in \"file.md:1:2\"\n") +} diff --git a/common/loggers/logger.go b/common/loggers/logger.go index 4e2f3ab21..75c8102c7 100644 --- a/common/loggers/logger.go +++ b/common/loggers/logger.go @@ -62,7 +62,7 @@ func New(opts Options) Logger { if terminal.PrintANSIColors(os.Stdout) { logHandler = newDefaultHandler(opts.Stdout, opts.Stderr) } else { - logHandler = newNoColoursHandler(opts.Stdout, opts.Stderr, false, nil) + logHandler = newNoAnsiEscapeHandler(opts.Stdout, opts.Stderr, false, nil) } errorsw := &strings.Builder{} @@ -95,7 +95,7 @@ func New(opts Options) Logger { } if opts.StoreErrors { - h := newNoColoursHandler(io.Discard, errorsw, true, func(e *logg.Entry) bool { + h := newNoAnsiEscapeHandler(io.Discard, errorsw, true, func(e *logg.Entry) bool { return e.Level >= logg.LevelError }) From 588c9019cfdf80cf69b287ea6cd53fd8d7c4ae02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 14 Nov 2024 10:16:52 +0100 Subject: [PATCH 050/470] deps: Upgrade github.com/yuin/goldmark v1.7.4 => v1.7.8 Closes #12958 --- go.mod | 2 +- go.sum | 2 + markup/goldmark/convert.go | 1 + markup/goldmark/internal/render/context.go | 31 ++++++ markup/goldmark/render_hooks.go | 104 ++++++++++++++++----- 5 files changed, 114 insertions(+), 26 deletions(-) diff --git a/go.mod b/go.mod index ba3724b78..5d3fd9e73 100644 --- a/go.mod +++ b/go.mod @@ -70,7 +70,7 @@ require ( github.com/tdewolff/minify/v2 v2.20.37 github.com/tdewolff/parse/v2 v2.7.15 github.com/tetratelabs/wazero v1.8.1 - github.com/yuin/goldmark v1.7.4 + github.com/yuin/goldmark v1.7.8 github.com/yuin/goldmark-emoji v1.0.4 go.uber.org/automaxprocs v1.5.3 gocloud.dev v0.39.0 diff --git a/go.sum b/go.sum index 814fa1221..84c6452cd 100644 --- a/go.sum +++ b/go.sum @@ -472,6 +472,8 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark v1.7.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg= github.com/yuin/goldmark v1.7.4/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic= +github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark-emoji v1.0.4 h1:vCwMkPZSNefSUnOW2ZKRUjBSD5Ok3W78IXhGxxAEF90= github.com/yuin/goldmark-emoji v1.0.4/go.mod h1:tTkZEbwu5wkPmgTcitqddVxY9osFZiavD+r4AzQrh1U= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= diff --git a/markup/goldmark/convert.go b/markup/goldmark/convert.go index ea3bbc4ae..823a43c9d 100644 --- a/markup/goldmark/convert.go +++ b/markup/goldmark/convert.go @@ -43,6 +43,7 @@ import ( ) const ( + // Don't change this. This pattern is lso used in the image render hooks. internalAttrPrefix = "_h__" ) diff --git a/markup/goldmark/internal/render/context.go b/markup/goldmark/internal/render/context.go index b8cf9ba54..cd64fc944 100644 --- a/markup/goldmark/internal/render/context.go +++ b/markup/goldmark/internal/render/context.go @@ -16,9 +16,13 @@ package render import ( "bytes" "math/bits" + "strings" "sync" + bp "github.com/gohugoio/hugo/bufferpool" + htext "github.com/gohugoio/hugo/common/text" + "github.com/gohugoio/hugo/tpl" "github.com/gohugoio/hugo/markup/converter" "github.com/gohugoio/hugo/markup/converter/hooks" @@ -258,3 +262,30 @@ func (c *hookBase) Position() htext.Position { func (c *hookBase) PositionerSourceTarget() []byte { return c.getSourceSample() } + +// TextPlain returns a plain text representation of the given node. +// Goldmark's Node.Text was deprecated in 1.7.8. +func TextPlain(n ast.Node, source []byte) string { + buf := bp.GetBuffer() + defer bp.PutBuffer(buf) + + for c := n.FirstChild(); c != nil; c = c.NextSibling() { + textPlainTo(c, source, buf) + } + return buf.String() +} + +func textPlainTo(c ast.Node, source []byte, buf *bytes.Buffer) { + if c == nil { + return + } + switch c := c.(type) { + case *ast.RawHTML: + s := strings.TrimSpace(tpl.StripHTML(string(c.Segments.Value(source)))) + buf.WriteString(s) + case *ast.Text: + buf.Write(c.Segment.Value(source)) + default: + textPlainTo(c.FirstChild(), source, buf) + } +} diff --git a/markup/goldmark/render_hooks.go b/markup/goldmark/render_hooks.go index bacb41a37..12cf00455 100644 --- a/markup/goldmark/render_hooks.go +++ b/markup/goldmark/render_hooks.go @@ -200,7 +200,7 @@ func (r *hookedRenderer) renderImage(w util.BufWriter, source []byte, node ast.N destination: string(n.Destination), title: string(n.Title), text: hstring.HTML(text), - plainText: string(n.Text(source)), + plainText: render.TextPlain(n, source), AttributesHolder: attributes.New(attrs, attributes.AttributesOwnerGeneral), }, ordinal: ordinal, @@ -223,7 +223,7 @@ func (r *hookedRenderer) filterInternalAttributes(attrs []ast.Attribute) []ast.A } // Fall back to the default Goldmark render funcs. Method below borrowed from: -// https://github.com/yuin/goldmark/blob/b611cd333a492416b56aa8d94b04a67bf0096ab2/renderer/html/html.go#L404 +// https://github.com/yuin/goldmark func (r *hookedRenderer) renderImageDefault(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { if !entering { return ast.WalkContinue, nil @@ -234,7 +234,7 @@ func (r *hookedRenderer) renderImageDefault(w util.BufWriter, source []byte, nod _, _ = w.Write(util.EscapeHTML(util.URLEscape(n.Destination, true))) } _, _ = w.WriteString(`" alt="`) - _, _ = w.Write(nodeToHTMLText(n, source)) + r.renderTexts(w, source, n) _ = w.WriteByte('"') if n.Title != nil { _, _ = w.WriteString(` title="`) @@ -242,8 +242,7 @@ func (r *hookedRenderer) renderImageDefault(w util.BufWriter, source []byte, nod _ = w.WriteByte('"') } if n.Attributes() != nil { - attrs := r.filterInternalAttributes(n.Attributes()) - attributes.RenderASTAttributes(w, attrs...) + html.RenderAttributes(w, n, html.ImageAttributeFilter) } if r.XHTML { _, _ = w.WriteString(" />") @@ -289,7 +288,7 @@ func (r *hookedRenderer) renderLink(w util.BufWriter, source []byte, node ast.No destination: string(n.Destination), title: string(n.Title), text: hstring.HTML(text), - plainText: string(n.Text(source)), + plainText: render.TextPlain(n, source), AttributesHolder: attributes.Empty, }, ) @@ -297,6 +296,79 @@ func (r *hookedRenderer) renderLink(w util.BufWriter, source []byte, node ast.No return ast.WalkContinue, err } +// Borrowed from Goldmark's HTML renderer. +func (r *hookedRenderer) renderTexts(w util.BufWriter, source []byte, n ast.Node) { + for c := n.FirstChild(); c != nil; c = c.NextSibling() { + if s, ok := c.(*ast.String); ok { + _, _ = r.renderString(w, source, s, true) + } else if t, ok := c.(*ast.Text); ok { + _, _ = r.renderText(w, source, t, true) + } else { + r.renderTexts(w, source, c) + } + } +} + +// Borrowed from Goldmark's HTML renderer. +func (r *hookedRenderer) renderString(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { + if !entering { + return ast.WalkContinue, nil + } + n := node.(*ast.String) + if n.IsCode() { + _, _ = w.Write(n.Value) + } else { + if n.IsRaw() { + r.Writer.RawWrite(w, n.Value) + } else { + r.Writer.Write(w, n.Value) + } + } + return ast.WalkContinue, nil +} + +// Borrowed from Goldmark's HTML renderer. +func (r *hookedRenderer) renderText(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { + if !entering { + return ast.WalkContinue, nil + } + n := node.(*ast.Text) + segment := n.Segment + if n.IsRaw() { + r.Writer.RawWrite(w, segment.Value(source)) + } else { + value := segment.Value(source) + r.Writer.Write(w, value) + if n.HardLineBreak() || (n.SoftLineBreak() && r.HardWraps) { + if r.XHTML { + _, _ = w.WriteString("
\n") + } else { + _, _ = w.WriteString("
\n") + } + } else if n.SoftLineBreak() { + // TODO(bep) we use these methods a fallback to default rendering when no image/link hooks are defined. + // I don't think the below is relevant in these situations, but if so, we need to create a PR + // upstream to export softLineBreak. + /*if r.EastAsianLineBreaks != html.EastAsianLineBreaksNone && len(value) != 0 { + sibling := node.NextSibling() + if sibling != nil && sibling.Kind() == ast.KindText { + if siblingText := sibling.(*ast.Text).Value(source); len(siblingText) != 0 { + thisLastRune := util.ToRune(value, len(value)-1) + siblingFirstRune, _ := utf8.DecodeRune(siblingText) + if r.EastAsianLineBreaks.softLineBreak(thisLastRune, siblingFirstRune) { + _ = w.WriteByte('\n') + } + } + } + } else { + _ = w.WriteByte('\n') + }*/ + _ = w.WriteByte('\n') + } + } + return ast.WalkContinue, nil +} + // Fall back to the default Goldmark render funcs. Method below borrowed from: // https://github.com/yuin/goldmark/blob/b611cd333a492416b56aa8d94b04a67bf0096ab2/renderer/html/html.go#L404 func (r *hookedRenderer) renderLinkDefault(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { @@ -443,7 +515,7 @@ func (r *hookedRenderer) renderHeading(w util.BufWriter, source []byte, node ast level: n.Level, anchor: string(anchor), text: hstring.HTML(text), - plainText: string(n.Text(source)), + plainText: render.TextPlain(n, source), AttributesHolder: attributes.New(n.Attributes(), attributes.AttributesOwnerGeneral), }, ) @@ -478,21 +550,3 @@ func (e *links) Extend(m goldmark.Markdown) { util.Prioritized(newLinkRenderer(e.cfg), 100), )) } - -// Borrowed from Goldmark. -func nodeToHTMLText(n ast.Node, source []byte) []byte { - var buf bytes.Buffer - for c := n.FirstChild(); c != nil; c = c.NextSibling() { - if s, ok := c.(*ast.String); ok && s.IsCode() { - buf.Write(s.Text(source)) - } else if !c.HasChildren() { - buf.Write(util.EscapeHTML(c.Text(source))) - if t, ok := c.(*ast.Text); ok && t.SoftLineBreak() { - buf.WriteByte('\n') - } - } else { - buf.Write(nodeToHTMLText(c, source)) - } - } - return buf.Bytes() -} From 23d21b0d16fa03c29f769bd3a13f705c69deb732 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Thu, 14 Nov 2024 13:03:30 +0100 Subject: [PATCH 051/470] Preserve input type. --- common/math/math.go | 46 +++++++++++++++++++--------------------- common/math/math_test.go | 11 +++++++--- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/common/math/math.go b/common/math/math.go index d4e2c1148..f88fbcd9c 100644 --- a/common/math/math.go +++ b/common/math/math.go @@ -26,29 +26,32 @@ func DoArithmetic(a, b any, op rune) (any, error) { var ai, bi int64 var af, bf float64 var au, bu uint64 + var isInt, isFloat, isUint bool switch av.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: ai = av.Int() switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + isInt = true bi = bv.Int() case reflect.Float32, reflect.Float64: + isFloat = true af = float64(ai) // may overflow - ai = 0 bf = bv.Float() case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: bu = bv.Uint() if ai >= 0 { + isUint = true au = uint64(ai) - ai = 0 } else { + isInt = true bi = int64(bu) // may overflow - bu = 0 } default: return nil, errors.New("can't apply the operator to the values") } case reflect.Float32, reflect.Float64: + isFloat = true af = av.Float() switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: @@ -66,17 +69,18 @@ func DoArithmetic(a, b any, op rune) (any, error) { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: bi = bv.Int() if bi >= 0 { + isUint = true bu = uint64(bi) - bi = 0 } else { + isInt = true ai = int64(au) // may overflow - au = 0 } case reflect.Float32, reflect.Float64: + isFloat = true af = float64(au) // may overflow - au = 0 bf = bv.Float() case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + isUint = true bu = bv.Uint() default: return nil, errors.New("can't apply the operator to the values") @@ -94,38 +98,32 @@ func DoArithmetic(a, b any, op rune) (any, error) { switch op { case '+': - if ai != 0 || bi != 0 { + if isInt { return ai + bi, nil - } else if af != 0 || bf != 0 { + } else if isFloat { return af + bf, nil - } else if au != 0 || bu != 0 { - return au + bu, nil } - return 0, nil + return au + bu, nil case '-': - if ai != 0 || bi != 0 { + if isInt { return ai - bi, nil - } else if af != 0 || bf != 0 { + } else if isFloat { return af - bf, nil - } else if au != 0 || bu != 0 { - return au - bu, nil } - return 0, nil + return au - bu, nil case '*': - if ai != 0 || bi != 0 { + if isInt { return ai * bi, nil - } else if af != 0 || bf != 0 { + } else if isFloat { return af * bf, nil - } else if au != 0 || bu != 0 { - return au * bu, nil } - return 0, nil + return au * bu, nil case '/': - if bi != 0 { + if isInt && bi != 0 { return ai / bi, nil - } else if bf != 0 { + } else if isFloat && bf != 0 { return af / bf, nil - } else if bu != 0 { + } else if isUint && bu != 0 { return au / bu, nil } return nil, errors.New("can't divide the value by 0") diff --git a/common/math/math_test.go b/common/math/math_test.go index 89e391ce0..d75d30a69 100644 --- a/common/math/math_test.go +++ b/common/math/math_test.go @@ -30,10 +30,12 @@ func TestDoArithmetic(t *testing.T) { expect any }{ {3, 2, '+', int64(5)}, + {0, 0, '+', int64(0)}, {3, 2, '-', int64(1)}, {3, 2, '*', int64(6)}, {3, 2, '/', int64(1)}, {3.0, 2, '+', float64(5)}, + {0.0, 0, '+', float64(0.0)}, {3.0, 2, '-', float64(1)}, {3.0, 2, '*', float64(6)}, {3.0, 2, '/', float64(1.5)}, @@ -42,18 +44,22 @@ func TestDoArithmetic(t *testing.T) { {3, 2.0, '*', float64(6)}, {3, 2.0, '/', float64(1.5)}, {3.0, 2.0, '+', float64(5)}, + {0.0, 0.0, '+', float64(0.0)}, {3.0, 2.0, '-', float64(1)}, {3.0, 2.0, '*', float64(6)}, {3.0, 2.0, '/', float64(1.5)}, {uint(3), uint(2), '+', uint64(5)}, + {uint(0), uint(0), '+', uint64(0)}, {uint(3), uint(2), '-', uint64(1)}, {uint(3), uint(2), '*', uint64(6)}, {uint(3), uint(2), '/', uint64(1)}, {uint(3), 2, '+', uint64(5)}, + {uint(0), 0, '+', uint64(0)}, {uint(3), 2, '-', uint64(1)}, {uint(3), 2, '*', uint64(6)}, {uint(3), 2, '/', uint64(1)}, {3, uint(2), '+', uint64(5)}, + {0, uint(0), '+', uint64(0)}, {3, uint(2), '-', uint64(1)}, {3, uint(2), '*', uint64(6)}, {3, uint(2), '/', uint64(1)}, @@ -66,16 +72,15 @@ func TestDoArithmetic(t *testing.T) { {-3, uint(2), '*', int64(-6)}, {-3, uint(2), '/', int64(-1)}, {uint(3), 2.0, '+', float64(5)}, + {uint(0), 0.0, '+', float64(0)}, {uint(3), 2.0, '-', float64(1)}, {uint(3), 2.0, '*', float64(6)}, {uint(3), 2.0, '/', float64(1.5)}, {3.0, uint(2), '+', float64(5)}, + {0.0, uint(0), '+', float64(0)}, {3.0, uint(2), '-', float64(1)}, {3.0, uint(2), '*', float64(6)}, {3.0, uint(2), '/', float64(1.5)}, - {0, 0, '+', 0}, - {0, 0, '-', 0}, - {0, 0, '*', 0}, {"foo", "bar", '+', "foobar"}, {3, 0, '/', false}, {3.0, 0, '/', false}, From ac6962d28432f7ec14e8bf541be4a96f66098559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 14 Nov 2024 15:18:27 +0100 Subject: [PATCH 052/470] commands: Add -O flag to server to open browser Fixes #13040 --- commands/server.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/commands/server.go b/commands/server.go index 6b801b158..c2fee68b2 100644 --- a/commands/server.go +++ b/commands/server.go @@ -40,6 +40,7 @@ import ( "time" "github.com/bep/mclib" + "github.com/pkg/browser" "github.com/bep/debounce" "github.com/bep/simplecobra" @@ -448,6 +449,7 @@ type serverCommand struct { // Flags. renderStaticToDisk bool navigateToChanged bool + openBrowser bool serverAppend bool serverInterface string tlsCertFile string @@ -539,6 +541,7 @@ of a second, you will be able to save and see your changes nearly instantly.` cmd.Flags().BoolVarP(&c.serverAppend, "appendPort", "", true, "append port to baseURL") cmd.Flags().BoolVar(&c.disableLiveReload, "disableLiveReload", false, "watch without enabling live browser reload on rebuild") cmd.Flags().BoolVarP(&c.navigateToChanged, "navigateToChanged", "N", false, "navigate to changed content file on live browser reload") + cmd.Flags().BoolVarP(&c.openBrowser, "openBrowser", "O", false, "open the site in a browser after server startup") cmd.Flags().BoolVar(&c.renderStaticToDisk, "renderStaticToDisk", false, "serve static files from disk and dynamic files from memory") cmd.Flags().BoolVar(&c.disableFastRender, "disableFastRender", false, "enables full re-renders on changes") cmd.Flags().BoolVar(&c.disableBrowserError, "disableBrowserError", false, "do not show build errors in the browser") @@ -998,6 +1001,13 @@ func (c *serverCommand) serve() error { c.r.Println("Press Ctrl+C to stop") + if c.openBrowser { + // There may be more than one baseURL in multihost mode, open the first. + if err := browser.OpenURL(baseURLs[0].String()); err != nil { + c.r.logger.Warnf("Failed to open browser: %s", err) + } + } + err = func() error { for { select { From 58a3c91a7f24365584f84b0a4eecb8c2cb7d5c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 14 Nov 2024 16:10:38 +0100 Subject: [PATCH 053/470] docs: Regenerate CLI docs --- docs/content/en/commands/hugo_server.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/content/en/commands/hugo_server.md b/docs/content/en/commands/hugo_server.md index b79b7f374..c716c304f 100644 --- a/docs/content/en/commands/hugo_server.md +++ b/docs/content/en/commands/hugo_server.md @@ -54,6 +54,7 @@ hugo server [command] [flags] --noChmod don't sync permission mode of files --noHTTPCache prevent HTTP caching --noTimes don't sync modification time of files + -O, --openBrowser open the site in a browser after server startup --panicOnWarning panic on first WARNING log --poll string set this to a poll interval, e.g --poll 700ms, to use a poll based approach to watch for file system changes -p, --port int port on which the server will listen (default 1313) From 5e3133a7d8a8cbfe7015fbd446fdeb04d1902605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 14 Nov 2024 16:45:21 +0100 Subject: [PATCH 054/470] Run go mod tidy --- go.mod | 2 +- go.sum | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5d3fd9e73..b12a889a9 100644 --- a/go.mod +++ b/go.mod @@ -60,6 +60,7 @@ require ( github.com/olekukonko/tablewriter v0.0.5 github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 github.com/pelletier/go-toml/v2 v2.2.3 + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c github.com/rogpeppe/go-internal v1.13.1 github.com/sanity-io/litter v1.5.5 github.com/spf13/afero v1.11.0 @@ -145,7 +146,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pkg/errors v0.9.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect go.opencensus.io v0.24.0 // indirect diff --git a/go.sum b/go.sum index 84c6452cd..fcd88e55a 100644 --- a/go.sum +++ b/go.sum @@ -470,8 +470,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= -github.com/yuin/goldmark v1.7.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg= -github.com/yuin/goldmark v1.7.4/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic= github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark-emoji v1.0.4 h1:vCwMkPZSNefSUnOW2ZKRUjBSD5Ok3W78IXhGxxAEF90= From 33e964d40b4bce03a55671dae2cbd4c8a82c74fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 08:05:22 +0000 Subject: [PATCH 055/470] build(deps): bump golang.org/x/image from 0.21.0 to 0.22.0 Bumps [golang.org/x/image](https://github.com/golang/image) from 0.21.0 to 0.22.0. - [Commits](https://github.com/golang/image/compare/v0.21.0...v0.22.0) --- updated-dependencies: - dependency-name: golang.org/x/image dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index b12a889a9..417ae934f 100644 --- a/go.mod +++ b/go.mod @@ -76,11 +76,11 @@ require ( go.uber.org/automaxprocs v1.5.3 gocloud.dev v0.39.0 golang.org/x/exp v0.0.0-20221031165847-c99f073a8326 - golang.org/x/image v0.21.0 + golang.org/x/image v0.22.0 golang.org/x/mod v0.21.0 golang.org/x/net v0.30.0 golang.org/x/sync v0.9.0 - golang.org/x/text v0.19.0 + golang.org/x/text v0.20.0 golang.org/x/tools v0.26.0 google.golang.org/api v0.191.0 gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index fcd88e55a..91bf20425 100644 --- a/go.sum +++ b/go.sum @@ -526,8 +526,8 @@ golang.org/x/exp v0.0.0-20221031165847-c99f073a8326/go.mod h1:CxIveKay+FTh1D0yPZ golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s= -golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78= +golang.org/x/image v0.22.0 h1:UtK5yLUzilVrkjMAZAZ34DXGpASN8i8pj8g+O+yd10g= +golang.org/x/image v0.22.0/go.mod h1:9hPFhljd4zZ1GNSIZJ49sqbp45GKK9t6w+iXvGqZUz4= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -692,8 +692,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From 7921777da16d8228f1cb3144b31606b7ccd8758c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 08:04:55 +0000 Subject: [PATCH 056/470] build(deps): bump github.com/fatih/color from 1.17.0 to 1.18.0 Bumps [github.com/fatih/color](https://github.com/fatih/color) from 1.17.0 to 1.18.0. - [Release notes](https://github.com/fatih/color/releases) - [Commits](https://github.com/fatih/color/compare/v1.17.0...v1.18.0) --- updated-dependencies: - dependency-name: github.com/fatih/color dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 417ae934f..bac210042 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/disintegration/gift v1.2.1 github.com/dustin/go-humanize v1.0.1 github.com/evanw/esbuild v0.24.0 - github.com/fatih/color v1.17.0 + github.com/fatih/color v1.18.0 github.com/fortytw2/leaktest v1.3.0 github.com/frankban/quicktest v1.14.6 github.com/fsnotify/fsnotify v1.7.0 diff --git a/go.sum b/go.sum index 91bf20425..2ed8cd7bd 100644 --- a/go.sum +++ b/go.sum @@ -191,8 +191,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanw/esbuild v0.24.0 h1:GZ78naTLp7FKr+K7eNuM/SLs5maeiHYRPsTg6kmdsSE= github.com/evanw/esbuild v0.24.0/go.mod h1:D2vIQZqV/vIf/VRHtViaUtViZmG7o+kKmlBfVQuRi48= -github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= -github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= From 7a2f04ee8c3de43f9cc8e0a71fca838125878f8c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 08:05:19 +0000 Subject: [PATCH 057/470] build(deps): bump github.com/tdewolff/minify/v2 from 2.20.37 to 2.21.1 Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.20.37 to 2.21.1. - [Release notes](https://github.com/tdewolff/minify/releases) - [Commits](https://github.com/tdewolff/minify/compare/v2.20.37...v2.21.1) --- updated-dependencies: - dependency-name: github.com/tdewolff/minify/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index bac210042..54cfa4353 100644 --- a/go.mod +++ b/go.mod @@ -68,8 +68,8 @@ require ( github.com/spf13/cobra v1.8.1 github.com/spf13/fsync v0.10.1 github.com/spf13/pflag v1.0.5 - github.com/tdewolff/minify/v2 v2.20.37 - github.com/tdewolff/parse/v2 v2.7.15 + github.com/tdewolff/minify/v2 v2.21.1 + github.com/tdewolff/parse/v2 v2.7.18 github.com/tetratelabs/wazero v1.8.1 github.com/yuin/goldmark v1.7.8 github.com/yuin/goldmark-emoji v1.0.4 diff --git a/go.sum b/go.sum index 2ed8cd7bd..c64b6fb9f 100644 --- a/go.sum +++ b/go.sum @@ -452,10 +452,10 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tdewolff/minify/v2 v2.20.37 h1:Q97cx4STXCh1dlWDlNHZniE8BJ2EBL0+2b0n92BJQhw= -github.com/tdewolff/minify/v2 v2.20.37/go.mod h1:L1VYef/jwKw6Wwyk5A+T0mBjjn3mMPgmjjA688RNsxU= -github.com/tdewolff/parse/v2 v2.7.15 h1:hysDXtdGZIRF5UZXwpfn3ZWRbm+ru4l53/ajBRGpCTw= -github.com/tdewolff/parse/v2 v2.7.15/go.mod h1:3FbJWZp3XT9OWVN3Hmfp0p/a08v4h8J9W1aghka0soA= +github.com/tdewolff/minify/v2 v2.21.1 h1:AAf5iltw6+KlUvjRNPAPrANIXl3XEJNBBzuZom5iCAM= +github.com/tdewolff/minify/v2 v2.21.1/go.mod h1:PoqFH8ugcuTUvKqVM9vOqXw4msxvuhL/DTmV5ZXhSCI= +github.com/tdewolff/parse/v2 v2.7.18 h1:uSqjEMT2lwCj5oifBHDcWU2kN1pbLrRENgFWDJa57eI= +github.com/tdewolff/parse/v2 v2.7.18/go.mod h1:3FbJWZp3XT9OWVN3Hmfp0p/a08v4h8J9W1aghka0soA= github.com/tdewolff/test v1.0.11-0.20231101010635-f1265d231d52/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739 h1:IkjBCtQOOjIn03u/dMQK9g+Iw9ewps4mCl1nB8Sscbo= github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739/go.mod h1:XPuWBzvdUzhCuxWO1ojpXsyzsA5bFoS3tO/Q3kFuTG8= From 2c54c3298684f502ab23685a0be5da41ff7deeeb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 09:03:34 +0000 Subject: [PATCH 058/470] build(deps): bump golang.org/x/tools from 0.26.0 to 0.27.0 Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.26.0 to 0.27.0. - [Release notes](https://github.com/golang/tools/releases) - [Commits](https://github.com/golang/tools/compare/v0.26.0...v0.27.0) --- updated-dependencies: - dependency-name: golang.org/x/tools dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 10 +++++----- go.sum | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 54cfa4353..eeb19b4bb 100644 --- a/go.mod +++ b/go.mod @@ -77,11 +77,11 @@ require ( gocloud.dev v0.39.0 golang.org/x/exp v0.0.0-20221031165847-c99f073a8326 golang.org/x/image v0.22.0 - golang.org/x/mod v0.21.0 - golang.org/x/net v0.30.0 + golang.org/x/mod v0.22.0 + golang.org/x/net v0.31.0 golang.org/x/sync v0.9.0 golang.org/x/text v0.20.0 - golang.org/x/tools v0.26.0 + golang.org/x/tools v0.27.0 google.golang.org/api v0.191.0 gopkg.in/yaml.v2 v2.4.0 ) @@ -154,9 +154,9 @@ require ( go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect - golang.org/x/crypto v0.28.0 // indirect + golang.org/x/crypto v0.29.0 // indirect golang.org/x/oauth2 v0.22.0 // indirect - golang.org/x/sys v0.26.0 // indirect + golang.org/x/sys v0.27.0 // indirect golang.org/x/time v0.6.0 // indirect golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect google.golang.org/genproto v0.0.0-20240812133136-8ffd90a71988 // indirect diff --git a/go.sum b/go.sum index c64b6fb9f..6102c4ea2 100644 --- a/go.sum +++ b/go.sum @@ -509,8 +509,8 @@ golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= -golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= -golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= +golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -554,8 +554,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= -golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -595,8 +595,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= -golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= +golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -672,8 +672,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -751,8 +751,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= -golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= -golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= +golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o= +golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From d4de780edc7c6bf1261a424c5d008edbbeeef512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 16 Nov 2024 09:56:25 +0100 Subject: [PATCH 059/470] Fix extra newline/paragraphs issue with .RenderShortcodes Fixes #13051 --- hugolib/rendershortcodes_test.go | 59 ++++++++++++++++++-- markup/goldmark/goldmark_integration_test.go | 2 +- markup/goldmark/hugocontext/hugocontext.go | 34 +++++++++++ 3 files changed, 88 insertions(+), 7 deletions(-) diff --git a/hugolib/rendershortcodes_test.go b/hugolib/rendershortcodes_test.go index 0eebf46eb..d8b51d3ed 100644 --- a/hugolib/rendershortcodes_test.go +++ b/hugolib/rendershortcodes_test.go @@ -434,16 +434,16 @@ code_p3 b := TestRunning(t, files, TestOptWarn()) b.AssertNoRenderShortcodesArtifacts() - b.AssertFileContentEquals("public/p1/index.html", "

Content p1 id-1000.

\ncode_p2

Foo.\n

\ncode_p3

\ncode_p1code_p1_2code_p1_3") + b.AssertFileContentEquals("public/p1/index.html", "

Content p1 id-1000.

\ncode_p2

Foo.

\ncode_p3code_p1code_p1_2code_p1_3") b.EditFileReplaceAll("content/p1.md", "id-1000.", "id-100.").Build() b.AssertNoRenderShortcodesArtifacts() - b.AssertFileContentEquals("public/p1/index.html", "

Content p1 id-100.

\ncode_p2

Foo.\n

\ncode_p3

\ncode_p1code_p1_2code_p1_3") + b.AssertFileContentEquals("public/p1/index.html", "

Content p1 id-100.

\ncode_p2

Foo.

\ncode_p3code_p1code_p1_2code_p1_3") b.EditFileReplaceAll("content/p2.md", "code_p2", "codep2").Build() b.AssertNoRenderShortcodesArtifacts() - b.AssertFileContentEquals("public/p1/index.html", "

Content p1 id-100.

\ncodep2

Foo.\n

\ncode_p3

\ncode_p1code_p1_2code_p1_3") + b.AssertFileContentEquals("public/p1/index.html", "

Content p1 id-100.

\ncodep2

Foo.

\ncode_p3code_p1code_p1_2code_p1_3") b.EditFileReplaceAll("content/p3.md", "code_p3", "code_p3_edited").Build() b.AssertNoRenderShortcodesArtifacts() - b.AssertFileContentEquals("public/p1/index.html", "

Content p1 id-100.

\ncodep2

Foo.\n

\ncode_p3_edited

\ncode_p1code_p1_2code_p1_3") + b.AssertFileContentEquals("public/p1/index.html", "

Content p1 id-100.

\ncodep2

Foo.

\ncode_p3_editedcode_p1code_p1_2code_p1_3") } // Issue 13004. @@ -475,8 +475,55 @@ This is some **markup**. ` b := TestRunning(t, files) b.AssertNoRenderShortcodesArtifacts() - b.AssertFileContentEquals("public/first/p1/index.html", "

p1-h1

\n

\n

p2-h1

\n

This is some markup.\n

\n") + b.AssertFileContentEquals("public/first/p1/index.html", "

p1-h1

\n

p2-h1

\n

This is some markup.

\n") b.EditFileReplaceAll("content/second/p2.md", "p2-h1", "p2-h1-edited").Build() b.AssertNoRenderShortcodesArtifacts() - b.AssertFileContentEquals("public/first/p1/index.html", "

p1-h1

\n

\n

p2-h1-edited

\n

This is some markup.\n

\n") + b.AssertFileContentEquals("public/first/p1/index.html", "

p1-h1

\n

p2-h1-edited

\n

This is some markup.

\n") +} + +// Issue 13051. +func TestRenderShortcodesEmptyParagraph(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableKinds = ['section','rss','sitemap','taxonomy','term'] +-- layouts/_default/home.html -- +{{ .Content }} +-- layouts/_default/single.html -- +{{ .Content }} +-- layouts/shortcodes/include.html -- + {{ with site.GetPage (.Get 0) }} + {{ .RenderShortcodes }} +{{ end }} +-- content/_index.md -- +--- +title: home +--- + +a + +{{% include "/snippet" %}} + +b + +-- content/snippet.md -- +--- +title: snippet +build: + render: never + list: never +--- + +_emphasized_ + +not emphasized + +` + + b := Test(t, files) + b.AssertNoRenderShortcodesArtifacts() + b.AssertFileContentEquals("public/index.html", + "

a

\n

emphasized

\n

not emphasized

\n

b

\n", + ) } diff --git a/markup/goldmark/goldmark_integration_test.go b/markup/goldmark/goldmark_integration_test.go index 794f34150..591226dc2 100644 --- a/markup/goldmark/goldmark_integration_test.go +++ b/markup/goldmark/goldmark_integration_test.go @@ -575,7 +575,7 @@ sc3_begin|{{ .Inner }}|sc3_end // Issue #7332 ":x:\n", // Issue #11587 - "

✔️\n

", + "

✔️

", // Should not be converted to emoji "sc1_begin|:smiley:|sc1_end", // Should be converted to emoji diff --git a/markup/goldmark/hugocontext/hugocontext.go b/markup/goldmark/hugocontext/hugocontext.go index b1f149d0b..601014b37 100644 --- a/markup/goldmark/hugocontext/hugocontext.go +++ b/markup/goldmark/hugocontext/hugocontext.go @@ -242,6 +242,39 @@ func (r *hugoContextRenderer) handleHugoContext(w util.BufWriter, source []byte, return ast.WalkContinue, nil } +type hugoContextTransformer struct{} + +var _ parser.ASTTransformer = (*hugoContextTransformer)(nil) + +func (a *hugoContextTransformer) Transform(n *ast.Document, reader text.Reader, pc parser.Context) { + ast.Walk(n, func(n ast.Node, entering bool) (ast.WalkStatus, error) { + s := ast.WalkContinue + if !entering || n.Kind() != kindHugoContext { + return s, nil + } + + if p, ok := n.Parent().(*ast.Paragraph); ok { + if p.ChildCount() == 1 { + // Avoid empty paragraphs. + p.Parent().ReplaceChild(p.Parent(), p, n) + } else { + if t, ok := n.PreviousSibling().(*ast.Text); ok { + // Remove the newline produced by the Hugo context markers. + if t.SoftLineBreak() { + if t.Segment.Len() == 0 { + p.RemoveChild(p, t) + } else { + t.SetSoftLineBreak(false) + } + } + } + } + } + + return s, nil + }) +} + type hugoContextExtension struct { logger loggers.Logger } @@ -251,6 +284,7 @@ func (a *hugoContextExtension) Extend(m goldmark.Markdown) { parser.WithInlineParsers( util.Prioritized(&hugoContextParser{}, 50), ), + parser.WithASTTransformers(util.Prioritized(&hugoContextTransformer{}, 10)), ) m.Renderer().AddOptions( From f7fc6ccd59e6ca1e784cba3d9133640b02fa6d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 16 Nov 2024 18:29:13 +0100 Subject: [PATCH 060/470] release: Add missing withdeploy archive for arm64 Linux Closes #13029 --- hugoreleaser.toml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/hugoreleaser.toml b/hugoreleaser.toml index 2cb8e3665..c5b7910bd 100644 --- a/hugoreleaser.toml +++ b/hugoreleaser.toml @@ -154,6 +154,23 @@ archive_alias_replacements = { "linux-amd64.tar.gz" = "Linux-64bit.tar.gz" } [[builds.os.archs]] goarch = "arm64" +[[builds]] + path = "container2/linux/extended-withdeploy" + + [builds.build_settings] + flags = ["-buildmode", "exe", "-tags", "extended,withdeploy"] + + [[builds.os]] + goos = "linux" + [builds.os.build_settings] + env = [ + "CGO_ENABLED=1", + "CC=aarch64-linux-gnu-gcc", + "CXX=aarch64-linux-gnu-g++", + ] + [[builds.os.archs]] + goarch = "arm64" + [[builds]] path = "container1/windows/regular" @@ -215,10 +232,13 @@ archive_alias_replacements = { "linux-amd64.tar.gz" = "Linux-64bit.tar.gz" } [archives.archive_settings] name_template = "{{ .Project }}_extended_withdeploy_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" [[archives]] - # Only extended builds in container2. - paths = ["builds/container2/**"] + paths = ["builds/container2/*/extended/**"] [archives.archive_settings] name_template = "{{ .Project }}_extended_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" +[[archives]] + paths = ["builds/container2/*/extended-withdeploy/**"] + [archives.archive_settings] + name_template = "{{ .Project }}_extended_withdeploy_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}" [[archives]] paths = ["builds/**/windows/regular/**"] [archives.archive_settings.type] From ad43d137d5382836ed7b173bd33ccac4b19a0e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 16 Nov 2024 17:58:06 +0100 Subject: [PATCH 061/470] Remove deprecations <= v0.122.0 (note) These have, once we release this, been logging ERROR for 6 minor versions. --- commands/commandeer.go | 16 --------- common/hugo/hugo_test.go | 4 +++ config/allconfig/allconfig.go | 19 ++--------- hugolib/page__common.go | 1 - hugolib/page__meta.go | 18 ---------- hugolib/page__new.go | 1 - hugolib/site.go | 26 -------------- resources/page/page.go | 11 ------ resources/page/page_nop.go | 22 ------------ resources/page/site.go | 53 ----------------------------- resources/page/testhelpers_test.go | 22 ------------ source/fileInfo.go | 7 ---- tpl/collections/collections.go | 49 -------------------------- tpl/collections/collections_test.go | 33 ------------------ tpl/collections/init.go | 5 --- tpl/lang/lang.go | 7 ---- 16 files changed, 7 insertions(+), 287 deletions(-) diff --git a/commands/commandeer.go b/commands/commandeer.go index 69077ad73..bb82ec654 100644 --- a/commands/commandeer.go +++ b/commands/commandeer.go @@ -39,7 +39,6 @@ import ( "github.com/gohugoio/hugo/common/hstrings" "github.com/gohugoio/hugo/common/htime" - "github.com/gohugoio/hugo/common/hugo" "github.com/gohugoio/hugo/common/loggers" "github.com/gohugoio/hugo/common/paths" "github.com/gohugoio/hugo/common/types" @@ -141,8 +140,6 @@ type rootCommand struct { logLevel string - verbose bool - debug bool quiet bool devMode bool // Hidden flag. @@ -482,17 +479,6 @@ func (r *rootCommand) createLogger(running bool) (loggers.Logger, error) { default: return nil, fmt.Errorf("invalid log level: %q, must be one of debug, warn, info or error", r.logLevel) } - } else { - if r.verbose { - hugo.Deprecate("--verbose", "use --logLevel info", "v0.114.0") - hugo.Deprecate("--verbose", "use --logLevel info", "v0.114.0") - level = logg.LevelInfo - } - - if r.debug { - hugo.Deprecate("--debug", "use --logLevel debug", "v0.114.0") - level = logg.LevelDebug - } } } @@ -560,8 +546,6 @@ Complete documentation is available at https://gohugo.io/.` cmd.PersistentFlags().BoolVar(&r.quiet, "quiet", false, "build in quiet mode") cmd.PersistentFlags().BoolVarP(&r.renderToMemory, "renderToMemory", "M", false, "render to memory (mostly useful when running the server)") - cmd.PersistentFlags().BoolVarP(&r.verbose, "verbose", "v", false, "verbose output") - cmd.PersistentFlags().BoolVarP(&r.debug, "debug", "", false, "debug output") cmd.PersistentFlags().BoolVarP(&r.devMode, "devMode", "", false, "only used for internal testing, flag hidden.") cmd.PersistentFlags().StringVar(&r.logLevel, "logLevel", "", "log level (debug|info|warn|error)") _ = cmd.RegisterFlagCompletionFunc("logLevel", cobra.FixedCompletions([]string{"debug", "info", "warn", "error"}, cobra.ShellCompDirectiveNoFileComp)) diff --git a/common/hugo/hugo_test.go b/common/hugo/hugo_test.go index 241d8c0ae..feb52075d 100644 --- a/common/hugo/hugo_test.go +++ b/common/hugo/hugo_test.go @@ -63,6 +63,10 @@ func TestDeprecationLogLevelFromVersion(t *testing.T) { c.Assert(deprecationLogLevelFromVersion(ver.String()), qt.Equals, logg.LevelWarn) ver.Minor -= 6 c.Assert(deprecationLogLevelFromVersion(ver.String()), qt.Equals, logg.LevelError) + + // Added just to find the threshold for where we can remove deprecated items. + // Subtract 5 from the minor version of the first ERRORed version => 0.122.0. + c.Assert(deprecationLogLevelFromVersion("0.127.0"), qt.Equals, logg.LevelError) } func TestMarkupScope(t *testing.T) { diff --git a/config/allconfig/allconfig.go b/config/allconfig/allconfig.go index 35517ece2..b158d8a90 100644 --- a/config/allconfig/allconfig.go +++ b/config/allconfig/allconfig.go @@ -888,30 +888,17 @@ func fromLoadConfigResult(fs afero.Fs, logger loggers.Logger, res config.LoadCon var differentRootKeys []string switch x := v.(type) { case maps.Params: - var params maps.Params - pv, found := x["params"] - if found { - params = pv.(maps.Params) - } else { - params = maps.Params{ + _, found := x["params"] + if !found { + x["params"] = maps.Params{ maps.MergeStrategyKey: maps.ParamsMergeStrategyDeep, } - x["params"] = params } for kk, vv := range x { if kk == "_merge" { continue } - if kk != maps.MergeStrategyKey && !configLanguageKeys[kk] { - // This should have been placed below params. - // We accidentally allowed it in the past, so we need to support it a little longer, - // But log a warning. - if _, found := params[kk]; !found { - hugo.Deprecate(fmt.Sprintf("config: languages.%s.%s: custom params on the language top level", k, kk), fmt.Sprintf("Put the value below [languages.%s.params]. See https://gohugo.io/content-management/multilingual/#changes-in-hugo-01120", k), "v0.112.0") - params[kk] = vv - } - } if kk == "baseurl" { // baseURL configure don the language level is a multihost setup. isMultihost = true diff --git a/hugolib/page__common.go b/hugolib/page__common.go index 55465e214..a120849b3 100644 --- a/hugolib/page__common.go +++ b/hugolib/page__common.go @@ -57,7 +57,6 @@ type pageCommon struct { // All of these represents the common parts of a page.Page navigation.PageMenusProvider - page.AuthorProvider page.AlternativeOutputFormatsProvider page.ChildCareProvider page.FileProvider diff --git a/hugolib/page__meta.go b/hugolib/page__meta.go index 97a716b43..07d9d1c0e 100644 --- a/hugolib/page__meta.go +++ b/hugolib/page__meta.go @@ -32,7 +32,6 @@ import ( "github.com/gohugoio/hugo/common/constants" "github.com/gohugoio/hugo/common/hashing" - "github.com/gohugoio/hugo/common/hugo" "github.com/gohugoio/hugo/common/loggers" "github.com/gohugoio/hugo/common/maps" "github.com/gohugoio/hugo/common/paths" @@ -108,23 +107,6 @@ func (p *pageMeta) Aliases() []string { return p.pageConfig.Aliases } -// Deprecated: Use taxonomies instead. -func (p *pageMeta) Author() page.Author { - hugo.Deprecate(".Page.Author", "Use taxonomies instead.", "v0.98.0") - authors := p.Authors() - - for _, author := range authors { - return author - } - return page.Author{} -} - -// Deprecated: Use taxonomies instead. -func (p *pageMeta) Authors() page.AuthorList { - hugo.Deprecate(".Page.Authors", "Use taxonomies instead.", "v0.112.0") - return nil -} - func (p *pageMeta) BundleType() string { switch p.pathInfo.BundleType() { case paths.PathTypeLeaf: diff --git a/hugolib/page__new.go b/hugolib/page__new.go index 9a11fa889..91bfe5e32 100644 --- a/hugolib/page__new.go +++ b/hugolib/page__new.go @@ -183,7 +183,6 @@ func (h *HugoSites) doNewPage(m *pageMeta) (*pageState, *paths.Path, error) { dependencyManager: m.s.Conf.NewIdentityManager(m.Path()), pageCommon: &pageCommon{ FileProvider: m, - AuthorProvider: m, store: maps.NewScratch(), Positioner: page.NopPage, InSectionPositioner: page.NopPage, diff --git a/hugolib/site.go b/hugolib/site.go index c434ff2b4..f6dc89a77 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -17,7 +17,6 @@ import ( "context" "errors" "fmt" - "html/template" "io" "mime" "net/url" @@ -412,12 +411,6 @@ func newHugoSites(cfg deps.DepsCfg, d *deps.Deps, pageTrees *pageTrees, sites [] return h, nil } -// Deprecated: Use hugo.IsServer instead. -func (s *Site) IsServer() bool { - hugo.Deprecate(".Site.IsServer", "Use hugo.IsServer instead.", "v0.120.0") - return s.conf.Internal.Running -} - // Returns the server port. func (s *Site) ServerPort() int { return s.conf.C.BaseURL.Port() @@ -432,13 +425,6 @@ func (s *Site) Copyright() string { return s.conf.Copyright } -// Deprecated: Use .Site.Home.OutputFormats.Get "rss" instead. -func (s *Site) RSSLink() template.URL { - hugo.Deprecate(".Site.RSSLink", "Use the Output Format's Permalink method instead, e.g. .OutputFormats.Get \"RSS\".Permalink", "v0.114.0") - rssOutputFormat := s.home.OutputFormats().Get("rss") - return template.URL(rssOutputFormat.Permalink()) -} - func (s *Site) Config() page.SiteConfig { return page.SiteConfig{ Privacy: s.conf.Privacy, @@ -520,18 +506,6 @@ func (s *Site) Social() map[string]string { return s.conf.Social } -// Deprecated: Use .Site.Config.Services.Disqus.Shortname instead. -func (s *Site) DisqusShortname() string { - hugo.Deprecate(".Site.DisqusShortname", "Use .Site.Config.Services.Disqus.Shortname instead.", "v0.120.0") - return s.Config().Services.Disqus.Shortname -} - -// Deprecated: Use .Site.Config.Services.GoogleAnalytics.ID instead. -func (s *Site) GoogleAnalytics() string { - hugo.Deprecate(".Site.GoogleAnalytics", "Use .Site.Config.Services.GoogleAnalytics.ID instead.", "v0.120.0") - return s.Config().Services.GoogleAnalytics.ID -} - func (s *Site) Param(key any) (any, error) { return resource.Param(s, nil, key) } diff --git a/resources/page/page.go b/resources/page/page.go index acd4ce313..032ee320d 100644 --- a/resources/page/page.go +++ b/resources/page/page.go @@ -51,14 +51,6 @@ type AlternativeOutputFormatsProvider interface { AlternativeOutputFormats() OutputFormats } -// AuthorProvider provides author information. -type AuthorProvider interface { - // Deprecated: Use taxonomies instead. - Author() Author - // Deprecated: Use taxonomies instead. - Authors() AuthorList -} - // ChildCareProvider provides accessors to child resources. type ChildCareProvider interface { // Pages returns a list of pages of all kinds. @@ -309,9 +301,6 @@ type PageWithoutContent interface { Positioner navigation.PageMenusProvider - // TODO(bep) - AuthorProvider - // Page lookups/refs GetPageProvider RefProvider diff --git a/resources/page/page_nop.go b/resources/page/page_nop.go index 2b40dbb73..5a03b1994 100644 --- a/resources/page/page_nop.go +++ b/resources/page/page_nop.go @@ -77,20 +77,6 @@ func (p *nopPage) Layout() string { return "" } -func (p *nopPage) RSSLink() template.URL { - return "" -} - -// Deprecated: Use taxonomies instead. -func (p *nopPage) Author() Author { - return Author{} -} - -// Deprecated: Use taxonomies instead. -func (p *nopPage) Authors() AuthorList { - return nil -} - func (p *nopPage) AllTranslations() Pages { return nil } @@ -167,14 +153,6 @@ func (p *nopPage) ExpiryDate() (t time.Time) { return } -func (p *nopPage) Ext() string { - return "" -} - -func (p *nopPage) Extension() string { - return "" -} - func (p *nopPage) File() *source.File { return nil } diff --git a/resources/page/site.go b/resources/page/site.go index 4a99982fd..47e1454c8 100644 --- a/resources/page/site.go +++ b/resources/page/site.go @@ -14,7 +14,6 @@ package page import ( - "html/template" "time" "github.com/gohugoio/hugo/common/maps" @@ -54,9 +53,6 @@ type Site interface { // A shortcut to the home Home() Page - // Deprecated: Use hugo.IsServer instead. - IsServer() bool - // Returns the server port. ServerPort() int @@ -117,12 +113,6 @@ type Site interface { // Deprecated: Use .Site.Params instead. Social() map[string]string - // Deprecated: Use Config().Services.GoogleAnalytics instead. - GoogleAnalytics() string - - // Deprecated: Use Config().Privacy.Disqus instead. - DisqusShortname() string - // BuildDrafts is deprecated and will be removed in a future release. BuildDrafts() bool @@ -132,9 +122,6 @@ type Site interface { // LanguagePrefix returns the language prefix for this site. LanguagePrefix() string - // Deprecated: Use .Site.Home.OutputFormats.Get "rss" instead. - RSSLink() template.URL - maps.StoreProvider // For internal use only. @@ -195,11 +182,6 @@ func (s *siteWrapper) Authors() AuthorList { return s.s.Authors() } -// Deprecated: Use .Site.Config.Services.GoogleAnalytics.ID instead. -func (s *siteWrapper) GoogleAnalytics() string { - return s.s.GoogleAnalytics() -} - func (s *siteWrapper) GetPage(ref ...string) (Page, error) { return s.s.GetPage(ref...) } @@ -232,11 +214,6 @@ func (s *siteWrapper) Home() Page { return s.s.Home() } -// Deprecated: Use hugo.IsServer instead. -func (s *siteWrapper) IsServer() bool { - return s.s.IsServer() -} - func (s *siteWrapper) ServerPort() int { return s.s.ServerPort() } @@ -315,20 +292,10 @@ func (s *siteWrapper) IsMultiLingual() bool { return s.s.IsMultiLingual() } -// Deprecated: Use .Site.Config.Services.Disqus.Shortname instead. -func (s *siteWrapper) DisqusShortname() string { - return s.s.DisqusShortname() -} - func (s *siteWrapper) LanguagePrefix() string { return s.s.LanguagePrefix() } -// Deprecated: Use .Site.Home.OutputFormats.Get "rss" instead. -func (s *siteWrapper) RSSLink() template.URL { - return s.s.RSSLink() -} - func (s *siteWrapper) Store() *maps.Scratch { return s.s.Store() } @@ -416,20 +383,10 @@ func (t testSite) Languages() langs.Languages { return nil } -// Deprecated: Use .Site.Config.Services.GoogleAnalytics.ID instead. -func (t testSite) GoogleAnalytics() string { - return "" -} - func (t testSite) MainSections() []string { return nil } -// Deprecated: Use hugo.IsServer instead. -func (t testSite) IsServer() bool { - return false -} - func (t testSite) Language() *langs.Language { return t.l } @@ -474,11 +431,6 @@ func (s testSite) Config() SiteConfig { return SiteConfig{} } -// Deprecated: Use .Site.Config.Services.Disqus.Shortname instead. -func (testSite) DisqusShortname() string { - return "" -} - func (s testSite) BuildDrafts() bool { return false } @@ -492,11 +444,6 @@ func (s testSite) Param(key any) (any, error) { return nil, nil } -// Deprecated: Use .Site.Home.OutputFormats.Get "rss" instead. -func (s testSite) RSSLink() template.URL { - return "" -} - func (s testSite) Store() *maps.Scratch { return maps.NewScratch() } diff --git a/resources/page/testhelpers_test.go b/resources/page/testhelpers_test.go index 9eefeeea4..8a2d28e31 100644 --- a/resources/page/testhelpers_test.go +++ b/resources/page/testhelpers_test.go @@ -127,16 +127,6 @@ func (p *testPage) AlternativeOutputFormats() OutputFormats { panic("testpage: not implemented") } -// Deprecated: Use taxonomies instead. -func (p *testPage) Author() Author { - return Author{} -} - -// Deprecated: Use taxonomies instead. -func (p *testPage) Authors() AuthorList { - return nil -} - func (p *testPage) BaseFileName() string { panic("testpage: not implemented") } @@ -201,14 +191,6 @@ func (p *testPage) ExpiryDate() time.Time { return p.expiryDate } -func (p *testPage) Ext() string { - panic("testpage: not implemented") -} - -func (p *testPage) Extension() string { - panic("testpage: not implemented") -} - func (p *testPage) File() *source.File { return p.file } @@ -459,10 +441,6 @@ func (p *testPage) PublishDate() time.Time { return p.pubDate } -func (p *testPage) RSSLink() template.URL { - return "" -} - func (p *testPage) RawContent() string { panic("testpage: not implemented") } diff --git a/source/fileInfo.go b/source/fileInfo.go index bece86fa9..8994dec97 100644 --- a/source/fileInfo.go +++ b/source/fileInfo.go @@ -56,13 +56,6 @@ func (fi *File) Dir() string { return fi.pathToDir(fi.p().Dir()) } -// Extension is an alias to Ext(). -// Deprecated: Use Ext() instead. -func (fi *File) Extension() string { - hugo.Deprecate(".File.Extension", "Use .File.Ext instead.", "v0.96.0") - return fi.Ext() -} - // Ext returns a file's extension without the leading period (e.g. "md"). func (fi *File) Ext() string { return fi.p().Ext() } diff --git a/tpl/collections/collections.go b/tpl/collections/collections.go index edec536ef..a7e36f689 100644 --- a/tpl/collections/collections.go +++ b/tpl/collections/collections.go @@ -26,7 +26,6 @@ import ( "time" "github.com/gohugoio/hugo/common/collections" - "github.com/gohugoio/hugo/common/hugo" "github.com/gohugoio/hugo/common/maps" "github.com/gohugoio/hugo/common/types" "github.com/gohugoio/hugo/deps" @@ -189,54 +188,6 @@ func (ns *Namespace) Dictionary(values ...any) (map[string]any, error) { return root, nil } -// EchoParam returns the value in the collection c with key k if is set; otherwise, it returns an -// empty string. -// Deprecated: Use the index function instead. -func (ns *Namespace) EchoParam(c, k any) any { - hugo.Deprecate("collections.EchoParam", "Use the index function instead.", "v0.120.0") - av, isNil := indirect(reflect.ValueOf(c)) - if isNil { - return "" - } - - var avv reflect.Value - switch av.Kind() { - case reflect.Array, reflect.Slice: - index, ok := k.(int) - if ok && av.Len() > index { - avv = av.Index(index) - } - case reflect.Map: - kv := reflect.ValueOf(k) - if kv.Type().AssignableTo(av.Type().Key()) { - avv = av.MapIndex(kv) - } - } - - avv, isNil = indirect(avv) - - if isNil { - return "" - } - - if avv.IsValid() { - switch avv.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return avv.Int() - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - return avv.Uint() - case reflect.Float32, reflect.Float64: - return avv.Float() - case reflect.String: - return avv.String() - case reflect.Bool: - return avv.Bool() - } - } - - return "" -} - // First returns the first limit items in list l. func (ns *Namespace) First(limit any, l any) (any, error) { if limit == nil || l == nil { diff --git a/tpl/collections/collections_test.go b/tpl/collections/collections_test.go index c89051a3d..0f4bf82f5 100644 --- a/tpl/collections/collections_test.go +++ b/tpl/collections/collections_test.go @@ -232,39 +232,6 @@ func TestReverse(t *testing.T) { c.Assert(err, qt.Not(qt.IsNil)) } -func TestEchoParam(t *testing.T) { - t.Skip("deprecated, will be removed in Hugo 0.133.0") - t.Parallel() - c := qt.New(t) - - ns := newNs() - - for i, test := range []struct { - a any - key any - expect any - }{ - {[]int{1, 2, 3}, 1, int64(2)}, - {[]uint{1, 2, 3}, 1, uint64(2)}, - {[]float64{1.1, 2.2, 3.3}, 1, float64(2.2)}, - {[]string{"foo", "bar", "baz"}, 1, "bar"}, - {[]TstX{{A: "a", B: "b"}, {A: "c", B: "d"}, {A: "e", B: "f"}}, 1, ""}, - {map[string]int{"foo": 1, "bar": 2, "baz": 3}, "bar", int64(2)}, - {map[string]uint{"foo": 1, "bar": 2, "baz": 3}, "bar", uint64(2)}, - {map[string]float64{"foo": 1.1, "bar": 2.2, "baz": 3.3}, "bar", float64(2.2)}, - {map[string]string{"foo": "FOO", "bar": "BAR", "baz": "BAZ"}, "bar", "BAR"}, - {map[string]TstX{"foo": {A: "a", B: "b"}, "bar": {A: "c", B: "d"}, "baz": {A: "e", B: "f"}}, "bar", ""}, - {map[string]any{"foo": nil}, "foo", ""}, - {(*[]string)(nil), "bar", ""}, - } { - errMsg := qt.Commentf("[%d] %v", i, test) - - result := ns.EchoParam(test.a, test.key) - - c.Assert(result, qt.Equals, test.expect, errMsg) - } -} - func TestFirst(t *testing.T) { t.Parallel() c := qt.New(t) diff --git a/tpl/collections/init.go b/tpl/collections/init.go index 20711f9e4..f89651326 100644 --- a/tpl/collections/init.go +++ b/tpl/collections/init.go @@ -67,11 +67,6 @@ func init() { [][2]string{}, ) - ns.AddMethodMapping(ctx.EchoParam, - []string{"echoParam"}, - [][2]string{}, - ) - ns.AddMethodMapping(ctx.First, []string{"first"}, [][2]string{}, diff --git a/tpl/lang/lang.go b/tpl/lang/lang.go index b4ff98684..4cbd661af 100644 --- a/tpl/lang/lang.go +++ b/tpl/lang/lang.go @@ -26,7 +26,6 @@ import ( translators "github.com/gohugoio/localescompressed" "github.com/gohugoio/hugo/common/hreflect" - "github.com/gohugoio/hugo/common/hugo" "github.com/gohugoio/hugo/deps" "github.com/spf13/cast" ) @@ -240,12 +239,6 @@ func (ns *Namespace) FormatNumberCustom(precision, number any, options ...any) ( return string(b), nil } -// Deprecated: Use lang.FormatNumberCustom instead. -func (ns *Namespace) NumFmt(precision, number any, options ...any) (string, error) { - hugo.Deprecate("lang.NumFmt", "Use lang.FormatNumberCustom instead.", "v0.120.0") - return ns.FormatNumberCustom(precision, number, options...) -} - type pagesLanguageMerger interface { MergeByLanguageInterface(other any) (any, error) } From 66dd6ecab2b7f484a56e08c600b31027525057b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 16 Nov 2024 20:34:00 +0100 Subject: [PATCH 062/470] docs: Regen CLI docs --- docs/content/en/commands/hugo.md | 2 -- docs/content/en/commands/hugo_build.md | 2 -- docs/content/en/commands/hugo_completion.md | 2 -- docs/content/en/commands/hugo_completion_bash.md | 2 -- docs/content/en/commands/hugo_completion_fish.md | 2 -- docs/content/en/commands/hugo_completion_powershell.md | 2 -- docs/content/en/commands/hugo_completion_zsh.md | 2 -- docs/content/en/commands/hugo_config.md | 2 -- docs/content/en/commands/hugo_config_mounts.md | 2 -- docs/content/en/commands/hugo_convert.md | 2 -- docs/content/en/commands/hugo_convert_toJSON.md | 2 -- docs/content/en/commands/hugo_convert_toTOML.md | 2 -- docs/content/en/commands/hugo_convert_toYAML.md | 2 -- docs/content/en/commands/hugo_deploy.md | 2 -- docs/content/en/commands/hugo_env.md | 2 -- docs/content/en/commands/hugo_gen.md | 2 -- docs/content/en/commands/hugo_gen_chromastyles.md | 2 -- docs/content/en/commands/hugo_gen_doc.md | 2 -- docs/content/en/commands/hugo_gen_man.md | 2 -- docs/content/en/commands/hugo_import.md | 2 -- docs/content/en/commands/hugo_import_jekyll.md | 2 -- docs/content/en/commands/hugo_list.md | 2 -- docs/content/en/commands/hugo_list_all.md | 2 -- docs/content/en/commands/hugo_list_drafts.md | 2 -- docs/content/en/commands/hugo_list_expired.md | 2 -- docs/content/en/commands/hugo_list_future.md | 2 -- docs/content/en/commands/hugo_list_published.md | 2 -- docs/content/en/commands/hugo_mod.md | 2 -- docs/content/en/commands/hugo_mod_clean.md | 2 -- docs/content/en/commands/hugo_mod_get.md | 2 -- docs/content/en/commands/hugo_mod_graph.md | 2 -- docs/content/en/commands/hugo_mod_init.md | 2 -- docs/content/en/commands/hugo_mod_npm.md | 2 -- docs/content/en/commands/hugo_mod_npm_pack.md | 2 -- docs/content/en/commands/hugo_mod_tidy.md | 2 -- docs/content/en/commands/hugo_mod_vendor.md | 2 -- docs/content/en/commands/hugo_mod_verify.md | 2 -- docs/content/en/commands/hugo_new.md | 2 -- docs/content/en/commands/hugo_new_content.md | 2 -- docs/content/en/commands/hugo_new_site.md | 2 -- docs/content/en/commands/hugo_new_theme.md | 2 -- docs/content/en/commands/hugo_server.md | 2 -- docs/content/en/commands/hugo_server_trust.md | 2 -- docs/content/en/commands/hugo_version.md | 2 -- 44 files changed, 88 deletions(-) diff --git a/docs/content/en/commands/hugo.md b/docs/content/en/commands/hugo.md index c23b3e4ba..ef0bca9a5 100644 --- a/docs/content/en/commands/hugo.md +++ b/docs/content/en/commands/hugo.md @@ -33,7 +33,6 @@ hugo [flags] --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") -c, --contentDir string filesystem path to content directory - --debug debug output -d, --destination string filesystem path to write files to --disableKinds strings disable different kind of pages (home, RSS etc.) --enableGitInfo add Git revision, date, author, and CODEOWNERS info to the pages @@ -64,7 +63,6 @@ hugo [flags] -t, --theme strings themes to use (located in /themes/THEMENAME/) --themesDir string filesystem path to themes directory --trace file write trace to file (not useful in general) - -v, --verbose verbose output -w, --watch watch filesystem for changes and recreate as needed ``` diff --git a/docs/content/en/commands/hugo_build.md b/docs/content/en/commands/hugo_build.md index c0abecfa9..582cbe511 100644 --- a/docs/content/en/commands/hugo_build.md +++ b/docs/content/en/commands/hugo_build.md @@ -33,7 +33,6 @@ hugo build [flags] --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") -c, --contentDir string filesystem path to content directory - --debug debug output -d, --destination string filesystem path to write files to --disableKinds strings disable different kind of pages (home, RSS etc.) --enableGitInfo add Git revision, date, author, and CODEOWNERS info to the pages @@ -64,7 +63,6 @@ hugo build [flags] -t, --theme strings themes to use (located in /themes/THEMENAME/) --themesDir string filesystem path to themes directory --trace file write trace to file (not useful in general) - -v, --verbose verbose output -w, --watch watch filesystem for changes and recreate as needed ``` diff --git a/docs/content/en/commands/hugo_completion.md b/docs/content/en/commands/hugo_completion.md index 171018fee..96f53742a 100644 --- a/docs/content/en/commands/hugo_completion.md +++ b/docs/content/en/commands/hugo_completion.md @@ -25,7 +25,6 @@ See each sub-command's help for details on how to use the generated script. --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -34,7 +33,6 @@ See each sub-command's help for details on how to use the generated script. -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_completion_bash.md b/docs/content/en/commands/hugo_completion_bash.md index bface97c6..60973415f 100644 --- a/docs/content/en/commands/hugo_completion_bash.md +++ b/docs/content/en/commands/hugo_completion_bash.md @@ -48,7 +48,6 @@ hugo completion bash --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -57,7 +56,6 @@ hugo completion bash -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_completion_fish.md b/docs/content/en/commands/hugo_completion_fish.md index 3a9cf0df2..92bbd6c22 100644 --- a/docs/content/en/commands/hugo_completion_fish.md +++ b/docs/content/en/commands/hugo_completion_fish.md @@ -39,7 +39,6 @@ hugo completion fish [flags] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -48,7 +47,6 @@ hugo completion fish [flags] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_completion_powershell.md b/docs/content/en/commands/hugo_completion_powershell.md index 593573cee..f01442920 100644 --- a/docs/content/en/commands/hugo_completion_powershell.md +++ b/docs/content/en/commands/hugo_completion_powershell.md @@ -36,7 +36,6 @@ hugo completion powershell [flags] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -45,7 +44,6 @@ hugo completion powershell [flags] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_completion_zsh.md b/docs/content/en/commands/hugo_completion_zsh.md index c227c6125..142c53103 100644 --- a/docs/content/en/commands/hugo_completion_zsh.md +++ b/docs/content/en/commands/hugo_completion_zsh.md @@ -50,7 +50,6 @@ hugo completion zsh [flags] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -59,7 +58,6 @@ hugo completion zsh [flags] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_config.md b/docs/content/en/commands/hugo_config.md index 96f84a531..8e8d745d2 100644 --- a/docs/content/en/commands/hugo_config.md +++ b/docs/content/en/commands/hugo_config.md @@ -34,7 +34,6 @@ hugo config [command] [flags] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -43,7 +42,6 @@ hugo config [command] [flags] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_config_mounts.md b/docs/content/en/commands/hugo_config_mounts.md index 6fa30c016..5af4819a2 100644 --- a/docs/content/en/commands/hugo_config_mounts.md +++ b/docs/content/en/commands/hugo_config_mounts.md @@ -28,7 +28,6 @@ hugo config mounts [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -37,7 +36,6 @@ hugo config mounts [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_convert.md b/docs/content/en/commands/hugo_convert.md index 53d4d992c..aeaa37766 100644 --- a/docs/content/en/commands/hugo_convert.md +++ b/docs/content/en/commands/hugo_convert.md @@ -27,7 +27,6 @@ See convert's subcommands toJSON, toTOML and toYAML for more information. --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -36,7 +35,6 @@ See convert's subcommands toJSON, toTOML and toYAML for more information. -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_convert_toJSON.md b/docs/content/en/commands/hugo_convert_toJSON.md index 9546788b5..40403193c 100644 --- a/docs/content/en/commands/hugo_convert_toJSON.md +++ b/docs/content/en/commands/hugo_convert_toJSON.md @@ -28,7 +28,6 @@ hugo convert toJSON [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -39,7 +38,6 @@ hugo convert toJSON [flags] [args] -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory --unsafe enable less safe operations, please backup first - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_convert_toTOML.md b/docs/content/en/commands/hugo_convert_toTOML.md index 3bd703f60..53ab82651 100644 --- a/docs/content/en/commands/hugo_convert_toTOML.md +++ b/docs/content/en/commands/hugo_convert_toTOML.md @@ -28,7 +28,6 @@ hugo convert toTOML [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -39,7 +38,6 @@ hugo convert toTOML [flags] [args] -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory --unsafe enable less safe operations, please backup first - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_convert_toYAML.md b/docs/content/en/commands/hugo_convert_toYAML.md index 563375486..efb63a4e2 100644 --- a/docs/content/en/commands/hugo_convert_toYAML.md +++ b/docs/content/en/commands/hugo_convert_toYAML.md @@ -28,7 +28,6 @@ hugo convert toYAML [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -39,7 +38,6 @@ hugo convert toYAML [flags] [args] -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory --unsafe enable less safe operations, please backup first - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_deploy.md b/docs/content/en/commands/hugo_deploy.md index a6fc53658..fce1e5422 100644 --- a/docs/content/en/commands/hugo_deploy.md +++ b/docs/content/en/commands/hugo_deploy.md @@ -38,7 +38,6 @@ hugo deploy [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -47,7 +46,6 @@ hugo deploy [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_env.md b/docs/content/en/commands/hugo_env.md index 50a7bc92f..e216be416 100644 --- a/docs/content/en/commands/hugo_env.md +++ b/docs/content/en/commands/hugo_env.md @@ -27,7 +27,6 @@ hugo env [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -36,7 +35,6 @@ hugo env [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_gen.md b/docs/content/en/commands/hugo_gen.md index 20d829178..97cdbdb9d 100644 --- a/docs/content/en/commands/hugo_gen.md +++ b/docs/content/en/commands/hugo_gen.md @@ -23,7 +23,6 @@ Generate documentation for your project using Hugo's documentation engine, inclu --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -32,7 +31,6 @@ Generate documentation for your project using Hugo's documentation engine, inclu -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_gen_chromastyles.md b/docs/content/en/commands/hugo_gen_chromastyles.md index 1c0ac7235..49cde6bb9 100644 --- a/docs/content/en/commands/hugo_gen_chromastyles.md +++ b/docs/content/en/commands/hugo_gen_chromastyles.md @@ -33,7 +33,6 @@ hugo gen chromastyles [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -42,7 +41,6 @@ hugo gen chromastyles [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_gen_doc.md b/docs/content/en/commands/hugo_gen_doc.md index 5d2fffa4f..180dc4f95 100644 --- a/docs/content/en/commands/hugo_gen_doc.md +++ b/docs/content/en/commands/hugo_gen_doc.md @@ -33,7 +33,6 @@ hugo gen doc [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -42,7 +41,6 @@ hugo gen doc [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_gen_man.md b/docs/content/en/commands/hugo_gen_man.md index f05b06298..f33342c54 100644 --- a/docs/content/en/commands/hugo_gen_man.md +++ b/docs/content/en/commands/hugo_gen_man.md @@ -30,7 +30,6 @@ hugo gen man [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -39,7 +38,6 @@ hugo gen man [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_import.md b/docs/content/en/commands/hugo_import.md index 7de28e4cb..b20b58599 100644 --- a/docs/content/en/commands/hugo_import.md +++ b/docs/content/en/commands/hugo_import.md @@ -25,7 +25,6 @@ Import requires a subcommand, e.g. `hugo import jekyll jekyll_root_path target_p --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -34,7 +33,6 @@ Import requires a subcommand, e.g. `hugo import jekyll jekyll_root_path target_p -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_import_jekyll.md b/docs/content/en/commands/hugo_import_jekyll.md index 33c91d24c..14c57cc44 100644 --- a/docs/content/en/commands/hugo_import_jekyll.md +++ b/docs/content/en/commands/hugo_import_jekyll.md @@ -30,7 +30,6 @@ hugo import jekyll [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -39,7 +38,6 @@ hugo import jekyll [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_list.md b/docs/content/en/commands/hugo_list.md index 070a44d84..726fe51a9 100644 --- a/docs/content/en/commands/hugo_list.md +++ b/docs/content/en/commands/hugo_list.md @@ -25,7 +25,6 @@ List requires a subcommand, e.g. hugo list drafts --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -34,7 +33,6 @@ List requires a subcommand, e.g. hugo list drafts -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_list_all.md b/docs/content/en/commands/hugo_list_all.md index 5dd29904e..59846733d 100644 --- a/docs/content/en/commands/hugo_list_all.md +++ b/docs/content/en/commands/hugo_list_all.md @@ -27,7 +27,6 @@ hugo list all [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -36,7 +35,6 @@ hugo list all [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_list_drafts.md b/docs/content/en/commands/hugo_list_drafts.md index 4dff70886..5f3bcd617 100644 --- a/docs/content/en/commands/hugo_list_drafts.md +++ b/docs/content/en/commands/hugo_list_drafts.md @@ -27,7 +27,6 @@ hugo list drafts [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -36,7 +35,6 @@ hugo list drafts [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_list_expired.md b/docs/content/en/commands/hugo_list_expired.md index 7b874a105..c010d1159 100644 --- a/docs/content/en/commands/hugo_list_expired.md +++ b/docs/content/en/commands/hugo_list_expired.md @@ -27,7 +27,6 @@ hugo list expired [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -36,7 +35,6 @@ hugo list expired [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_list_future.md b/docs/content/en/commands/hugo_list_future.md index f558acd52..888784dcd 100644 --- a/docs/content/en/commands/hugo_list_future.md +++ b/docs/content/en/commands/hugo_list_future.md @@ -27,7 +27,6 @@ hugo list future [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -36,7 +35,6 @@ hugo list future [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_list_published.md b/docs/content/en/commands/hugo_list_published.md index 9fc75694b..b8ec0e7b2 100644 --- a/docs/content/en/commands/hugo_list_published.md +++ b/docs/content/en/commands/hugo_list_published.md @@ -27,7 +27,6 @@ hugo list published [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -36,7 +35,6 @@ hugo list published [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_mod.md b/docs/content/en/commands/hugo_mod.md index d4e305ff1..2c07b89cf 100644 --- a/docs/content/en/commands/hugo_mod.md +++ b/docs/content/en/commands/hugo_mod.md @@ -34,7 +34,6 @@ See https://gohugo.io/hugo-modules/ for more information. --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -43,7 +42,6 @@ See https://gohugo.io/hugo-modules/ for more information. -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_mod_clean.md b/docs/content/en/commands/hugo_mod_clean.md index 80a983a66..7df51059f 100644 --- a/docs/content/en/commands/hugo_mod_clean.md +++ b/docs/content/en/commands/hugo_mod_clean.md @@ -34,7 +34,6 @@ hugo mod clean [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -43,7 +42,6 @@ hugo mod clean [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_mod_get.md b/docs/content/en/commands/hugo_mod_get.md index de6b01a24..f4ca6069a 100644 --- a/docs/content/en/commands/hugo_mod_get.md +++ b/docs/content/en/commands/hugo_mod_get.md @@ -58,7 +58,6 @@ hugo mod get [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -67,7 +66,6 @@ hugo mod get [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_mod_graph.md b/docs/content/en/commands/hugo_mod_graph.md index f20e26b6f..5b5a14d5d 100644 --- a/docs/content/en/commands/hugo_mod_graph.md +++ b/docs/content/en/commands/hugo_mod_graph.md @@ -35,7 +35,6 @@ hugo mod graph [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -44,7 +43,6 @@ hugo mod graph [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_mod_init.md b/docs/content/en/commands/hugo_mod_init.md index 1d7bc4ac0..bf9651b59 100644 --- a/docs/content/en/commands/hugo_mod_init.md +++ b/docs/content/en/commands/hugo_mod_init.md @@ -39,7 +39,6 @@ hugo mod init [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -48,7 +47,6 @@ hugo mod init [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_mod_npm.md b/docs/content/en/commands/hugo_mod_npm.md index eeb684e51..a013fb91f 100644 --- a/docs/content/en/commands/hugo_mod_npm.md +++ b/docs/content/en/commands/hugo_mod_npm.md @@ -27,7 +27,6 @@ hugo mod npm [command] [flags] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -36,7 +35,6 @@ hugo mod npm [command] [flags] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_mod_npm_pack.md b/docs/content/en/commands/hugo_mod_npm_pack.md index 47d3e28b9..8f8738280 100644 --- a/docs/content/en/commands/hugo_mod_npm_pack.md +++ b/docs/content/en/commands/hugo_mod_npm_pack.md @@ -42,7 +42,6 @@ hugo mod npm pack [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -51,7 +50,6 @@ hugo mod npm pack [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_mod_tidy.md b/docs/content/en/commands/hugo_mod_tidy.md index be0f92657..c15ddb3c8 100644 --- a/docs/content/en/commands/hugo_mod_tidy.md +++ b/docs/content/en/commands/hugo_mod_tidy.md @@ -28,7 +28,6 @@ hugo mod tidy [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -37,7 +36,6 @@ hugo mod tidy [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_mod_vendor.md b/docs/content/en/commands/hugo_mod_vendor.md index d33b2a673..ae112a36a 100644 --- a/docs/content/en/commands/hugo_mod_vendor.md +++ b/docs/content/en/commands/hugo_mod_vendor.md @@ -34,7 +34,6 @@ hugo mod vendor [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -43,7 +42,6 @@ hugo mod vendor [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_mod_verify.md b/docs/content/en/commands/hugo_mod_verify.md index c5e755e3c..63dd28ce8 100644 --- a/docs/content/en/commands/hugo_mod_verify.md +++ b/docs/content/en/commands/hugo_mod_verify.md @@ -33,7 +33,6 @@ hugo mod verify [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -42,7 +41,6 @@ hugo mod verify [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_new.md b/docs/content/en/commands/hugo_new.md index cfe6cc1cd..4d3021b44 100644 --- a/docs/content/en/commands/hugo_new.md +++ b/docs/content/en/commands/hugo_new.md @@ -30,7 +30,6 @@ Ensure you run this within the root directory of your site. --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -39,7 +38,6 @@ Ensure you run this within the root directory of your site. -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_new_content.md b/docs/content/en/commands/hugo_new_content.md index c1e3ffa30..a8d2100f9 100644 --- a/docs/content/en/commands/hugo_new_content.md +++ b/docs/content/en/commands/hugo_new_content.md @@ -42,7 +42,6 @@ hugo new content [path] [flags] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -51,7 +50,6 @@ hugo new content [path] [flags] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_new_site.md b/docs/content/en/commands/hugo_new_site.md index 9df879103..cc0e63013 100644 --- a/docs/content/en/commands/hugo_new_site.md +++ b/docs/content/en/commands/hugo_new_site.md @@ -31,7 +31,6 @@ hugo new site [path] [flags] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -40,7 +39,6 @@ hugo new site [path] [flags] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_new_theme.md b/docs/content/en/commands/hugo_new_theme.md index 6ab98f6b9..a79978c4a 100644 --- a/docs/content/en/commands/hugo_new_theme.md +++ b/docs/content/en/commands/hugo_new_theme.md @@ -30,7 +30,6 @@ hugo new theme [name] [flags] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -39,7 +38,6 @@ hugo new theme [name] [flags] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_server.md b/docs/content/en/commands/hugo_server.md index c716c304f..a1c77d36f 100644 --- a/docs/content/en/commands/hugo_server.md +++ b/docs/content/en/commands/hugo_server.md @@ -81,7 +81,6 @@ hugo server [command] [flags] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -90,7 +89,6 @@ hugo server [command] [flags] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_server_trust.md b/docs/content/en/commands/hugo_server_trust.md index fb242d88c..1a904e845 100644 --- a/docs/content/en/commands/hugo_server_trust.md +++ b/docs/content/en/commands/hugo_server_trust.md @@ -24,7 +24,6 @@ hugo server trust [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -33,7 +32,6 @@ hugo server trust [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO diff --git a/docs/content/en/commands/hugo_version.md b/docs/content/en/commands/hugo_version.md index bbc961093..b1a6b971e 100644 --- a/docs/content/en/commands/hugo_version.md +++ b/docs/content/en/commands/hugo_version.md @@ -27,7 +27,6 @@ hugo version [flags] [args] --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --config string config file (default is hugo.yaml|json|toml) --configDir string config dir (default "config") - --debug debug output -d, --destination string filesystem path to write files to -e, --environment string build environment --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern @@ -36,7 +35,6 @@ hugo version [flags] [args] -M, --renderToMemory render to memory (mostly useful when running the server) -s, --source string filesystem path to read files relative from --themesDir string filesystem path to themes directory - -v, --verbose verbose output ``` ### SEE ALSO From 6bde8abaad9827f45f5f6c5497ffbe583562ad46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sun, 17 Nov 2024 11:25:10 +0100 Subject: [PATCH 063/470] deps: Upgrade github.com/bep/imagemeta v0.8.1 => v0.8.3 --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index eeb19b4bb..886737b95 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/bep/golibsass v1.2.0 github.com/bep/gowebp v0.3.0 github.com/bep/helpers v0.5.0 - github.com/bep/imagemeta v0.8.1 + github.com/bep/imagemeta v0.8.3 github.com/bep/lazycache v0.7.0 github.com/bep/logg v0.4.0 github.com/bep/mclib v1.20400.20402 diff --git a/go.sum b/go.sum index 6102c4ea2..42f9a0119 100644 --- a/go.sum +++ b/go.sum @@ -141,6 +141,8 @@ github.com/bep/helpers v0.5.0 h1:rneezhnG7GzLFlsEWO/EnleaBRuluBDGFimalO6Y50o= github.com/bep/helpers v0.5.0/go.mod h1:dSqCzIvHbzsk5YOesp1M7sKAq5xUcvANsRoKdawxH4Q= github.com/bep/imagemeta v0.8.1 h1:tjZLPRftjxU7PTI87o5e5WKOFQ4S9S0engiP1OTpJTI= github.com/bep/imagemeta v0.8.1/go.mod h1:5piPAq5Qomh07m/dPPCLN3mDJyFusvUG7VwdRD/vX0s= +github.com/bep/imagemeta v0.8.3 h1:68XqpYXjWW9mFjdGurutDmAKBJa9y2aknEBHwY/+3zw= +github.com/bep/imagemeta v0.8.3/go.mod h1:5piPAq5Qomh07m/dPPCLN3mDJyFusvUG7VwdRD/vX0s= github.com/bep/lazycache v0.7.0 h1:VM257SkkjcR9z55eslXTkUIX8QMNKoqQRNKV/4xIkCY= github.com/bep/lazycache v0.7.0/go.mod h1:NmRm7Dexh3pmR1EignYR8PjO2cWybFQ68+QgY3VMCSc= github.com/bep/logg v0.4.0 h1:luAo5mO4ZkhA5M1iDVDqDqnBBnlHjmtZF6VAyTp+nCQ= From 838bd312b1a287bb33962ad478dbc54737654f35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 18 Nov 2024 10:11:17 +0100 Subject: [PATCH 064/470] Squashed 'docs/' changes from 159c843fd..227aab619 227aab619 Update configuration-markup.md 019ff776c Fix grammatical error c889827bf Remove old new-in 39807c5bc Remove duplicate yaml key git-subtree-dir: docs git-subtree-split: 227aab61905c0f778d173ed9e38621df4d7c429a --- content/en/content-management/archetypes.md | 8 ++++---- content/en/content-management/mathematics.md | 2 +- content/en/functions/lang/FormatNumberCustom.md | 2 +- content/en/getting-started/configuration-markup.md | 4 ++-- content/en/hugo-pipes/transpile-sass-to-css.md | 2 +- content/en/methods/duration/Truncate.md | 1 - content/en/methods/shortcode/Inner.md | 5 +++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/content/en/content-management/archetypes.md b/content/en/content-management/archetypes.md index f89c3f6b3..acf101fda 100644 --- a/content/en/content-management/archetypes.md +++ b/content/en/content-management/archetypes.md @@ -86,9 +86,9 @@ Type Site : (`page.Site`) The current site object. See [details](/methods/site/). -## Alternate date format +## Date format -To insert date and time with an alternate format, use the [`time.Now`] function: +To insert date and time with a different format, use the [`time.Now`] function: [`time.Now`]: /functions/time/now/ @@ -169,9 +169,9 @@ content/ └── _index.md ``` -## Use alternate archetype +## Specify archetype -Use the `--kind` command line flag to specify an alternate archetype when creating content. +Use the `--kind` command line flag to specify an archetype when creating content. For example, let's say your site has two sections: articles and tutorials. Create an archetype for each content type: diff --git a/content/en/content-management/mathematics.md b/content/en/content-management/mathematics.md index a01a166dc..3212fe251 100644 --- a/content/en/content-management/mathematics.md +++ b/content/en/content-management/mathematics.md @@ -137,7 +137,7 @@ These are block equations: a^*=x-b^* \] -These are block equations using alternate delimiters: +These are also block equations: $$a^*=x-b^*$$ diff --git a/content/en/functions/lang/FormatNumberCustom.md b/content/en/functions/lang/FormatNumberCustom.md index 5b24aa2c1..603f42087 100644 --- a/content/en/functions/lang/FormatNumberCustom.md +++ b/content/en/functions/lang/FormatNumberCustom.md @@ -15,7 +15,7 @@ action: aliases: ['/functions/numfmt/'] --- -This function formats a number with the given precision. The first options parameter is a space-delimited string of characters to represent negativity, the decimal point, and grouping. The default value is `- . ,`. The second options parameter defines an alternate delimiting character. +This function formats a number with the given precision. The first options parameter is a space-delimited string of characters to represent negativity, the decimal point, and grouping. The default value is `- . ,`. The second options parameter defines an alternative delimiting character. Note that numbers are rounded up at 5 or greater. So, with precision set to 0, 1.5 becomes 2, and 1.4 becomes 1. diff --git a/content/en/getting-started/configuration-markup.md b/content/en/getting-started/configuration-markup.md index bcc997519..3853a3a6a 100644 --- a/content/en/getting-started/configuration-markup.md +++ b/content/en/getting-started/configuration-markup.md @@ -21,7 +21,7 @@ Hugo uses [Goldmark] to render Markdown to HTML. defaultMarkdownHandler = 'goldmark' {{< /code-toggle >}} -Files with the `.md` or `.markdown` extension are processed as Markdown, provided that you have not specified a different [content format] using the `markup` field in front matter. +Files with a `.md`, `.mdown`, or `.markdown` extension are processed as Markdown, provided that you have not specified a different [content format] using the `markup` field in front matter. To use a different renderer for Markdown files, specify one of `asciidocext`, `org`, `pandoc`, or `rst` in your site configuration. @@ -36,7 +36,7 @@ defaultMarkdownHandler|Description To use AsciiDoc, Pandoc, or reStructuredText you must install the relevant renderer and update your [security policy]. {{% note %}} -Unless you need a unique capability provided by one of the alternate Markdown handlers, we strongly recommend that you use the default setting. Goldmark is fast, well maintained, conforms to the [CommonMark] specification, and is compatible with [GitHub Flavored Markdown] (GFM). +Unless you need a unique capability provided by one of the alternative Markdown handlers, we strongly recommend that you use the default setting. Goldmark is fast, well maintained, conforms to the [CommonMark] specification, and is compatible with [GitHub Flavored Markdown] (GFM). [commonmark]: https://spec.commonmark.org/0.30/ [github flavored markdown]: https://github.github.com/gfm/ diff --git a/content/en/hugo-pipes/transpile-sass-to-css.md b/content/en/hugo-pipes/transpile-sass-to-css.md index df7eaa2a9..67ef4b7cd 100644 --- a/content/en/hugo-pipes/transpile-sass-to-css.md +++ b/content/en/hugo-pipes/transpile-sass-to-css.md @@ -62,7 +62,7 @@ precision enableSourceMap : (`bool`) If `true`, generates a source map. -sourceMapIncludeSources {{< new-in 0.108.0 >}} +sourceMapIncludeSources : (`bool`) If `true`, embeds sources in the generated source map. Not applicable to LibSass. includePaths diff --git a/content/en/methods/duration/Truncate.md b/content/en/methods/duration/Truncate.md index 795fcad76..78cddc27a 100644 --- a/content/en/methods/duration/Truncate.md +++ b/content/en/methods/duration/Truncate.md @@ -4,7 +4,6 @@ description: Returns the result of rounding DURATION1 toward zero to a multiple categories: [] keywords: [] action: - related: related: - functions/time/Duration - functions/time/ParseDuration diff --git a/content/en/methods/shortcode/Inner.md b/content/en/methods/shortcode/Inner.md index a428720d7..2814bcc2a 100644 --- a/content/en/methods/shortcode/Inner.md +++ b/content/en/methods/shortcode/Inner.md @@ -11,6 +11,7 @@ action: - methods/shortcode/InnerDeindent returnType: template.HTML signatures: [SHORTCODE.Inner] +toc: true --- This content: @@ -56,7 +57,7 @@ In the example above, the value returned by `Inner` is Markdown, but it was rend {{% /note %}} -## Use the RenderString method +## Use RenderString Let's modify the example above to pass the value returned by `Inner` through the [`RenderString`] method on the `Page` object: @@ -89,7 +90,7 @@ You can use the [`markdownify`] function instead of the `RenderString` method, b [details]: /methods/page/renderstring/ [`markdownify`]: /functions/transform/markdownify/ -## Use alternate notation +## Alternative notation Instead of calling the shortcode with the `{{}}` notation, use the `{{%/* */%}}` notation: From 3a6b2e6b14788222b6d755fccead9c2b6fa9f66a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 08:56:15 +0000 Subject: [PATCH 065/470] build(deps): bump github.com/fsnotify/fsnotify from 1.7.0 to 1.8.0 Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.7.0 to 1.8.0. - [Release notes](https://github.com/fsnotify/fsnotify/releases) - [Changelog](https://github.com/fsnotify/fsnotify/blob/main/CHANGELOG.md) - [Commits](https://github.com/fsnotify/fsnotify/compare/v1.7.0...v1.8.0) --- updated-dependencies: - dependency-name: github.com/fsnotify/fsnotify dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 886737b95..b5586e011 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/fatih/color v1.18.0 github.com/fortytw2/leaktest v1.3.0 github.com/frankban/quicktest v1.14.6 - github.com/fsnotify/fsnotify v1.7.0 + github.com/fsnotify/fsnotify v1.8.0 github.com/getkin/kin-openapi v0.123.0 github.com/ghodss/yaml v1.0.0 github.com/gobuffalo/flect v1.0.3 diff --git a/go.sum b/go.sum index 42f9a0119..e2768d578 100644 --- a/go.sum +++ b/go.sum @@ -139,8 +139,6 @@ github.com/bep/gowebp v0.3.0 h1:MhmMrcf88pUY7/PsEhMgEP0T6fDUnRTMpN8OclDrbrY= github.com/bep/gowebp v0.3.0/go.mod h1:ZhFodwdiFp8ehGJpF4LdPl6unxZm9lLFjxD3z2h2AgI= github.com/bep/helpers v0.5.0 h1:rneezhnG7GzLFlsEWO/EnleaBRuluBDGFimalO6Y50o= github.com/bep/helpers v0.5.0/go.mod h1:dSqCzIvHbzsk5YOesp1M7sKAq5xUcvANsRoKdawxH4Q= -github.com/bep/imagemeta v0.8.1 h1:tjZLPRftjxU7PTI87o5e5WKOFQ4S9S0engiP1OTpJTI= -github.com/bep/imagemeta v0.8.1/go.mod h1:5piPAq5Qomh07m/dPPCLN3mDJyFusvUG7VwdRD/vX0s= github.com/bep/imagemeta v0.8.3 h1:68XqpYXjWW9mFjdGurutDmAKBJa9y2aknEBHwY/+3zw= github.com/bep/imagemeta v0.8.3/go.mod h1:5piPAq5Qomh07m/dPPCLN3mDJyFusvUG7VwdRD/vX0s= github.com/bep/lazycache v0.7.0 h1:VM257SkkjcR9z55eslXTkUIX8QMNKoqQRNKV/4xIkCY= @@ -205,8 +203,8 @@ github.com/frankban/quicktest v1.13.0/go.mod h1:qLE0fzW0VuyUAJgPU19zByoIr0HtCHN/ github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/getkin/kin-openapi v0.123.0 h1:zIik0mRwFNLyvtXK274Q6ut+dPh6nlxBp0x7mNrPhs8= github.com/getkin/kin-openapi v0.123.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5jT7+fS8ed9NM= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= From 2d503f82acb90de1edfd0fc3cdc6e65af8184b8c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 08:57:17 +0000 Subject: [PATCH 066/470] build(deps): bump github.com/aws/aws-sdk-go-v2 from 1.30.3 to 1.32.4 Bumps [github.com/aws/aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2) from 1.30.3 to 1.32.4. - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.30.3...v1.32.4) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go-v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index b5586e011..a889cd853 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ require ( github.com/BurntSushi/locker v0.0.0-20171006230638-a6e239ea1c69 github.com/alecthomas/chroma/v2 v2.14.0 github.com/armon/go-radix v1.0.1-0.20221118154546-54df44f2176c - github.com/aws/aws-sdk-go-v2 v1.30.3 + github.com/aws/aws-sdk-go-v2 v1.32.4 github.com/aws/aws-sdk-go-v2/service/cloudfront v1.38.4 github.com/bep/clocks v0.5.0 github.com/bep/debounce v1.2.0 @@ -118,7 +118,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/sso v1.22.4 // indirect github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4 // indirect github.com/aws/aws-sdk-go-v2/service/sts v1.30.3 // indirect - github.com/aws/smithy-go v1.20.3 // indirect + github.com/aws/smithy-go v1.22.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/dlclark/regexp2 v1.11.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect diff --git a/go.sum b/go.sum index e2768d578..5db7f7a4e 100644 --- a/go.sum +++ b/go.sum @@ -81,8 +81,8 @@ github.com/armon/go-radix v1.0.1-0.20221118154546-54df44f2176c h1:651/eoCRnQ7YtS github.com/armon/go-radix v1.0.1-0.20221118154546-54df44f2176c/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= -github.com/aws/aws-sdk-go-v2 v1.30.3 h1:jUeBtG0Ih+ZIFH0F4UkmL9w3cSpaMv9tYYDbzILP8dY= -github.com/aws/aws-sdk-go-v2 v1.30.3/go.mod h1:nIQjQVp5sfpQcTc9mPSr1B0PaWK5ByX9MOoDadSN4lc= +github.com/aws/aws-sdk-go-v2 v1.32.4 h1:S13INUiTxgrPueTmrm5DZ+MiAo99zYzHEFh1UNkOxNE= +github.com/aws/aws-sdk-go-v2 v1.32.4/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.3 h1:tW1/Rkad38LA15X4UQtjXZXNKsCgkshC3EbmcUmghTg= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.3/go.mod h1:UbnqO+zjqk3uIt9yCACHJ9IVNhyhOCnYk8yA19SAWrM= github.com/aws/aws-sdk-go-v2/config v1.27.27 h1:HdqgGt1OAP0HkEDDShEl0oSYa9ZZBSOmKpdpsDMdO90= @@ -119,8 +119,8 @@ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4 h1:yiwVzJW2ZxZTurVbYWA7QOrA github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4/go.mod h1:0oxfLkpz3rQ/CHlx5hB7H69YUpFiI1tql6Q6Ne+1bCw= github.com/aws/aws-sdk-go-v2/service/sts v1.30.3 h1:ZsDKRLXGWHk8WdtyYMoGNO7bTudrvuKpDKgMVRlepGE= github.com/aws/aws-sdk-go-v2/service/sts v1.30.3/go.mod h1:zwySh8fpFyXp9yOr/KVzxOl8SRqgf/IDw5aUt9UKFcQ= -github.com/aws/smithy-go v1.20.3 h1:ryHwveWzPV5BIof6fyDvor6V3iUL7nTfiTKXHiW05nE= -github.com/aws/smithy-go v1.20.3/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= +github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= +github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/bep/clocks v0.5.0 h1:hhvKVGLPQWRVsBP/UB7ErrHYIO42gINVbvqxvYTPVps= github.com/bep/clocks v0.5.0/go.mod h1:SUq3q+OOq41y2lRQqH5fsOoxN8GbxSiT6jvoVVLCVhU= github.com/bep/debounce v1.2.0 h1:wXds8Kq8qRfwAOpAxHrJDbCXgC5aHSzgQb/0gKsHQqo= From 61e2ce2a49ad49fccdd1dc5f8aeb42616ac313f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 08:54:55 +0000 Subject: [PATCH 067/470] build(deps): bump google.golang.org/api from 0.191.0 to 0.206.0 Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.191.0 to 0.206.0. - [Release notes](https://github.com/googleapis/google-api-go-client/releases) - [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md) - [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.191.0...v0.206.0) --- updated-dependencies: - dependency-name: google.golang.org/api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 40 +++++++++++++------------- go.sum | 88 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/go.mod b/go.mod index a889cd853..dcf1926f6 100644 --- a/go.mod +++ b/go.mod @@ -82,16 +82,16 @@ require ( golang.org/x/sync v0.9.0 golang.org/x/text v0.20.0 golang.org/x/tools v0.27.0 - google.golang.org/api v0.191.0 + google.golang.org/api v0.206.0 gopkg.in/yaml.v2 v2.4.0 ) require ( - cloud.google.com/go v0.115.0 // indirect - cloud.google.com/go/auth v0.8.1 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect - cloud.google.com/go/compute/metadata v0.5.0 // indirect - cloud.google.com/go/iam v1.1.13 // indirect + cloud.google.com/go v0.116.0 // indirect + cloud.google.com/go/auth v0.10.2 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.5 // indirect + cloud.google.com/go/compute/metadata v0.5.2 // indirect + cloud.google.com/go/iam v1.2.2 // indirect cloud.google.com/go/storage v1.43.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect @@ -131,8 +131,8 @@ require ( github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/google/wire v0.6.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.13.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect + github.com/googleapis/gax-go/v2 v2.14.0 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/invopop/yaml v0.2.0 // indirect @@ -149,21 +149,21 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect - go.opentelemetry.io/otel v1.28.0 // indirect - go.opentelemetry.io/otel/metric v1.28.0 // indirect - go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect + go.opentelemetry.io/otel v1.29.0 // indirect + go.opentelemetry.io/otel/metric v1.29.0 // indirect + go.opentelemetry.io/otel/trace v1.29.0 // indirect golang.org/x/crypto v0.29.0 // indirect - golang.org/x/oauth2 v0.22.0 // indirect + golang.org/x/oauth2 v0.24.0 // indirect golang.org/x/sys v0.27.0 // indirect - golang.org/x/time v0.6.0 // indirect + golang.org/x/time v0.8.0 // indirect golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect - google.golang.org/genproto v0.0.0-20240812133136-8ffd90a71988 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240812133136-8ffd90a71988 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240812133136-8ffd90a71988 // indirect - google.golang.org/grpc v1.65.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/genproto v0.0.0-20241104194629-dd2ea8efbc28 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect + google.golang.org/grpc v1.67.1 // indirect + google.golang.org/protobuf v1.35.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect howett.net/plist v1.0.0 // indirect software.sslmate.com/src/go-pkcs12 v0.2.0 // indirect diff --git a/go.sum b/go.sum index 5db7f7a4e..4a61c396a 100644 --- a/go.sum +++ b/go.sum @@ -17,26 +17,26 @@ cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHOb cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go v0.115.0 h1:CnFSK6Xo3lDYRoBKEcAtia6VSC837/ZkJuRduSFnr14= -cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU= -cloud.google.com/go/auth v0.8.1 h1:QZW9FjC5lZzN864p13YxvAtGUlQ+KgRL+8Sg45Z6vxo= -cloud.google.com/go/auth v0.8.1/go.mod h1:qGVp/Y3kDRSDZ5gFD/XPUfYQ9xW1iI7q8RIRoCyBbJc= -cloud.google.com/go/auth/oauth2adapt v0.2.4 h1:0GWE/FUsXhf6C+jAkWgYm7X9tK8cuEIfy19DBn6B6bY= -cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLMC/Pe3eaL4NmdvqPtc= +cloud.google.com/go v0.116.0 h1:B3fRrSDkLRt5qSHWe40ERJvhvnQwdZiHu0bJOpldweE= +cloud.google.com/go v0.116.0/go.mod h1:cEPSRWPzZEswwdr9BxE6ChEn01dWlTaF05LiC2Xs70U= +cloud.google.com/go/auth v0.10.2 h1:oKF7rgBfSHdp/kuhXtqU/tNDr0mZqhYbEh+6SiqzkKo= +cloud.google.com/go/auth v0.10.2/go.mod h1:xxA5AqpDrvS+Gkmo9RqrGGRh6WSNKKOXhY3zNOr38tI= +cloud.google.com/go/auth/oauth2adapt v0.2.5 h1:2p29+dePqsCHPP1bqDJcKj4qxRyYCcbzKpFyKGt3MTk= +cloud.google.com/go/auth/oauth2adapt v0.2.5/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= -cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= +cloud.google.com/go/compute/metadata v0.5.2 h1:UxK4uu/Tn+I3p2dYWTfiX4wva7aYlKixAHn3fyqngqo= +cloud.google.com/go/compute/metadata v0.5.2/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/iam v1.1.13 h1:7zWBXG9ERbMLrzQBRhFliAV+kjcRToDTgQT3CTwYyv4= -cloud.google.com/go/iam v1.1.13/go.mod h1:K8mY0uSXwEXS30KrnVb+j54LB/ntfZu1dr+4zFMNbus= -cloud.google.com/go/longrunning v0.5.12 h1:5LqSIdERr71CqfUsFlJdBpOkBH8FBCFD7P1nTWy3TYE= -cloud.google.com/go/longrunning v0.5.12/go.mod h1:S5hMV8CDJ6r50t2ubVJSKQVv5u0rmik5//KgLO3k4lU= +cloud.google.com/go/iam v1.2.2 h1:ozUSofHUGf/F4tCNy/mu9tHLTaxZFLOUiKzjcgWHGIA= +cloud.google.com/go/iam v1.2.2/go.mod h1:0Ys8ccaZHdI1dEUilwzqng/6ps2YB6vRsjIe00/+6JY= +cloud.google.com/go/longrunning v0.6.2 h1:xjDfh1pQcWPEvnfjZmwjKQEcHnpz6lHjfy7Fo0MK+hc= +cloud.google.com/go/longrunning v0.6.2/go.mod h1:k/vIs83RN4bE3YCswdXC5PFfWVILjm3hpEUlSko4PiI= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -320,12 +320,12 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/wire v0.6.0 h1:HBkoIh4BdSxoyo9PveV8giw7ZsaBOvzWKfcg/6MrVwI= github.com/google/wire v0.6.0/go.mod h1:F4QhpQ9EDIdJ1Mbop/NZBRB+5yrR6qg3BnctaoUk6NA= -github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= -github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= +github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw= +github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDPT0hH1s= -github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= +github.com/googleapis/gax-go/v2 v2.14.0 h1:f+jMrjBPl+DL9nI4IQzLUxMq7XrAqFYB7hBPqMNIe8o= +github.com/googleapis/gax-go/v2 v2.14.0/go.mod h1:lhBCnjdLrWRaPvLWhmc8IS24m9mr07qSYnHncrgo+zk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -482,18 +482,18 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= -go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= -go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= -go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= -go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= -go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= -go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= -go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= -go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 h1:r6I7RJCN86bpD/FQwedZ0vSixDpwuWREjW9oRMsmqDc= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0/go.mod h1:B9yO6b04uB80CzjedvewuqDhxJxi11s7/GtiGa8bAjI= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8= +go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= +go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= +go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= +go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= +go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo= +go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= +go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= +go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= gocloud.dev v0.39.0 h1:EYABYGhAalPUaMrbSKOr5lejxoxvXj99nE8XFtsDgds= @@ -606,8 +606,8 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= -golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= +golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -697,8 +697,8 @@ golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= +golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -778,8 +778,8 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513 google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.191.0 h1:cJcF09Z+4HAB2t5qTQM1ZtfL/PemsLFkcFG67qq2afk= -google.golang.org/api v0.191.0/go.mod h1:tD5dsFGxFza0hnQveGfVk9QQYKcfp+VzgRqyXFxE0+E= +google.golang.org/api v0.206.0 h1:A27GClesCSheW5P2BymVHjpEeQ2XHH8DI8Srs2HI2L8= +google.golang.org/api v0.206.0/go.mod h1:BtB8bfjTYIrai3d8UyvPmV9REGgox7coh+ZRwm0b+W8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -823,12 +823,12 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20240812133136-8ffd90a71988 h1:CT2Thj5AuPV9phrYMtzX11k+XkzMGfRAet42PmoTATM= -google.golang.org/genproto v0.0.0-20240812133136-8ffd90a71988/go.mod h1:7uvplUBj4RjHAxIZ//98LzOvrQ04JBkaixRmCMI29hc= -google.golang.org/genproto/googleapis/api v0.0.0-20240812133136-8ffd90a71988 h1:+/tmTy5zAieooKIXfzDm9KiA3Bv6JBwriRN9LY+yayk= -google.golang.org/genproto/googleapis/api v0.0.0-20240812133136-8ffd90a71988/go.mod h1:4+X6GvPs+25wZKbQq9qyAXrwIRExv7w0Ea6MgZLZiDM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240812133136-8ffd90a71988 h1:V71AcdLZr2p8dC9dbOIMCpqi4EmRl8wUwnJzXXLmbmc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240812133136-8ffd90a71988/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto v0.0.0-20241104194629-dd2ea8efbc28 h1:KJjNNclfpIkVqrZlTWcgOOaVQ00LdBnoEaRfkUx760s= +google.golang.org/genproto v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:mt9/MofW7AWQ+Gy179ChOnvmJatV8YHUmrcedo9CIFI= +google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 h1:M0KvPgPmDZHPlbRbaNU1APr28TvwvvdUPlSv7PUvy8g= +google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:dguCy7UOdZhTvLzDyt15+rOrawrpM4q7DD9dQ1P11P4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 h1:XVhgTWWV3kGQlwJHR3upFWZeTsei6Oks1apkZSeonIE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -845,8 +845,8 @@ google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -857,8 +857,8 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= From 1fd845eee4d2d0dc264c0f45471815d00160f7dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 18 Nov 2024 10:26:35 +0100 Subject: [PATCH 068/470] dartsass: Remove support for v1 of the protocol/binary (note) People who stil use a very old binary named `dart-sass-embedded` need to upgrade. See https://gohugo.io/functions/css/sass/#dart-sass --- common/herrors/file_error.go | 11 --- common/hugo/hugo.go | 24 ++--- go.mod | 1 - go.sum | 7 -- .../tocss/dartsass/client.go | 95 +++++-------------- .../tocss/dartsass/transform.go | 10 -- 6 files changed, 35 insertions(+), 113 deletions(-) diff --git a/common/herrors/file_error.go b/common/herrors/file_error.go index 32a6f0081..007a06b48 100644 --- a/common/herrors/file_error.go +++ b/common/herrors/file_error.go @@ -20,8 +20,6 @@ import ( "io" "path/filepath" - godartsassv1 "github.com/bep/godartsass" - "github.com/bep/godartsass/v2" "github.com/bep/golibsass/libsass/libsasserrors" "github.com/gohugoio/hugo/common/paths" @@ -153,8 +151,6 @@ func (e *fileError) causeString() string { // Avoid repeating the file info in the error message. case godartsass.SassError: return v.Message - case godartsassv1.SassError: - return v.Message case libsasserrors.Error: return v.Message default: @@ -392,13 +388,6 @@ func extractPosition(e error) (pos text.Position) { pos.Filename = filename pos.Offset = start.Offset pos.ColumnNumber = start.Column - case godartsassv1.SassError: - span := v.Span - start := span.Start - filename, _ := paths.UrlToFilename(span.Url) - pos.Filename = filename - pos.Offset = start.Offset - pos.ColumnNumber = start.Column case libsasserrors.Error: pos.Filename = v.File pos.LineNumber = v.Line diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go index dd43cf7b6..11ec40e0b 100644 --- a/common/hugo/hugo.go +++ b/common/hugo/hugo.go @@ -25,9 +25,7 @@ import ( "sync" "time" - godartsassv1 "github.com/bep/godartsass" "github.com/bep/logg" - "github.com/mitchellh/mapstructure" "github.com/bep/godartsass/v2" "github.com/gohugoio/hugo/common/hcontext" @@ -318,7 +316,7 @@ func GetDependencyListNonGo() []string { if dartSass := dartSassVersion(); dartSass.ProtocolVersion != "" { dartSassPath := "github.com/sass/dart-sass-embedded" - if IsDartSassV2() { + if IsDartSassGeV2() { dartSassPath = "github.com/sass/dart-sass" } deps = append(deps, @@ -365,22 +363,15 @@ type Dependency struct { } func dartSassVersion() godartsass.DartSassVersion { - if DartSassBinaryName == "" { + if DartSassBinaryName == "" || !IsDartSassGeV2() { return godartsass.DartSassVersion{} } - if IsDartSassV2() { - v, _ := godartsass.Version(DartSassBinaryName) - return v - } - - v, _ := godartsassv1.Version(DartSassBinaryName) - var vv godartsass.DartSassVersion - mapstructure.WeakDecode(v, &vv) - return vv + v, _ := godartsass.Version(DartSassBinaryName) + return v } // DartSassBinaryName is the name of the Dart Sass binary to use. -// TODO(beop) find a better place for this. +// TODO(bep) find a better place for this. var DartSassBinaryName string func init() { @@ -405,7 +396,10 @@ var ( dartSassBinaryNamesV2 = []string{"dart-sass", "sass"} ) -func IsDartSassV2() bool { +// TODO(bep) we eventually want to remove this, but keep it for a while to throw an informative error. +// We stopped supporting the old binary in Hugo 0.139.0. +func IsDartSassGeV2() bool { + // dart-sass-embedded was the first version of the embedded Dart Sass before it was moved into the main project. return !strings.Contains(DartSassBinaryName, "embedded") } diff --git a/go.mod b/go.mod index dcf1926f6..c19e8da34 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,6 @@ require ( github.com/bep/debounce v1.2.0 github.com/bep/gitmap v1.6.0 github.com/bep/goat v0.5.0 - github.com/bep/godartsass v1.2.0 github.com/bep/godartsass/v2 v2.2.0 github.com/bep/golibsass v1.2.0 github.com/bep/gowebp v0.3.0 diff --git a/go.sum b/go.sum index 4a61c396a..0ba28ce4d 100644 --- a/go.sum +++ b/go.sum @@ -129,8 +129,6 @@ github.com/bep/gitmap v1.6.0 h1:sDuQMm9HoTL0LtlrfxjbjgAg2wHQd4nkMup2FInYzhA= github.com/bep/gitmap v1.6.0/go.mod h1:n+3W1f/rot2hynsqEGxGMErPRgT41n9CkGuzPvz9cIw= github.com/bep/goat v0.5.0 h1:S8jLXHCVy/EHIoCY+btKkmcxcXFd34a0Q63/0D4TKeA= github.com/bep/goat v0.5.0/go.mod h1:Md9x7gRxiWKs85yHlVTvHQw9rg86Bm+Y4SuYE8CTH7c= -github.com/bep/godartsass v1.2.0 h1:E2VvQrxAHAFwbjyOIExAMmogTItSKodoKuijNrGm5yU= -github.com/bep/godartsass v1.2.0/go.mod h1:6LvK9RftsXMxGfsA0LDV12AGc4Jylnu6NgHL+Q5/pE8= github.com/bep/godartsass/v2 v2.2.0 h1:3hO9Dt4BOnxkKmRxc+OpoKVFrDvBycpSCXEdElVAMVI= github.com/bep/godartsass/v2 v2.2.0/go.mod h1:AcP8QgC+OwOXEq6im0WgDRYK7scDsmZCEW62o1prQLo= github.com/bep/golibsass v1.2.0 h1:nyZUkKP/0psr8nT6GR2cnmt99xS93Ji82ZD9AgOK6VI= @@ -163,7 +161,6 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/clbanning/mxj/v2 v2.7.0 h1:WA/La7UGCanFe5NpHF0Q3DNtnCsVoxbPKuyBNHWRyME= github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s= -github.com/cli/safeexec v1.0.0/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q= github.com/cli/safeexec v1.0.1 h1:e/C79PbXF4yYTN/wauC4tviMxEV13BwljGj0N9j+N00= github.com/cli/safeexec v1.0.1/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -200,7 +197,6 @@ github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHqu github.com/frankban/quicktest v1.4.1/go.mod h1:36zfPVQyHxymz4cH7wlDmVwDrJuljRB60qkgn7rorfQ= github.com/frankban/quicktest v1.7.2/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o= github.com/frankban/quicktest v1.13.0/go.mod h1:qLE0fzW0VuyUAJgPU19zByoIr0HtCHN/r/VLSOOIySU= -github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= @@ -287,7 +283,6 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -358,7 +353,6 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -417,7 +411,6 @@ github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4 github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= diff --git a/resources/resource_transformers/tocss/dartsass/client.go b/resources/resource_transformers/tocss/dartsass/client.go index e6f5567e4..b42327621 100644 --- a/resources/resource_transformers/tocss/dartsass/client.go +++ b/resources/resource_transformers/tocss/dartsass/client.go @@ -20,7 +20,6 @@ import ( "io" "strings" - godartsassv1 "github.com/bep/godartsass" "github.com/bep/godartsass/v2" "github.com/bep/logg" "github.com/gohugoio/hugo/common/herrors" @@ -52,54 +51,39 @@ func New(fs *filesystems.SourceFilesystem, rs *resources.Spec) (*Client, error) return nil, fmt.Errorf("no Dart Sass binary found in $PATH") } + if !hugo.IsDartSassGeV2() { + return nil, fmt.Errorf("unsupported Dart Sass version detected, please upgrade to Dart Sass 2.0 or later, see https://gohugo.io/functions/css/sass/#dart-sass") + } + if err := rs.ExecHelper.Sec().CheckAllowedExec(hugo.DartSassBinaryName); err != nil { return nil, err } var ( - transpiler *godartsass.Transpiler - transpilerv1 *godartsassv1.Transpiler - err error - infol = rs.Logger.InfoCommand("Dart Sass") - warnl = rs.Logger.WarnCommand("Dart Sass") + transpiler *godartsass.Transpiler + err error + infol = rs.Logger.InfoCommand("Dart Sass") + warnl = rs.Logger.WarnCommand("Dart Sass") ) - if hugo.IsDartSassV2() { - transpiler, err = godartsass.Start(godartsass.Options{ - DartSassEmbeddedFilename: hugo.DartSassBinaryName, - LogEventHandler: func(event godartsass.LogEvent) { - message := strings.ReplaceAll(event.Message, dartSassStdinPrefix, "") - switch event.Type { - case godartsass.LogEventTypeDebug: - // Log as Info for now, we may adjust this if it gets too chatty. - infol.Log(logg.String(message)) - default: - // The rest are either deprecations or @warn statements. - warnl.Log(logg.String(message)) - } - }, - }) - } else { - transpilerv1, err = godartsassv1.Start(godartsassv1.Options{ - DartSassEmbeddedFilename: hugo.DartSassBinaryName, - LogEventHandler: func(event godartsassv1.LogEvent) { - message := strings.ReplaceAll(event.Message, dartSassStdinPrefix, "") - switch event.Type { - case godartsassv1.LogEventTypeDebug: - // Log as Info for now, we may adjust this if it gets too chatty. - infol.Log(logg.String(message)) - default: - // The rest are either deprecations or @warn statements. - warnl.Log(logg.String(message)) - } - }, - }) - } - + transpiler, err = godartsass.Start(godartsass.Options{ + DartSassEmbeddedFilename: hugo.DartSassBinaryName, + LogEventHandler: func(event godartsass.LogEvent) { + message := strings.ReplaceAll(event.Message, dartSassStdinPrefix, "") + switch event.Type { + case godartsass.LogEventTypeDebug: + // Log as Info for now, we may adjust this if it gets too chatty. + infol.Log(logg.String(message)) + default: + // The rest are either deprecations or @warn statements. + warnl.Log(logg.String(message)) + } + }, + }) if err != nil { return nil, err } - return &Client{sfs: fs, workFs: rs.BaseFs.Work, rs: rs, transpiler: transpiler, transpilerV1: transpilerv1}, nil + return &Client{sfs: fs, workFs: rs.BaseFs.Work, rs: rs, transpiler: transpiler}, nil } type Client struct { @@ -108,9 +92,7 @@ type Client struct { sfs *filesystems.SourceFilesystem workFs afero.Fs - // One of these are non-nil. - transpiler *godartsass.Transpiler - transpilerV1 *godartsassv1.Transpiler + transpiler *godartsass.Transpiler } func (c *Client) ToCSS(res resources.ResourceTransformer, args map[string]any) (resource.Resource, error) { @@ -121,13 +103,7 @@ func (c *Client) ToCSS(res resources.ResourceTransformer, args map[string]any) ( } func (c *Client) Close() error { - if c.transpilerV1 != nil { - return c.transpilerV1.Close() - } - if c.transpiler != nil { - return c.transpiler.Close() - } - return nil + return c.transpiler.Close() } func (c *Client) toCSS(args godartsass.Args, src io.Reader) (godartsass.Result, error) { @@ -135,26 +111,7 @@ func (c *Client) toCSS(args godartsass.Args, src io.Reader) (godartsass.Result, args.Source = in - var ( - err error - res godartsass.Result - ) - - if c.transpilerV1 != nil { - var resv1 godartsassv1.Result - var argsv1 godartsassv1.Args - mapstructure.Decode(args, &argsv1) - if args.ImportResolver != nil { - argsv1.ImportResolver = importResolverV1{args.ImportResolver} - } - resv1, err = c.transpilerV1.Execute(argsv1) - if err == nil { - mapstructure.Decode(resv1, &res) - } - } else { - res, err = c.transpiler.Execute(args) - } - + res, err := c.transpiler.Execute(args) if err != nil { if err.Error() == "unexpected EOF" { //lint:ignore ST1005 end user message. diff --git a/resources/resource_transformers/tocss/dartsass/transform.go b/resources/resource_transformers/tocss/dartsass/transform.go index d8b6ae5b4..e23ef0986 100644 --- a/resources/resource_transformers/tocss/dartsass/transform.go +++ b/resources/resource_transformers/tocss/dartsass/transform.go @@ -35,7 +35,6 @@ import ( "github.com/gohugoio/hugo/hugofs" - godartsassv1 "github.com/bep/godartsass" "github.com/bep/godartsass/v2" ) @@ -206,12 +205,3 @@ func (t importResolver) Load(url string) (godartsass.Import, error) { return godartsass.Import{Content: string(b), SourceSyntax: sourceSyntax}, err } - -type importResolverV1 struct { - godartsass.ImportResolver -} - -func (t importResolverV1) Load(url string) (godartsassv1.Import, error) { - res, err := t.ImportResolver.Load(url) - return godartsassv1.Import{Content: res.Content, SourceSyntax: godartsassv1.SourceSyntax(res.SourceSyntax)}, err -} From 3b6eaf9b1f128b36fe25478b2e7c4d8463e5ab58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 18 Nov 2024 10:04:37 +0100 Subject: [PATCH 069/470] dartsass: Add silenceDeprecations option Fixes #13045 --- docs/content/en/functions/css/Sass.md | 3 ++ go.mod | 2 +- go.sum | 2 ++ hugolib/integrationtest_builder.go | 7 ++++ .../tocss/dartsass/client.go | 9 ++++- .../dartsass/dartsass_integration_test.go | 35 +++++++++++++++++++ .../tocss/dartsass/transform.go | 1 + 7 files changed, 57 insertions(+), 2 deletions(-) diff --git a/docs/content/en/functions/css/Sass.md b/docs/content/en/functions/css/Sass.md index 328037bb9..793c0c1ac 100644 --- a/docs/content/en/functions/css/Sass.md +++ b/docs/content/en/functions/css/Sass.md @@ -86,6 +86,9 @@ includePaths {{ end }} ``` +silenceDeprecations +: (`slice`) {{< new-in 0.139.0 >}} A slice of deprecation IDs to silence. The deprecation IDs are printed to in the warning message, e.g "import" in `WARN Dart Sass: DEPRECATED [import] ...`. This is for Dart Sass only. + ## Dart Sass The extended version of Hugo includes [LibSass] to transpile Sass to CSS. In 2020, the Sass team deprecated LibSass in favor of [Dart Sass]. diff --git a/go.mod b/go.mod index c19e8da34..82a59ac91 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/bep/debounce v1.2.0 github.com/bep/gitmap v1.6.0 github.com/bep/goat v0.5.0 - github.com/bep/godartsass/v2 v2.2.0 + github.com/bep/godartsass/v2 v2.3.0 github.com/bep/golibsass v1.2.0 github.com/bep/gowebp v0.3.0 github.com/bep/helpers v0.5.0 diff --git a/go.sum b/go.sum index 0ba28ce4d..a3af71aee 100644 --- a/go.sum +++ b/go.sum @@ -131,6 +131,8 @@ github.com/bep/goat v0.5.0 h1:S8jLXHCVy/EHIoCY+btKkmcxcXFd34a0Q63/0D4TKeA= github.com/bep/goat v0.5.0/go.mod h1:Md9x7gRxiWKs85yHlVTvHQw9rg86Bm+Y4SuYE8CTH7c= github.com/bep/godartsass/v2 v2.2.0 h1:3hO9Dt4BOnxkKmRxc+OpoKVFrDvBycpSCXEdElVAMVI= github.com/bep/godartsass/v2 v2.2.0/go.mod h1:AcP8QgC+OwOXEq6im0WgDRYK7scDsmZCEW62o1prQLo= +github.com/bep/godartsass/v2 v2.3.0 h1:gEMyq/bNn4hxpUSwy/NKyOTqPqVh3AedhMHvQR+x0kU= +github.com/bep/godartsass/v2 v2.3.0/go.mod h1:AcP8QgC+OwOXEq6im0WgDRYK7scDsmZCEW62o1prQLo= github.com/bep/golibsass v1.2.0 h1:nyZUkKP/0psr8nT6GR2cnmt99xS93Ji82ZD9AgOK6VI= github.com/bep/golibsass v1.2.0/go.mod h1:DL87K8Un/+pWUS75ggYv41bliGiolxzDKWJAq3eJ1MA= github.com/bep/gowebp v0.3.0 h1:MhmMrcf88pUY7/PsEhMgEP0T6fDUnRTMpN8OclDrbrY= diff --git a/hugolib/integrationtest_builder.go b/hugolib/integrationtest_builder.go index 5dc13592f..637e5dee0 100644 --- a/hugolib/integrationtest_builder.go +++ b/hugolib/integrationtest_builder.go @@ -76,6 +76,13 @@ func TestOptWarn() TestOpt { } } +// TestOptOsFs will enable the real file system in integration tests. +func TestOptOsFs() TestOpt { + return func(c *IntegrationTestConfig) { + c.NeedsOsFS = true + } +} + // TestOptWithNFDOnDarwin will normalize the Unicode filenames to NFD on Darwin. func TestOptWithNFDOnDarwin() TestOpt { return func(c *IntegrationTestConfig) { diff --git a/resources/resource_transformers/tocss/dartsass/client.go b/resources/resource_transformers/tocss/dartsass/client.go index b42327621..762828b70 100644 --- a/resources/resource_transformers/tocss/dartsass/client.go +++ b/resources/resource_transformers/tocss/dartsass/client.go @@ -74,8 +74,10 @@ func New(fs *filesystems.SourceFilesystem, rs *resources.Spec) (*Client, error) case godartsass.LogEventTypeDebug: // Log as Info for now, we may adjust this if it gets too chatty. infol.Log(logg.String(message)) + case godartsass.LogEventTypeDeprecated: + warnl.Logf("DEPRECATED [%s]: %s", event.DeprecationType, message) default: - // The rest are either deprecations or @warn statements. + // The rest are @warn statements. warnl.Log(logg.String(message)) } }, @@ -151,6 +153,11 @@ type Options struct { // @use "hugo:vars"; // $color: vars.$color; Vars map[string]any + + // Deprecations IDs in this slice will be silenced. + // The IDs can be found in the Dart Sass log output, e.g. "import" in + // WARN Dart Sass: DEPRECATED [import]. + SilenceDeprecations []string } func decodeOptions(m map[string]any) (opts Options, err error) { diff --git a/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go b/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go index 2aac2c5fb..5d1b89eaf 100644 --- a/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go +++ b/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go @@ -605,3 +605,38 @@ module hugo-github-issue-12849 b.AssertFileContent("public/index.html", ".foo{color:red}.bar{color:green}") } + +func TestIgnoreDeprecationWarnings(t *testing.T) { + t.Parallel() + if !dartsass.Supports() { + t.Skip() + } + + files := ` +-- hugo.toml -- +disableKinds = ['page','section','rss','sitemap','taxonomy','term'] +-- assets/scss/main.scss -- +@import "moo"; +-- node_modules/foo/_moo.scss -- +$moolor: #fff; + +moo { + color: $moolor; +} +-- config.toml -- +-- layouts/index.html -- +{{ $cssOpts := (dict "includePaths" (slice "node_modules/foo") "transpiler" "dartsass" ) }} +{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts | minify }} +T1: {{ $r.Content }} + ` + + b := hugolib.Test(t, files, hugolib.TestOptOsFs(), hugolib.TestOptWarn()) + b.AssertLogContains("Dart Sass: DEPRECATED [import]") + b.AssertFileContent("public/index.html", `moo{color:#fff}`) + + files = strings.ReplaceAll(files, `"transpiler" "dartsass"`, `"transpiler" "dartsass" "silenceDeprecations" (slice "import")`) + + b = hugolib.Test(t, files, hugolib.TestOptOsFs(), hugolib.TestOptWarn()) + b.AssertLogContains("! Dart Sass: DEPRECATED [import]") + b.AssertFileContent("public/index.html", `moo{color:#fff}`) +} diff --git a/resources/resource_transformers/tocss/dartsass/transform.go b/resources/resource_transformers/tocss/dartsass/transform.go index e23ef0986..c5f97abff 100644 --- a/resources/resource_transformers/tocss/dartsass/transform.go +++ b/resources/resource_transformers/tocss/dartsass/transform.go @@ -89,6 +89,7 @@ func (t *transform) Transform(ctx *resources.ResourceTransformationCtx) error { OutputStyle: godartsass.ParseOutputStyle(opts.OutputStyle), EnableSourceMap: opts.EnableSourceMap, SourceMapIncludeSources: opts.SourceMapIncludeSources, + SilenceDeprecations: opts.SilenceDeprecations, } // Append any workDir relative include paths From eb298144b63cfa9e6720ec5731c7687d7df15955 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:52:23 +0000 Subject: [PATCH 070/470] build(deps): bump github.com/aws/aws-sdk-go-v2/service/cloudfront Bumps [github.com/aws/aws-sdk-go-v2/service/cloudfront](https://github.com/aws/aws-sdk-go-v2) from 1.38.4 to 1.41.0. - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/s3/v1.38.4...service/s3/v1.41.0) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go-v2/service/cloudfront dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 82a59ac91..3013813ab 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ require ( github.com/alecthomas/chroma/v2 v2.14.0 github.com/armon/go-radix v1.0.1-0.20221118154546-54df44f2176c github.com/aws/aws-sdk-go-v2 v1.32.4 - github.com/aws/aws-sdk-go-v2/service/cloudfront v1.38.4 + github.com/aws/aws-sdk-go-v2/service/cloudfront v1.41.0 github.com/bep/clocks v0.5.0 github.com/bep/debounce v1.2.0 github.com/bep/gitmap v1.6.0 @@ -105,8 +105,8 @@ require ( github.com/aws/aws-sdk-go-v2/credentials v1.17.27 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.11 // indirect github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.10 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.23 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.23 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.15 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3 // indirect diff --git a/go.sum b/go.sum index a3af71aee..32005ff6f 100644 --- a/go.sum +++ b/go.sum @@ -93,16 +93,16 @@ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.11 h1:KreluoV8FZDEtI6Co2xuNk github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.11/go.mod h1:SeSUYBLsMYFoRvHE0Tjvn7kbxaUhl75CJi1sbfhMxkU= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.10 h1:zeN9UtUlA6FTx0vFSayxSX32HDw73Yb6Hh2izDSFxXY= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.10/go.mod h1:3HKuexPDcwLWPaqpW2UR/9n8N/u/3CKcGAzSs8p8u8g= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15 h1:SoNJ4RlFEQEbtDcCEt+QG56MY4fm4W8rYirAmq+/DdU= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15/go.mod h1:U9ke74k1n2bf+RIgoX1SXFed1HLs51OgUSs+Ph0KJP8= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15 h1:C6WHdGnTDIYETAm5iErQUiVNsclNx9qbJVPIt03B6bI= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15/go.mod h1:ZQLZqhcu+JhSrA9/NXRm8SkDvsycE+JkV3WGY41e+IM= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.23 h1:A2w6m6Tmr+BNXjDsr7M90zkWjsu4JXHwrzPg235STs4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.23/go.mod h1:35EVp9wyeANdujZruvHiQUAo9E3vbhnIO1mTCAxMlY0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.23 h1:pgYW9FCabt2M25MoHYCfMrVY2ghiiBKYWUVXfwZs+sU= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.23/go.mod h1:c48kLgzO19wAu3CPkDWC28JbaJ+hfQlsdl7I2+oqIbk= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.15 h1:Z5r7SycxmSllHYmaAZPpmN8GviDrSGhMS6bldqtXZPw= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.15/go.mod h1:CetW7bDE00QoGEmPUoZuRog07SGVAUVW6LFpNP0YfIg= -github.com/aws/aws-sdk-go-v2/service/cloudfront v1.38.4 h1:I/sQ9uGOs72/483obb2SPoa9ZEsYGbel6jcTTwD/0zU= -github.com/aws/aws-sdk-go-v2/service/cloudfront v1.38.4/go.mod h1:P6ByphKl2oNQZlv4WsCaLSmRncKEcOnbitYLtJPfqZI= +github.com/aws/aws-sdk-go-v2/service/cloudfront v1.41.0 h1:sLXpWohpuSh6fSvI7q/D5k3yUB9KtUyIEUDAQnasG0c= +github.com/aws/aws-sdk-go-v2/service/cloudfront v1.41.0/go.mod h1:GM6Olux4KAMUmRw0XgadfpN1cOpm5eWYZ31PAj59JSk= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3 h1:dT3MqvGhSoaIhRseqw2I0yH81l7wiR2vjs57O51EAm8= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3/go.mod h1:GlAeCkHwugxdHaueRr4nhPuY+WW+gR8UjlcqzPr1SPI= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.17 h1:YPYe6ZmvUfDDDELqEKtAd6bo8zxhkm+XEFEzQisqUIE= From e917401c710d4213e17b7174ed18f042784ff6d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 18 Nov 2024 15:01:09 +0100 Subject: [PATCH 071/470] Make sure term is always set Fixes #13063 --- hugolib/content_map_page.go | 9 +++--- hugolib/page__new.go | 20 ++++++++++--- .../pagesfromgotmpl_integration_test.go | 30 +++++++++++++++++++ 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/hugolib/content_map_page.go b/hugolib/content_map_page.go index 8c9e4a31a..a336c8489 100644 --- a/hugolib/content_map_page.go +++ b/hugolib/content_map_page.go @@ -1595,6 +1595,10 @@ func (sa *sitePagesAssembler) applyAggregatesToTaxonomiesAndTerms() error { } func (sa *sitePagesAssembler) assembleTermsAndTranslations() error { + if sa.pageMap.cfg.taxonomyTermDisabled { + return nil + } + var ( pages = sa.pageMap.treePages entries = sa.pageMap.treeTaxonomyEntries @@ -1612,10 +1616,6 @@ func (sa *sitePagesAssembler) assembleTermsAndTranslations() error { return false, nil } - if sa.pageMap.cfg.taxonomyTermDisabled { - return false, nil - } - for _, viewName := range views { vals := types.ToStringSlicePreserveString(getParam(ps, viewName.plural, false)) if vals == nil { @@ -1674,6 +1674,7 @@ func (sa *sitePagesAssembler) assembleTermsAndTranslations() error { }) } } + return false, nil }, } diff --git a/hugolib/page__new.go b/hugolib/page__new.go index 91bfe5e32..7d948ef58 100644 --- a/hugolib/page__new.go +++ b/hugolib/page__new.go @@ -15,6 +15,7 @@ package hugolib import ( "fmt" + "strings" "sync" "sync/atomic" @@ -140,6 +141,7 @@ func (h *HugoSites) doNewPage(m *pageMeta) (*pageState, *paths.Path, error) { } } + var tc viewName // Identify Page Kind. if m.pageConfig.Kind == "" { m.pageConfig.Kind = kinds.KindSection @@ -147,16 +149,13 @@ func (h *HugoSites) doNewPage(m *pageMeta) (*pageState, *paths.Path, error) { m.pageConfig.Kind = kinds.KindHome } else if m.pathInfo.IsBranchBundle() { // A section, taxonomy or term. - tc := m.s.pageMap.cfg.getTaxonomyConfig(m.Path()) + tc = m.s.pageMap.cfg.getTaxonomyConfig(m.Path()) if !tc.IsZero() { // Either a taxonomy or a term. if tc.pluralTreeKey == m.Path() { m.pageConfig.Kind = kinds.KindTaxonomy - m.singular = tc.singular } else { m.pageConfig.Kind = kinds.KindTerm - m.term = m.pathInfo.Unnormalized().BaseNameNoIdentifier() - m.singular = tc.singular } } } else if m.f != nil { @@ -164,6 +163,19 @@ func (h *HugoSites) doNewPage(m *pageMeta) (*pageState, *paths.Path, error) { } } + if m.pageConfig.Kind == kinds.KindTerm || m.pageConfig.Kind == kinds.KindTaxonomy { + if tc.IsZero() { + tc = m.s.pageMap.cfg.getTaxonomyConfig(m.Path()) + } + if tc.IsZero() { + return nil, fmt.Errorf("no taxonomy configuration found for %q", m.Path()) + } + m.singular = tc.singular + if m.pageConfig.Kind == kinds.KindTerm { + m.term = paths.TrimLeading(strings.TrimPrefix(m.pathInfo.Unnormalized().Base(), tc.pluralTreeKey)) + } + } + if m.pageConfig.Kind == kinds.KindPage && !m.s.conf.IsKindEnabled(m.pageConfig.Kind) { return nil, nil } diff --git a/hugolib/pagesfromdata/pagesfromgotmpl_integration_test.go b/hugolib/pagesfromdata/pagesfromgotmpl_integration_test.go index a4cf4dcff..b033aad2b 100644 --- a/hugolib/pagesfromdata/pagesfromgotmpl_integration_test.go +++ b/hugolib/pagesfromdata/pagesfromgotmpl_integration_test.go @@ -678,3 +678,33 @@ summary: {{ .Summary }}|content: {{ .Content}} "

aaa

|content:

aaa

\n

bbb

", ) } + +// Issue 13063. +func TestPagesFromGoTmplTermIsEmpty(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +baseURL = "https://example.com" +disableKinds = ['section', 'home', 'rss','sitemap'] +printPathWarnings = true +[taxonomies] +tag = "tags" +-- content/mypost.md -- +--- +title: "My Post" +tags: ["mytag"] +--- +-- content/tags/_content.gotmpl -- +{{ .AddPage (dict "path" "mothertag" "title" "My title" "kind" "term") }} +-- +-- layouts/_default/taxonomy.html -- +Terms: {{ range .Data.Terms.ByCount }}{{ .Name }}: {{ .Count }}|{{ end }}§s +-- layouts/_default/single.html -- +Single. +` + + b := hugolib.Test(t, files, hugolib.TestOptWarn()) + + b.AssertFileContent("public/tags/index.html", "Terms: mytag: 1|§s") +} From 8d92042ab9a2a8f23640c9babd521ecad134c3ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 18 Nov 2024 17:14:56 +0100 Subject: [PATCH 072/470] dartsass: Fix error message Closes #13065 --- resources/resource_transformers/tocss/dartsass/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/resource_transformers/tocss/dartsass/client.go b/resources/resource_transformers/tocss/dartsass/client.go index 762828b70..470c18b97 100644 --- a/resources/resource_transformers/tocss/dartsass/client.go +++ b/resources/resource_transformers/tocss/dartsass/client.go @@ -52,7 +52,7 @@ func New(fs *filesystems.SourceFilesystem, rs *resources.Spec) (*Client, error) } if !hugo.IsDartSassGeV2() { - return nil, fmt.Errorf("unsupported Dart Sass version detected, please upgrade to Dart Sass 2.0 or later, see https://gohugo.io/functions/css/sass/#dart-sass") + return nil, fmt.Errorf("unsupported Dart Sass version detected, please upgrade to Dart Sass 1.63.0 or later, see https://gohugo.io/functions/css/sass/#dart-sass") } if err := rs.ExecHelper.Sec().CheckAllowedExec(hugo.DartSassBinaryName); err != nil { From dacef0df92a9a20072b4eaa42003e1a63ace8f41 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Mon, 18 Nov 2024 16:17:45 +0000 Subject: [PATCH 073/470] releaser: Bump versions for release of 0.139.0 [ci skip] --- common/hugo/version_current.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 955c2f91a..f988486db 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -19,5 +19,5 @@ var CurrentVersion = Version{ Major: 0, Minor: 139, PatchLevel: 0, - Suffix: "-DEV", + Suffix: "", } From 59a55a1f9e1d0f97f8143d429398355a8a4de251 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Mon, 18 Nov 2024 16:32:01 +0000 Subject: [PATCH 074/470] releaser: Prepare repository for 0.140.0-DEV [ci skip] --- common/hugo/version_current.go | 4 ++-- hugoreleaser.env | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index f988486db..39a350415 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 139, + Minor: 140, PatchLevel: 0, - Suffix: "", + Suffix: "-DEV", } diff --git a/hugoreleaser.env b/hugoreleaser.env index d44c55d03..e9000af65 100644 --- a/hugoreleaser.env +++ b/hugoreleaser.env @@ -1,7 +1,8 @@ # Release env. # These will be replaced by script before release. -HUGORELEASER_TAG=v0.138.0 -HUGORELEASER_COMMITISH=ad82998d54b3f9f8c2741b67356813b55b3134b9 +HUGORELEASER_TAG=v0.139.0 +HUGORELEASER_COMMITISH=dacef0df92a9a20072b4eaa42003e1a63ace8f41 + From 2d4c0c6c8d023f407996d3db5bee70392bb9708f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 19 Nov 2024 10:05:42 +0100 Subject: [PATCH 075/470] readme: Update dependency list --- README.md | 130 ++++++++++++++++-------------------------------------- 1 file changed, 39 insertions(+), 91 deletions(-) diff --git a/README.md b/README.md index 97afe32fd..7dfbca7c1 100644 --- a/README.md +++ b/README.md @@ -149,153 +149,101 @@ Hugo stands on the shoulders of great open source libraries. Run `hugo env --log See current dependencies ```text -cloud.google.com/go/compute/metadata="v0.2.3" -cloud.google.com/go/iam="v1.1.5" -cloud.google.com/go/storage="v1.35.1" -cloud.google.com/go="v0.110.10" -github.com/Azure/azure-sdk-for-go/sdk/azcore="v1.9.0" -github.com/Azure/azure-sdk-for-go/sdk/azidentity="v1.4.0" -github.com/Azure/azure-sdk-for-go/sdk/internal="v1.5.0" -github.com/Azure/azure-sdk-for-go/sdk/storage/azblob="v1.2.0" -github.com/Azure/go-autorest/autorest/to="v0.4.0" -github.com/AzureAD/microsoft-authentication-library-for-go="v1.2.0" github.com/BurntSushi/locker="v0.0.0-20171006230638-a6e239ea1c69" github.com/alecthomas/chroma/v2="v2.14.0" github.com/armon/go-radix="v1.0.1-0.20221118154546-54df44f2176c" -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream="v1.5.4" -github.com/aws/aws-sdk-go-v2/config="v1.26.1" -github.com/aws/aws-sdk-go-v2/credentials="v1.16.12" -github.com/aws/aws-sdk-go-v2/feature/ec2/imds="v1.14.10" -github.com/aws/aws-sdk-go-v2/feature/s3/manager="v1.15.7" -github.com/aws/aws-sdk-go-v2/internal/configsources="v1.3.5" -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2="v2.6.5" -github.com/aws/aws-sdk-go-v2/internal/ini="v1.7.2" -github.com/aws/aws-sdk-go-v2/internal/v4a="v1.2.9" -github.com/aws/aws-sdk-go-v2/service/cloudfront="v1.35.4" -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding="v1.10.4" -github.com/aws/aws-sdk-go-v2/service/internal/checksum="v1.2.9" -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url="v1.10.9" -github.com/aws/aws-sdk-go-v2/service/internal/s3shared="v1.16.9" -github.com/aws/aws-sdk-go-v2/service/s3="v1.47.5" -github.com/aws/aws-sdk-go-v2/service/sso="v1.18.5" -github.com/aws/aws-sdk-go-v2/service/ssooidc="v1.21.5" -github.com/aws/aws-sdk-go-v2/service/sts="v1.26.5" -github.com/aws/aws-sdk-go-v2="v1.26.1" -github.com/aws/aws-sdk-go="v1.50.7" -github.com/aws/smithy-go="v1.20.2" github.com/bep/clocks="v0.5.0" github.com/bep/debounce="v1.2.0" -github.com/bep/gitmap="v1.1.2" +github.com/bep/gitmap="v1.6.0" github.com/bep/goat="v0.5.0" -github.com/bep/godartsass/v2="v2.0.0" -github.com/bep/godartsass="v1.2.0" -github.com/bep/golibsass="v1.1.1" +github.com/bep/godartsass/v2="v2.3.0" +github.com/bep/golibsass="v1.2.0" github.com/bep/gowebp="v0.3.0" -github.com/bep/lazycache="v0.4.0" +github.com/bep/imagemeta="v0.8.3" +github.com/bep/lazycache="v0.7.0" github.com/bep/logg="v0.4.0" github.com/bep/mclib="v1.20400.20402" github.com/bep/overlayfs="v0.9.2" github.com/bep/simplecobra="v0.4.0" github.com/bep/tmc="v0.5.1" +github.com/cespare/xxhash/v2="v2.3.0" github.com/clbanning/mxj/v2="v2.7.0" github.com/cli/safeexec="v1.0.1" -github.com/cpuguy83/go-md2man/v2="v2.0.3" +github.com/cpuguy83/go-md2man/v2="v2.0.4" github.com/disintegration/gift="v1.2.1" github.com/dlclark/regexp2="v1.11.0" -github.com/dustin/go-humanize="v1.0.1" -github.com/evanw/esbuild="v0.21.4" -github.com/fatih/color="v1.16.0" +github.com/evanw/esbuild="v0.24.0" +github.com/fatih/color="v1.18.0" github.com/frankban/quicktest="v1.14.6" -github.com/fsnotify/fsnotify="v1.7.0" +github.com/fsnotify/fsnotify="v1.8.0" github.com/getkin/kin-openapi="v0.123.0" github.com/ghodss/yaml="v1.0.0" github.com/go-openapi/jsonpointer="v0.20.2" github.com/go-openapi/swag="v0.22.8" -github.com/gobuffalo/flect="v1.0.2" +github.com/gobuffalo/flect="v1.0.3" github.com/gobwas/glob="v0.2.3" github.com/gohugoio/go-i18n/v2="v2.1.3-0.20230805085216-e63c13218d0e" +github.com/gohugoio/hashstructure="v0.1.0" github.com/gohugoio/httpcache="v0.7.0" github.com/gohugoio/hugo-goldmark-extensions/extras="v0.2.0" -github.com/gohugoio/hugo-goldmark-extensions/passthrough="v0.2.0" +github.com/gohugoio/hugo-goldmark-extensions/passthrough="v0.3.0" github.com/gohugoio/locales="v0.14.0" github.com/gohugoio/localescompressed="v1.0.1" -github.com/golang-jwt/jwt/v5="v5.1.0" -github.com/golang/groupcache="v0.0.0-20210331224755-41bb18bfe9da" -github.com/golang/protobuf="v1.5.3" github.com/google/go-cmp="v0.6.0" -github.com/google/s2a-go="v0.1.7" -github.com/google/uuid="v1.4.0" -github.com/google/wire="v0.5.0" -github.com/googleapis/enterprise-certificate-proxy="v0.3.2" -github.com/googleapis/gax-go/v2="v2.12.0" -github.com/gorilla/websocket="v1.5.1" -github.com/hairyhenderson/go-codeowners="v0.4.0" +github.com/gorilla/websocket="v1.5.3" +github.com/hairyhenderson/go-codeowners="v0.6.1" github.com/hashicorp/golang-lru/v2="v2.0.7" github.com/invopop/yaml="v0.2.0" github.com/jdkato/prose="v1.2.1" -github.com/jmespath/go-jmespath="v0.4.0" github.com/josharian/intern="v1.0.0" github.com/kr/pretty="v0.3.1" github.com/kr/text="v0.2.0" -github.com/kylelemons/godebug="v1.1.0" -github.com/kyokomi/emoji/v2="v2.2.12" +github.com/kyokomi/emoji/v2="v2.2.13" github.com/mailru/easyjson="v0.7.7" github.com/makeworld-the-better-one/dither/v2="v2.4.0" github.com/marekm4/color-extractor="v1.2.1" github.com/mattn/go-colorable="v0.1.13" github.com/mattn/go-isatty="v0.0.20" github.com/mattn/go-runewidth="v0.0.9" -github.com/mitchellh/hashstructure="v1.1.0" github.com/mitchellh/mapstructure="v1.5.1-0.20231216201459-8508981c8b6c" github.com/mohae/deepcopy="v0.0.0-20170929034955-c48cc78d4826" github.com/muesli/smartcrop="v0.3.0" github.com/niklasfasching/go-org="v1.7.0" github.com/olekukonko/tablewriter="v0.0.5" github.com/pbnjay/memory="v0.0.0-20210728143218-7b4eea64cf58" -github.com/pelletier/go-toml/v2="v2.2.2" +github.com/pelletier/go-toml/v2="v2.2.3" github.com/perimeterx/marshmallow="v1.1.5" -github.com/pkg/browser="v0.0.0-20210911075715-681adbf594b8" +github.com/pkg/browser="v0.0.0-20240102092130-5ac0b6a4141c" github.com/pkg/errors="v0.9.1" -github.com/rogpeppe/go-internal="v1.12.0" +github.com/rogpeppe/go-internal="v1.13.1" github.com/russross/blackfriday/v2="v2.1.0" -github.com/rwcarlsen/goexif="v0.0.0-20190401172101-9e8deecbddbd" -github.com/sass/dart-sass/compiler="1.77.5" -github.com/sass/dart-sass/implementation="1.77.5" -github.com/sass/dart-sass/protocol="2.7.1" -github.com/sass/libsass="3.6.5" +github.com/sass/dart-sass/compiler="1.81.0" +github.com/sass/dart-sass/implementation="1.81.0" +github.com/sass/dart-sass/protocol="3.1.0" github.com/spf13/afero="v1.11.0" -github.com/spf13/cast="v1.6.0" -github.com/spf13/cobra="v1.8.0" +github.com/spf13/cast="v1.7.0" +github.com/spf13/cobra="v1.8.1" github.com/spf13/fsync="v0.10.1" github.com/spf13/pflag="v1.0.5" -github.com/tdewolff/minify/v2="v2.20.20" -github.com/tdewolff/parse/v2="v2.7.13" -github.com/webmproject/libwebp="v1.3.2" -github.com/yuin/goldmark-emoji="v1.0.3" -github.com/yuin/goldmark="v1.7.4" -go.opencensus.io="v0.24.0" +github.com/tdewolff/minify/v2="v2.21.1" +github.com/tdewolff/parse/v2="v2.7.18" +github.com/tetratelabs/wazero="v1.8.1" +github.com/yuin/goldmark-emoji="v1.0.4" +github.com/yuin/goldmark="v1.7.8" go.uber.org/automaxprocs="v1.5.3" -gocloud.dev="v0.36.0" -golang.org/x/crypto="v0.23.0" +golang.org/x/crypto="v0.29.0" golang.org/x/exp="v0.0.0-20221031165847-c99f073a8326" -golang.org/x/image="v0.16.0" -golang.org/x/mod="v0.17.0" -golang.org/x/net="v0.25.0" -golang.org/x/oauth2="v0.15.0" -golang.org/x/sync="v0.7.0" -golang.org/x/sys="v0.20.0" -golang.org/x/text="v0.15.0" -golang.org/x/time="v0.5.0" -golang.org/x/tools="v0.20.0" -golang.org/x/xerrors="v0.0.0-20231012003039-104605ab7028" -google.golang.org/api="v0.152.0" -google.golang.org/genproto/googleapis/api="v0.0.0-20231120223509-83a465c0220f" -google.golang.org/genproto/googleapis/rpc="v0.0.0-20231120223509-83a465c0220f" -google.golang.org/genproto="v0.0.0-20231120223509-83a465c0220f" -google.golang.org/grpc="v1.59.0" -google.golang.org/protobuf="v1.33.0" +golang.org/x/image="v0.22.0" +golang.org/x/mod="v0.22.0" +golang.org/x/net="v0.31.0" +golang.org/x/sync="v0.9.0" +golang.org/x/sys="v0.27.0" +golang.org/x/text="v0.20.0" +golang.org/x/tools="v0.27.0" +google.golang.org/protobuf="v1.35.1" gopkg.in/yaml.v2="v2.4.0" gopkg.in/yaml.v3="v3.0.1" +howett.net/plist="v1.0.0" software.sslmate.com/src/go-pkcs12="v0.2.0" ``` From 8fcd3c148707d8cace2f375e537c30a821ea2516 Mon Sep 17 00:00:00 2001 From: wangjingcun Date: Tue, 19 Nov 2024 18:29:19 +0800 Subject: [PATCH 076/470] common: Fix some GoDoc typos --- common/constants/constants.go | 2 +- common/hugio/readers.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/constants/constants.go b/common/constants/constants.go index 48813e79b..b2cb4fb73 100644 --- a/common/constants/constants.go +++ b/common/constants/constants.go @@ -41,7 +41,7 @@ const ( ResourceTransformationFingerprint = "fingerprint" ) -// IsResourceTransformationLinkChange returns whether the given name is a resource transformation that changes the permalink based on the content. +// IsResourceTransformationPermalinkHash returns whether the given name is a resource transformation that changes the permalink based on the content. func IsResourceTransformationPermalinkHash(name string) bool { return name == ResourceTransformationFingerprint } diff --git a/common/hugio/readers.go b/common/hugio/readers.go index 25e327908..c4304c84e 100644 --- a/common/hugio/readers.go +++ b/common/hugio/readers.go @@ -74,13 +74,13 @@ type StringReader interface { ReadString() string } -// NewReadSeekerNoOpCloserFromString uses strings.NewReader to create a new ReadSeekerNoOpCloser +// NewReadSeekerNoOpCloserFromBytes uses bytes.NewReader to create a new ReadSeekerNoOpCloser // from the given bytes slice. func NewReadSeekerNoOpCloserFromBytes(content []byte) readSeekerNopCloser { return readSeekerNopCloser{bytes.NewReader(content)} } -// NewReadSeekCloser creates a new ReadSeekCloser from the given ReadSeeker. +// NewOpenReadSeekCloser creates a new ReadSeekCloser from the given ReadSeeker. // The ReadSeeker will be seeked to the beginning before returned. func NewOpenReadSeekCloser(r ReadSeekCloser) OpenReadSeekCloser { return func() (ReadSeekCloser, error) { From 8d017a60fb53b3ffb7b57f6c483fe92c3f2813cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 21 Nov 2024 09:48:54 +0100 Subject: [PATCH 077/470] dartsass: Fix nilpointer on Close when Dart Sass isn't installed Fixes #13076 --- .../cssjs/postcss_integration_test.go | 2 +- .../tocss/dartsass/client.go | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/resources/resource_transformers/cssjs/postcss_integration_test.go b/resources/resource_transformers/cssjs/postcss_integration_test.go index e8f52326c..8f2132789 100644 --- a/resources/resource_transformers/cssjs/postcss_integration_test.go +++ b/resources/resource_transformers/cssjs/postcss_integration_test.go @@ -70,7 +70,7 @@ hello: other: "Bonjour" -- layouts/index.html -- {{ $options := dict "inlineImports" true }} -{{ $styles := resources.Get "css/styles.css" | resources.PostCSS $options }} +{{ $styles := resources.Get "css/styles.css" | css.PostCSS $options }} Styles RelPermalink: {{ $styles.RelPermalink }} {{ $cssContent := $styles.Content }} Styles Content: Len: {{ len $styles.Content }}| diff --git a/resources/resource_transformers/tocss/dartsass/client.go b/resources/resource_transformers/tocss/dartsass/client.go index 470c18b97..4ab958c01 100644 --- a/resources/resource_transformers/tocss/dartsass/client.go +++ b/resources/resource_transformers/tocss/dartsass/client.go @@ -44,7 +44,7 @@ const dartSassStdinPrefix = "hugostdin:" func New(fs *filesystems.SourceFilesystem, rs *resources.Spec) (*Client, error) { if !Supports() { - return &Client{dartSassNotAvailable: true}, nil + return &Client{}, nil } if hugo.DartSassBinaryName == "" { @@ -89,22 +89,25 @@ func New(fs *filesystems.SourceFilesystem, rs *resources.Spec) (*Client, error) } type Client struct { - dartSassNotAvailable bool - rs *resources.Spec - sfs *filesystems.SourceFilesystem - workFs afero.Fs + rs *resources.Spec + sfs *filesystems.SourceFilesystem + workFs afero.Fs + // This may be nil if Dart Sass is not available. transpiler *godartsass.Transpiler } func (c *Client) ToCSS(res resources.ResourceTransformer, args map[string]any) (resource.Resource, error) { - if c.dartSassNotAvailable { + if c.transpiler == nil { return res.Transform(resources.NewFeatureNotAvailableTransformer(transformationName, args)) } return res.Transform(&transform{c: c, optsm: args}) } func (c *Client) Close() error { + if c.transpiler == nil { + return nil + } return c.transpiler.Close() } From 5a50eee9da934c01e56e3df4c0c425878bc1caff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 23 Nov 2024 14:28:20 +0100 Subject: [PATCH 078/470] minifiers: Add failing test for upstream bug See #13082 --- minifiers/minifiers_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/minifiers/minifiers_test.go b/minifiers/minifiers_test.go index bfd743fae..b81c632fe 100644 --- a/minifiers/minifiers_test.go +++ b/minifiers/minifiers_test.go @@ -153,10 +153,12 @@ func TestBugs(t *testing.T) { rawString string expectedMinString string }{ - // https://github.com/gohugoio/hugo/issues/5506 + // Issue 5506 {media.Builtin.CSSType, " body { color: rgba(000, 000, 000, 0.7); }", "body{color:rgba(0,0,0,.7)}"}, - // https://github.com/gohugoio/hugo/issues/8332 + // Issue 8332 {media.Builtin.HTMLType, " Tags", ` Tags`}, + // Issue #13082 + {media.Builtin.HTMLType, "", ``}, } { var b bytes.Buffer From aa3dd197f794236ded6393dbb91db91fee288c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 23 Nov 2024 14:29:58 +0100 Subject: [PATCH 079/470] Revert "build(deps): bump github.com/tdewolff/minify/v2 from 2.20.37 to 2.21.1" This reverts commit 7a2f04ee8c3de43f9cc8e0a71fca838125878f8c. Closes #13082 --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 3013813ab..03df8b3db 100644 --- a/go.mod +++ b/go.mod @@ -67,8 +67,8 @@ require ( github.com/spf13/cobra v1.8.1 github.com/spf13/fsync v0.10.1 github.com/spf13/pflag v1.0.5 - github.com/tdewolff/minify/v2 v2.21.1 - github.com/tdewolff/parse/v2 v2.7.18 + github.com/tdewolff/minify/v2 v2.20.37 + github.com/tdewolff/parse/v2 v2.7.15 github.com/tetratelabs/wazero v1.8.1 github.com/yuin/goldmark v1.7.8 github.com/yuin/goldmark-emoji v1.0.4 diff --git a/go.sum b/go.sum index 32005ff6f..2920de0f8 100644 --- a/go.sum +++ b/go.sum @@ -447,10 +447,10 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tdewolff/minify/v2 v2.21.1 h1:AAf5iltw6+KlUvjRNPAPrANIXl3XEJNBBzuZom5iCAM= -github.com/tdewolff/minify/v2 v2.21.1/go.mod h1:PoqFH8ugcuTUvKqVM9vOqXw4msxvuhL/DTmV5ZXhSCI= -github.com/tdewolff/parse/v2 v2.7.18 h1:uSqjEMT2lwCj5oifBHDcWU2kN1pbLrRENgFWDJa57eI= -github.com/tdewolff/parse/v2 v2.7.18/go.mod h1:3FbJWZp3XT9OWVN3Hmfp0p/a08v4h8J9W1aghka0soA= +github.com/tdewolff/minify/v2 v2.20.37 h1:Q97cx4STXCh1dlWDlNHZniE8BJ2EBL0+2b0n92BJQhw= +github.com/tdewolff/minify/v2 v2.20.37/go.mod h1:L1VYef/jwKw6Wwyk5A+T0mBjjn3mMPgmjjA688RNsxU= +github.com/tdewolff/parse/v2 v2.7.15 h1:hysDXtdGZIRF5UZXwpfn3ZWRbm+ru4l53/ajBRGpCTw= +github.com/tdewolff/parse/v2 v2.7.15/go.mod h1:3FbJWZp3XT9OWVN3Hmfp0p/a08v4h8J9W1aghka0soA= github.com/tdewolff/test v1.0.11-0.20231101010635-f1265d231d52/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739 h1:IkjBCtQOOjIn03u/dMQK9g+Iw9ewps4mCl1nB8Sscbo= github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739/go.mod h1:XPuWBzvdUzhCuxWO1ojpXsyzsA5bFoS3tO/Q3kFuTG8= From 21299a7a677287e1ec7a6465f3bb3dd5864826ec Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Sat, 23 Nov 2024 14:13:46 +0000 Subject: [PATCH 080/470] releaser: Bump versions for release of 0.139.1 [ci skip] --- common/hugo/version_current.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 39a350415..605568189 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 140, - PatchLevel: 0, - Suffix: "-DEV", + Minor: 139, + PatchLevel: 1, + Suffix: "", } From e00fdae4562c3329b9d877425c43aa8484784e5c Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Sat, 23 Nov 2024 14:26:42 +0000 Subject: [PATCH 081/470] releaser: Prepare repository for 0.140.0-DEV [ci skip] --- common/hugo/version_current.go | 6 +++--- hugoreleaser.env | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 605568189..39a350415 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 139, - PatchLevel: 1, - Suffix: "", + Minor: 140, + PatchLevel: 0, + Suffix: "-DEV", } diff --git a/hugoreleaser.env b/hugoreleaser.env index e9000af65..b9cc5806c 100644 --- a/hugoreleaser.env +++ b/hugoreleaser.env @@ -1,7 +1,8 @@ # Release env. # These will be replaced by script before release. -HUGORELEASER_TAG=v0.139.0 -HUGORELEASER_COMMITISH=dacef0df92a9a20072b4eaa42003e1a63ace8f41 +HUGORELEASER_TAG=v0.139.1 +HUGORELEASER_COMMITISH=21299a7a677287e1ec7a6465f3bb3dd5864826ec + From 0ab81896d90e0111dc9c9611e9f0eceddd3732b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 23 Nov 2024 16:29:32 +0100 Subject: [PATCH 082/470] modules: Skip empty lines in modules.txt Closes #13084 --- modules/collect.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/collect.go b/modules/collect.go index 4eb12a1a6..7034a6b16 100644 --- a/modules/collect.go +++ b/modules/collect.go @@ -556,6 +556,9 @@ func (c *collector) collectModulesTXT(owner Module) error { line := scanner.Text() line = strings.Trim(line, "# ") line = strings.TrimSpace(line) + if line == "" { + continue + } parts := strings.Fields(line) if len(parts) != 2 { return fmt.Errorf("invalid modules list: %q", filename) From 770f548b47b39e6f0fd4da1cc80552024e5829e1 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Sat, 23 Nov 2024 15:33:51 +0000 Subject: [PATCH 083/470] releaser: Bump versions for release of 0.139.2 [ci skip] --- common/hugo/version_current.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 39a350415..8af8030bb 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 140, - PatchLevel: 0, - Suffix: "-DEV", + Minor: 139, + PatchLevel: 2, + Suffix: "", } From 467444ef649b35676ed5b4198eb8165b347d9119 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Sat, 23 Nov 2024 15:46:37 +0000 Subject: [PATCH 084/470] releaser: Prepare repository for 0.140.0-DEV [ci skip] --- common/hugo/version_current.go | 6 +++--- hugoreleaser.env | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 8af8030bb..39a350415 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 139, - PatchLevel: 2, - Suffix: "", + Minor: 140, + PatchLevel: 0, + Suffix: "-DEV", } diff --git a/hugoreleaser.env b/hugoreleaser.env index b9cc5806c..d76795ecf 100644 --- a/hugoreleaser.env +++ b/hugoreleaser.env @@ -1,7 +1,8 @@ # Release env. # These will be replaced by script before release. -HUGORELEASER_TAG=v0.139.1 -HUGORELEASER_COMMITISH=21299a7a677287e1ec7a6465f3bb3dd5864826ec +HUGORELEASER_TAG=v0.139.2 +HUGORELEASER_COMMITISH=770f548b47b39e6f0fd4da1cc80552024e5829e1 + From dea158c88514afbd24f67558039ec4d20cd5aed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 25 Nov 2024 10:39:17 +0100 Subject: [PATCH 085/470] commands: Fix flaw in the livereload logic I guess most commonly an issue with TailwindCSS editing in templates: * Build changes both CSS and index.html => reload OK. * Build changes both CSS and index.html and some other files => only CSS reloaded. The above would fix itself with one more edit, but that's annoying. --- commands/hugobuilder.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/hugobuilder.go b/commands/hugobuilder.go index 95129018f..51493938d 100644 --- a/commands/hugobuilder.go +++ b/commands/hugobuilder.go @@ -966,7 +966,7 @@ func (c *hugoBuilder) handleEvents(watcher *watcher.Batcher, pathToRefresh := h.PathSpec.RelURL(paths.ToSlashTrimLeading(otherChanges[0]), false) lrl.Logf("refreshing %q", pathToRefresh) livereload.RefreshPath(pathToRefresh) - } else if len(cssChanges) == 0 { + } else if len(cssChanges) == 0 || len(otherChanges) > 1 { lrl.Logf("force refresh") livereload.ForceRefresh() } From 88b7868fbdaf7c84c1dd14712535a593a34e9c3a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 08:30:24 +0000 Subject: [PATCH 086/470] build(deps): bump github.com/tetratelabs/wazero from 1.8.1 to 1.8.2 Bumps [github.com/tetratelabs/wazero](https://github.com/tetratelabs/wazero) from 1.8.1 to 1.8.2. - [Release notes](https://github.com/tetratelabs/wazero/releases) - [Commits](https://github.com/tetratelabs/wazero/compare/v1.8.1...v1.8.2) --- updated-dependencies: - dependency-name: github.com/tetratelabs/wazero dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 03df8b3db..36fdec39d 100644 --- a/go.mod +++ b/go.mod @@ -69,7 +69,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/tdewolff/minify/v2 v2.20.37 github.com/tdewolff/parse/v2 v2.7.15 - github.com/tetratelabs/wazero v1.8.1 + github.com/tetratelabs/wazero v1.8.2 github.com/yuin/goldmark v1.7.8 github.com/yuin/goldmark-emoji v1.0.4 go.uber.org/automaxprocs v1.5.3 diff --git a/go.sum b/go.sum index 2920de0f8..d07cac1bd 100644 --- a/go.sum +++ b/go.sum @@ -129,8 +129,6 @@ github.com/bep/gitmap v1.6.0 h1:sDuQMm9HoTL0LtlrfxjbjgAg2wHQd4nkMup2FInYzhA= github.com/bep/gitmap v1.6.0/go.mod h1:n+3W1f/rot2hynsqEGxGMErPRgT41n9CkGuzPvz9cIw= github.com/bep/goat v0.5.0 h1:S8jLXHCVy/EHIoCY+btKkmcxcXFd34a0Q63/0D4TKeA= github.com/bep/goat v0.5.0/go.mod h1:Md9x7gRxiWKs85yHlVTvHQw9rg86Bm+Y4SuYE8CTH7c= -github.com/bep/godartsass/v2 v2.2.0 h1:3hO9Dt4BOnxkKmRxc+OpoKVFrDvBycpSCXEdElVAMVI= -github.com/bep/godartsass/v2 v2.2.0/go.mod h1:AcP8QgC+OwOXEq6im0WgDRYK7scDsmZCEW62o1prQLo= github.com/bep/godartsass/v2 v2.3.0 h1:gEMyq/bNn4hxpUSwy/NKyOTqPqVh3AedhMHvQR+x0kU= github.com/bep/godartsass/v2 v2.3.0/go.mod h1:AcP8QgC+OwOXEq6im0WgDRYK7scDsmZCEW62o1prQLo= github.com/bep/golibsass v1.2.0 h1:nyZUkKP/0psr8nT6GR2cnmt99xS93Ji82ZD9AgOK6VI= @@ -454,8 +452,8 @@ github.com/tdewolff/parse/v2 v2.7.15/go.mod h1:3FbJWZp3XT9OWVN3Hmfp0p/a08v4h8J9W github.com/tdewolff/test v1.0.11-0.20231101010635-f1265d231d52/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739 h1:IkjBCtQOOjIn03u/dMQK9g+Iw9ewps4mCl1nB8Sscbo= github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739/go.mod h1:XPuWBzvdUzhCuxWO1ojpXsyzsA5bFoS3tO/Q3kFuTG8= -github.com/tetratelabs/wazero v1.8.1 h1:NrcgVbWfkWvVc4UtT4LRLDf91PsOzDzefMdwhLfA550= -github.com/tetratelabs/wazero v1.8.1/go.mod h1:yAI0XTsMBhREkM/YDAK/zNou3GoiAce1P6+rp/wQhjs= +github.com/tetratelabs/wazero v1.8.2 h1:yIgLR/b2bN31bjxwXHD8a3d+BogigR952csSDdLYEv4= +github.com/tetratelabs/wazero v1.8.2/go.mod h1:yAI0XTsMBhREkM/YDAK/zNou3GoiAce1P6+rp/wQhjs= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= From 7e130e34f202d400891cd2acaaf196c049b17f7f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 08:22:59 +0000 Subject: [PATCH 087/470] build(deps): bump github.com/bep/godartsass/v2 from 2.3.0 to 2.3.1 Bumps [github.com/bep/godartsass/v2](https://github.com/bep/godartsass) from 2.3.0 to 2.3.1. - [Release notes](https://github.com/bep/godartsass/releases) - [Commits](https://github.com/bep/godartsass/compare/v2.3.0...v2.3.1) --- updated-dependencies: - dependency-name: github.com/bep/godartsass/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 36fdec39d..a82ecb5f8 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/bep/debounce v1.2.0 github.com/bep/gitmap v1.6.0 github.com/bep/goat v0.5.0 - github.com/bep/godartsass/v2 v2.3.0 + github.com/bep/godartsass/v2 v2.3.1 github.com/bep/golibsass v1.2.0 github.com/bep/gowebp v0.3.0 github.com/bep/helpers v0.5.0 diff --git a/go.sum b/go.sum index d07cac1bd..e60627e68 100644 --- a/go.sum +++ b/go.sum @@ -129,8 +129,8 @@ github.com/bep/gitmap v1.6.0 h1:sDuQMm9HoTL0LtlrfxjbjgAg2wHQd4nkMup2FInYzhA= github.com/bep/gitmap v1.6.0/go.mod h1:n+3W1f/rot2hynsqEGxGMErPRgT41n9CkGuzPvz9cIw= github.com/bep/goat v0.5.0 h1:S8jLXHCVy/EHIoCY+btKkmcxcXFd34a0Q63/0D4TKeA= github.com/bep/goat v0.5.0/go.mod h1:Md9x7gRxiWKs85yHlVTvHQw9rg86Bm+Y4SuYE8CTH7c= -github.com/bep/godartsass/v2 v2.3.0 h1:gEMyq/bNn4hxpUSwy/NKyOTqPqVh3AedhMHvQR+x0kU= -github.com/bep/godartsass/v2 v2.3.0/go.mod h1:AcP8QgC+OwOXEq6im0WgDRYK7scDsmZCEW62o1prQLo= +github.com/bep/godartsass/v2 v2.3.1 h1:Lh9v0IxAaB+toyZrZ+XYNYcGXI1PzGzvZ4u8tRWTnLw= +github.com/bep/godartsass/v2 v2.3.1/go.mod h1:AcP8QgC+OwOXEq6im0WgDRYK7scDsmZCEW62o1prQLo= github.com/bep/golibsass v1.2.0 h1:nyZUkKP/0psr8nT6GR2cnmt99xS93Ji82ZD9AgOK6VI= github.com/bep/golibsass v1.2.0/go.mod h1:DL87K8Un/+pWUS75ggYv41bliGiolxzDKWJAq3eJ1MA= github.com/bep/gowebp v0.3.0 h1:MhmMrcf88pUY7/PsEhMgEP0T6fDUnRTMpN8OclDrbrY= From fc3d1cbadb48d5f8e10fcd811377de6b8453ea8d Mon Sep 17 00:00:00 2001 From: huajin tong <137764712+thirdkeyword@users.noreply.github.com> Date: Thu, 28 Nov 2024 18:20:02 +0800 Subject: [PATCH 088/470] Fix some typos --- common/hugo/hugo.go | 2 +- hugolib/doctree/nodeshifttree.go | 2 +- markup/blackfriday/anchors.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go index 11ec40e0b..e480baa94 100644 --- a/common/hugo/hugo.go +++ b/common/hugo/hugo.go @@ -426,7 +426,7 @@ func DeprecateLevel(item, alternative, version string, level logg.Level) { loggers.Log().Logger().WithLevel(level).WithField(loggers.FieldNameCmd, "deprecated").Logf(msg) } -// We ususally do about one minor version a month. +// We usually do about one minor version a month. // We want people to run at least the current and previous version without any warnings. // We want people who don't update Hugo that often to see the warnings and errors before we remove the feature. func deprecationLogLevelFromVersion(ver string) logg.Level { diff --git a/hugolib/doctree/nodeshifttree.go b/hugolib/doctree/nodeshifttree.go index 36382c2d7..497e9f02e 100644 --- a/hugolib/doctree/nodeshifttree.go +++ b/hugolib/doctree/nodeshifttree.go @@ -59,7 +59,7 @@ type ( ) // NodeShiftTree is the root of a tree that can be shaped using the Shape method. -// Note that multipled shapes of the same tree is meant to be used concurrently, +// Note that multiplied shapes of the same tree is meant to be used concurrently, // so use the applicable locking when needed. type NodeShiftTree[T any] struct { tree *radix.Tree diff --git a/markup/blackfriday/anchors.go b/markup/blackfriday/anchors.go index 7b0b41854..e00c24c9a 100644 --- a/markup/blackfriday/anchors.go +++ b/markup/blackfriday/anchors.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package blackfriday holds some compability functions for the old Blackfriday v1 Markdown engine. +// Package blackfriday holds some compatibility functions for the old Blackfriday v1 Markdown engine. package blackfriday import "unicode" From c1dc35dd712fc926cc7eaa2bf607fb4716794dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 29 Nov 2024 12:13:49 +0100 Subject: [PATCH 089/470] Fix server edits of resources included in shortcode/hooks Fixes #13093 --- hugolib/page__content.go | 4 +++ hugolib/rebuild_test.go | 77 ++++++++++++++++++++++++++++++++++------ identity/finder.go | 25 ++++++++----- tpl/template.go | 1 - 4 files changed, 86 insertions(+), 21 deletions(-) diff --git a/hugolib/page__content.go b/hugolib/page__content.go index 4ec91f7b5..b5527a281 100644 --- a/hugolib/page__content.go +++ b/hugolib/page__content.go @@ -863,6 +863,10 @@ type cachedContentScope struct { } func (c *cachedContentScope) prepareContext(ctx context.Context) context.Context { + // A regular page's shortcode etc. may be rendered by e.g. the home page, + // so we need to track any changes to this content's page. + ctx = tpl.Context.DependencyManagerScopedProvider.Set(ctx, c.pco.po.p) + // The markup scope is recursive, so if already set to a non zero value, preserve that value. if s := hugo.GetMarkupScope(ctx); s != "" || s == c.scope { return ctx diff --git a/hugolib/rebuild_test.go b/hugolib/rebuild_test.go index 2219fe812..ff1f8267e 100644 --- a/hugolib/rebuild_test.go +++ b/hugolib/rebuild_test.go @@ -21,8 +21,13 @@ const rebuildFilesSimple = ` baseURL = "https://example.com" disableKinds = ["term", "taxonomy", "sitemap", "robotstxt", "404"] disableLiveReload = true +[outputFormats] + [outputFormats.rss] + weight = 10 + [outputFormats.html] + weight = 20 [outputs] -home = ["html"] +home = ["rss", "html"] section = ["html"] page = ["html"] -- content/mysection/_index.md -- @@ -58,6 +63,21 @@ Home Text Content. title: "myothersectionpage" --- myothersectionpage Content. +-- content/mythirdsection/mythirdsectionpage.md -- +--- +title: "mythirdsectionpage" +--- +mythirdsectionpage Content. +{{< myshortcodetext >}} +§§§ myothertext +foo +§§§ +-- assets/mytext.txt -- +Assets My Text. +-- assets/myshortcodetext.txt -- +Assets My Shortcode Text. +-- assets/myothertext.txt -- +Assets My Other Text. -- layouts/_default/single.html -- Single: {{ .Title }}|{{ .Content }}$ Resources: {{ range $i, $e := .Resources }}{{ $i }}:{{ .RelPermalink }}|{{ .Content }}|{{ end }}$ @@ -68,6 +88,13 @@ Len Resources: {{ len .Resources }}| Resources: {{ range $i, $e := .Resources }}{{ $i }}:{{ .RelPermalink }}|{{ .Content }}|{{ end }}$ -- layouts/shortcodes/foo.html -- Foo. +-- layouts/shortcodes/myshortcodetext.html -- +{{ warnf "mytext %s" now}} +{{ $r := resources.Get "myshortcodetext.txt" }} +My Shortcode Text: {{ $r.Content }}|{{ $r.Permalink }}| +-- layouts/_default/_markup/render-codeblock-myothertext.html -- +{{ $r := resources.Get "myothertext.txt" }} +My Other Text: {{ $r.Content }}|{{ $r.Permalink }}| ` @@ -83,6 +110,34 @@ func TestRebuildEditTextFileInLeafBundle(t *testing.T) { b.AssertRenderCountContent(1) } +func TestRebuildEditTextFileInShortcode(t *testing.T) { + t.Parallel() + for i := 0; i < 3; i++ { + b := TestRunning(t, rebuildFilesSimple) + b.AssertFileContent("public/mythirdsection/mythirdsectionpage/index.html", + "Text: Assets My Shortcode Text.") + b.EditFileReplaceAll("assets/myshortcodetext.txt", "My Shortcode Text", "My Shortcode Text Edited").Build() + fmt.Println(b.LogString()) + b.AssertFileContent("public/mythirdsection/mythirdsectionpage/index.html", + "Text: Assets My Shortcode Text Edited.") + + } +} + +func TestRebuildEditTextFileInHook(t *testing.T) { + t.Parallel() + for i := 0; i < 3; i++ { + b := TestRunning(t, rebuildFilesSimple) + b.AssertFileContent("public/mythirdsection/mythirdsectionpage/index.html", + "Text: Assets My Other Text.") + b.AssertFileContent("public/myothertext.txt", "Assets My Other Text.") + b.EditFileReplaceAll("assets/myothertext.txt", "My Other Text", "My Other Text Edited").Build() + b.AssertFileContent("public/mythirdsection/mythirdsectionpage/index.html", + "Text: Assets My Other Text Edited.") + + } +} + func TestRebuiEditUnmarshaledYamlFileInLeafBundle(t *testing.T) { files := ` -- hugo.toml -- @@ -140,8 +195,8 @@ func TestRebuildRenameTextFileInLeafBundle(t *testing.T) { b.RenameFile("content/mysection/mysectionbundle/mysectionbundletext.txt", "content/mysection/mysectionbundle/mysectionbundletext2.txt").Build() b.AssertFileContent("public/mysection/mysectionbundle/index.html", "mysectionbundletext2", "My Section Bundle Text 2 Content.", "Len Resources: 2|") - b.AssertRenderCountPage(5) - b.AssertRenderCountContent(6) + b.AssertRenderCountPage(8) + b.AssertRenderCountContent(8) }) } @@ -161,8 +216,8 @@ func TestRebuilEditContentFileThenAnother(t *testing.T) { b.EditFileReplaceAll("content/myothersection/myothersectionpage.md", "myothersectionpage Content.", "myothersectionpage Content Edited.").Build() b.AssertFileContent("public/myothersection/myothersectionpage/index.html", "myothersectionpage Content Edited") - b.AssertRenderCountPage(1) - b.AssertRenderCountContent(1) + b.AssertRenderCountPage(2) + b.AssertRenderCountContent(2) } func TestRebuildRenameTextFileInBranchBundle(t *testing.T) { @@ -171,7 +226,7 @@ func TestRebuildRenameTextFileInBranchBundle(t *testing.T) { b.RenameFile("content/mysection/mysectiontext.txt", "content/mysection/mysectiontext2.txt").Build() b.AssertFileContent("public/mysection/index.html", "mysectiontext2", "My Section") - b.AssertRenderCountPage(2) + b.AssertRenderCountPage(3) b.AssertRenderCountContent(2) } @@ -181,14 +236,14 @@ func TestRebuildRenameTextFileInHomeBundle(t *testing.T) { b.RenameFile("content/hometext.txt", "content/hometext2.txt").Build() b.AssertFileContent("public/index.html", "hometext2", "Home Text Content.") - b.AssertRenderCountPage(3) + b.AssertRenderCountPage(5) } func TestRebuildRenameDirectoryWithLeafBundle(t *testing.T) { b := TestRunning(t, rebuildFilesSimple) b.RenameDir("content/mysection/mysectionbundle", "content/mysection/mysectionbundlerenamed").Build() b.AssertFileContent("public/mysection/mysectionbundlerenamed/index.html", "My Section Bundle") - b.AssertRenderCountPage(1) + b.AssertRenderCountPage(2) } func TestRebuildRenameDirectoryWithBranchBundle(t *testing.T) { @@ -197,7 +252,7 @@ func TestRebuildRenameDirectoryWithBranchBundle(t *testing.T) { b.AssertFileContent("public/mysectionrenamed/index.html", "My Section") b.AssertFileContent("public/mysectionrenamed/mysectionbundle/index.html", "My Section Bundle") b.AssertFileContent("public/mysectionrenamed/mysectionbundle/mysectionbundletext.txt", "My Section Bundle Text 2 Content.") - b.AssertRenderCountPage(3) + b.AssertRenderCountPage(5) } func TestRebuildRenameDirectoryWithRegularPageUsedInHome(t *testing.T) { @@ -296,7 +351,7 @@ func TestRebuildRenameDirectoryWithBranchBundleFastRender(t *testing.T) { b.AssertFileContent("public/mysectionrenamed/index.html", "My Section") b.AssertFileContent("public/mysectionrenamed/mysectionbundle/index.html", "My Section Bundle") b.AssertFileContent("public/mysectionrenamed/mysectionbundle/mysectionbundletext.txt", "My Section Bundle Text 2 Content.") - b.AssertRenderCountPage(3) + b.AssertRenderCountPage(5) } func TestRebuilErrorRecovery(t *testing.T) { @@ -1239,7 +1294,7 @@ Single. return strings.Replace(s, "red", "blue", 1) }).Build() - b.AssertRenderCountPage(3) + b.AssertRenderCountPage(4) b.AssertFileContent("public/index.html", "Home.", "") } diff --git a/identity/finder.go b/identity/finder.go index 91fac7237..b1a08d061 100644 --- a/identity/finder.go +++ b/identity/finder.go @@ -122,17 +122,21 @@ func (f *Finder) Contains(id, in Identity, maxDepth int) FinderResult { defer putSearchID(sid) - if r := f.checkOne(sid, in, 0); r > 0 { + r := FinderNotFound + if i := f.checkOne(sid, in, 0); i > r { + r = i + } + if r == FinderFound { return r } m := GetDependencyManager(in) if m != nil { - if r := f.checkManager(sid, m, 0); r > 0 { - return r + if i := f.checkManager(sid, m, 0); i > r { + r = i } } - return FinderNotFound + return r } func (f *Finder) checkMaxDepth(sid *searchID, level int) FinderResult { @@ -279,15 +283,18 @@ func (f *Finder) search(sid *searchID, m Manager, depth int) FinderResult { var r FinderResult m.forEeachIdentity( func(v Identity) bool { - if r > 0 { - panic("should be terminated") + i := f.checkOne(sid, v, depth) + if i > r { + r = i } - r = f.checkOne(sid, v, depth) - if r > 0 { + if r == FinderFound { return true } m := GetDependencyManager(v) - if r = f.checkManager(sid, m, depth+1); r > 0 { + if i := f.checkManager(sid, m, depth+1); i > r { + r = i + } + if r == FinderFound { return true } return false diff --git a/tpl/template.go b/tpl/template.go index 18a31e231..39c6b4f1c 100644 --- a/tpl/template.go +++ b/tpl/template.go @@ -172,7 +172,6 @@ type contextKey string var Context = struct { DependencyManagerScopedProvider hcontext.ContextDispatcher[identity.DependencyManagerScopedProvider] GetDependencyManagerInCurrentScope func(context.Context) identity.Manager - SetDependencyManagerInCurrentScope func(context.Context, identity.Manager) context.Context DependencyScope hcontext.ContextDispatcher[int] Page hcontext.ContextDispatcher[page] IsInGoldmark hcontext.ContextDispatcher[bool] From 2f6864387cd31b975914e8373d4bf38bddbd47bc Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Fri, 29 Nov 2024 15:36:56 +0000 Subject: [PATCH 090/470] releaser: Bump versions for release of 0.139.3 [ci skip] --- common/hugo/version_current.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index 39a350415..b69c55775 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 140, - PatchLevel: 0, - Suffix: "-DEV", + Minor: 139, + PatchLevel: 3, + Suffix: "", } From 487bb96474363070a9b5b22ce4640f80329e91e4 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Fri, 29 Nov 2024 15:51:07 +0000 Subject: [PATCH 091/470] releaser: Prepare repository for 0.140.0-DEV [ci skip] --- common/hugo/version_current.go | 6 +++--- hugoreleaser.env | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index b69c55775..39a350415 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,7 +17,7 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Major: 0, - Minor: 139, - PatchLevel: 3, - Suffix: "", + Minor: 140, + PatchLevel: 0, + Suffix: "-DEV", } diff --git a/hugoreleaser.env b/hugoreleaser.env index d76795ecf..4c8ed54a6 100644 --- a/hugoreleaser.env +++ b/hugoreleaser.env @@ -1,7 +1,8 @@ # Release env. # These will be replaced by script before release. -HUGORELEASER_TAG=v0.139.2 -HUGORELEASER_COMMITISH=770f548b47b39e6f0fd4da1cc80552024e5829e1 +HUGORELEASER_TAG=v0.139.3 +HUGORELEASER_COMMITISH=2f6864387cd31b975914e8373d4bf38bddbd47bc + From b529859008fae916a0509645da539072e62dfcb1 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Wed, 4 Dec 2024 09:21:21 -0800 Subject: [PATCH 092/470] markup/tableofcontents: Cast Fragments.ToHTML args to int Closes #13107 --- hugolib/page__content.go | 13 ++-- markup/goldmark/convert_test.go | 4 +- markup/tableofcontents/tableofcontents.go | 23 ++++-- .../tableofcontents_integration_test.go | 78 +++++++++++++++++++ .../tableofcontents/tableofcontents_test.go | 24 ++++-- 5 files changed, 120 insertions(+), 22 deletions(-) diff --git a/hugolib/page__content.go b/hugolib/page__content.go index b5527a281..f7579f182 100644 --- a/hugolib/page__content.go +++ b/hugolib/page__content.go @@ -730,16 +730,15 @@ func (c *cachedContentScope) contentToC(ctx context.Context) (contentTableOfCont isHTML := cp.po.p.m.pageConfig.ContentMediaType.IsHTML() if !isHTML { - createAndSetToC := func(tocProvider converter.TableOfContentsProvider) { + createAndSetToC := func(tocProvider converter.TableOfContentsProvider) error { cfg := p.s.ContentSpec.Converters.GetMarkupConfig() ct.tableOfContents = tocProvider.TableOfContents() - ct.tableOfContentsHTML = template.HTML( - ct.tableOfContents.ToHTML( - cfg.TableOfContents.StartLevel, - cfg.TableOfContents.EndLevel, - cfg.TableOfContents.Ordered, - ), + ct.tableOfContentsHTML, err = ct.tableOfContents.ToHTML( + cfg.TableOfContents.StartLevel, + cfg.TableOfContents.EndLevel, + cfg.TableOfContents.Ordered, ) + return err } // If the converter supports doing the parsing separately, we do that. diff --git a/markup/goldmark/convert_test.go b/markup/goldmark/convert_test.go index 6048bce39..a35441aff 100644 --- a/markup/goldmark/convert_test.go +++ b/markup/goldmark/convert_test.go @@ -208,8 +208,8 @@ unsafe = true toc, ok := b.(converter.TableOfContentsProvider) c.Assert(ok, qt.Equals, true) - tocString := string(toc.TableOfContents().ToHTML(1, 2, false)) - c.Assert(tocString, qt.Contains, "TableOfContents") + tocHTML, _ := toc.TableOfContents().ToHTML(1, 2, false) + c.Assert(string(tocHTML), qt.Contains, "TableOfContents") } func TestConvertAutoIDAsciiOnly(t *testing.T) { diff --git a/markup/tableofcontents/tableofcontents.go b/markup/tableofcontents/tableofcontents.go index 49a9cdeb7..560e421b7 100644 --- a/markup/tableofcontents/tableofcontents.go +++ b/markup/tableofcontents/tableofcontents.go @@ -14,11 +14,13 @@ package tableofcontents import ( + "fmt" "html/template" "sort" "strings" "github.com/gohugoio/hugo/common/collections" + "github.com/spf13/cast" ) // Empty is an empty ToC. @@ -133,19 +135,30 @@ func (toc *Fragments) addAt(h *Heading, row, level int) { } // ToHTML renders the ToC as HTML. -func (toc *Fragments) ToHTML(startLevel, stopLevel int, ordered bool) template.HTML { +func (toc *Fragments) ToHTML(startLevel, stopLevel any, ordered bool) (template.HTML, error) { if toc == nil { - return "" + return "", nil } + + iStartLevel, err := cast.ToIntE(startLevel) + if err != nil { + return "", fmt.Errorf("startLevel: %w", err) + } + + iStopLevel, err := cast.ToIntE(stopLevel) + if err != nil { + return "", fmt.Errorf("stopLevel: %w", err) + } + b := &tocBuilder{ s: strings.Builder{}, h: toc.Headings, - startLevel: startLevel, - stopLevel: stopLevel, + startLevel: iStartLevel, + stopLevel: iStopLevel, ordered: ordered, } b.Build() - return template.HTML(b.s.String()) + return template.HTML(b.s.String()), nil } func (toc Fragments) walk(fn func(*Heading)) { diff --git a/markup/tableofcontents/tableofcontents_integration_test.go b/markup/tableofcontents/tableofcontents_integration_test.go index 87a7c0108..e6ae03ce2 100644 --- a/markup/tableofcontents/tableofcontents_integration_test.go +++ b/markup/tableofcontents/tableofcontents_integration_test.go @@ -14,6 +14,7 @@ package tableofcontents_test import ( + "strings" "testing" "github.com/gohugoio/hugo/hugolib" @@ -43,3 +44,80 @@ disableKinds = ['page','rss','section','sitemap','taxonomy','term'] "heading-l5|5|Heading L5", ) } + +// Issue #13107 +func TestToHTMLArgTypes(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableKinds = ['home','section','rss','sitemap','taxonomy','term'] +-- layouts/_default/single.html -- +{{ .Fragments.ToHTML .Params.toc.startLevel .Params.toc.endLevel false }} +-- content/json.md -- +{ + "title": "json", + "params": { + "toc": { + "startLevel": 2, + "endLevel": 4 + } + } +} +CONTENT +-- content/toml.md -- ++++ +title = 'toml' +[params.toc] +startLevel = 2 +endLevel = 4 ++++ +CONTENT +-- content/yaml.md -- +--- +title: yaml +params: + toc: + startLevel: 2 + endLevel: 4 +--- +CONTENT +` + + content := ` +# Level One +## Level Two +### Level Three +#### Level Four +##### Level Five +###### Level Six + ` + + want := ` + +` + + files = strings.ReplaceAll(files, "CONTENT", content) + + b := hugolib.Test(t, files) + b.AssertFileContentEquals("public/json/index.html", strings.TrimSpace(want)) + b.AssertFileContentEquals("public/toml/index.html", strings.TrimSpace(want)) + b.AssertFileContentEquals("public/yaml/index.html", strings.TrimSpace(want)) + + files = strings.ReplaceAll(files, `2`, `"x"`) + + b, _ = hugolib.TestE(t, files) + b.AssertLogMatches(`error calling ToHTML: startLevel: unable to cast "x" of type string`) +} diff --git a/markup/tableofcontents/tableofcontents_test.go b/markup/tableofcontents/tableofcontents_test.go index 3af9c4eb6..9ec7ec293 100644 --- a/markup/tableofcontents/tableofcontents_test.go +++ b/markup/tableofcontents/tableofcontents_test.go @@ -45,7 +45,8 @@ func TestToc(t *testing.T) { toc.addAt(&Heading{Title: "1-H3-1", ID: "1-h2-2"}, 0, 2) toc.addAt(&Heading{Title: "Heading 2", ID: "h1-2"}, 1, 0) - got := string(toc.ToHTML(1, -1, false)) + tocHTML, _ := toc.ToHTML(1, -1, false) + got := string(tocHTML) c.Assert(got, qt.Equals, ``, qt.Commentf(got)) - got = string(toc.ToHTML(1, 1, false)) + tocHTML, _ = toc.ToHTML(1, 1, false) + got = string(tocHTML) c.Assert(got, qt.Equals, ``, qt.Commentf(got)) - got = string(toc.ToHTML(1, 2, false)) + tocHTML, _ = toc.ToHTML(1, 2, false) + got = string(tocHTML) c.Assert(got, qt.Equals, ``, qt.Commentf(got)) - got = string(toc.ToHTML(2, 2, false)) + tocHTML, _ = toc.ToHTML(2, 2, false) + got = string(tocHTML) c.Assert(got, qt.Equals, ``, qt.Commentf(got)) - got = string(toc.ToHTML(1, -1, true)) + tocHTML, _ = toc.ToHTML(1, -1, true) + got = string(tocHTML) c.Assert(got, qt.Equals, `