Commit graph

7493 commits

Author SHA1 Message Date
Joe Mooring
4ccc8cfb4c Fix description of collections.Uniq 2023-01-31 08:12:45 +01:00
Bjørn Erik Pedersen
e2cfc3d5a2
Update CONTRIBUTING.md 2023-01-31 08:08:52 +01:00
Bjørn Erik Pedersen
168858331f Fix shortcode detection in RenderString
Fixes #10654
2023-01-26 11:41:07 +01:00
Bjørn Erik Pedersen
4ef9baf5bd Only invoke a given cached partial once
Note that this is backed by a LRU cache (which we soon shall see more usage of), so if you're a heavy user of cached partials it may be evicted and
refreshed if needed. But in most cases every partial is only invoked once.

This commit also adds a timeout (the global `timeout` config option) to make infinite recursion in partials
easier to reason about.

```
name              old time/op    new time/op    delta
IncludeCached-10    8.92ms ± 0%    8.48ms ± 1%   -4.87%  (p=0.016 n=4+5)

name              old alloc/op   new alloc/op   delta
IncludeCached-10    6.65MB ± 0%    5.17MB ± 0%  -22.32%  (p=0.002 n=6+6)

name              old allocs/op  new allocs/op  delta
IncludeCached-10      117k ± 0%       71k ± 0%  -39.44%  (p=0.002 n=6+6)
```

Closes #4086
Updates #9588
2023-01-25 17:35:23 +01:00
Bjørn Erik Pedersen
93ed6e447a
Update README.md 2023-01-24 15:04:06 +01:00
hugoreleaser
0d1161b263 releaser: Prepare repository for 0.111.0-DEV
[ci skip]
2023-01-17 12:28:17 +00:00
hugoreleaser
e32a493b78 releaser: Bump versions for release of 0.110.0
[ci skip]
2023-01-17 12:16:09 +00:00
Bjørn Erik Pedersen
19e9605629
dos: Regen CLI docs 2023-01-17 12:52:53 +01:00
Bjørn Erik Pedersen
80e8bd3b72
docs: Regen docshelper 2023-01-17 12:52:08 +01:00
Bjørn Erik Pedersen
b661132e0a
Merge commit 'ef6f101e75256c3bb88a6f1f3b5c1273bf8d7382' 2023-01-17 12:51:46 +01:00
Bjørn Erik Pedersen
ef6f101e75 Squashed 'docs/' changes from 2c0125b52..1214f6ffb
1214f6ffb Document cleanDestinationDir configuration setting
27ca65463 Clarify .Page.Param method (#1953)
3fa1792d2 Document the usage of `hardWrap` option for markdown rendering (#1951)
8b5afdfb4 Update theme
207e7f0a0 fix docs for getting remote font
1f7094b9e Correct typo
f9d6445c4 Added missing `/` in URL generator (#1946)
3a22ee7d6 Remove translations
b3b900f3f Update introduction.md
aca440052 rm Forestry - facing end-of-life shortly (#1944)
af0014e14 Update scss-sass.md
1c43bbbc9 Merge branch 'docs/goworkspace'
d034175ca netlify: Hugo 0.109.0
d3a6a5c3f Merge branch 'tempv0.109.0'
e033dbead docs: Regen docs helper JSON
452bf675c resource/page: Add Page.Ancestors
12edd7363 Add some docs for workspaces
8f0fcba6b Add HUGO_PUBLISHDIR to the Node environment
4e66d98ad Update theme
808aee6f6 config: Update to ga v4
1de2bc5a9 config: Update to ga v4
ddb5fd6b0 Merge commit '41bc6f702aa54200530efbf4267e5c823df3028d'
54c54bf76 modules: Adjust watch logic vs workspace use definitions

git-subtree-dir: docs
git-subtree-split: 1214f6ffbf680e853746aaeb6cb097b28c0c556b
2023-01-17 12:51:01 +01:00
Bjørn Erik Pedersen
d595419031
related: Handly []any
See #10624
2023-01-17 12:50:26 +01:00
Bjørn Erik Pedersen
671f64b2eb Fix permalinks issue with repeated sections
Fixes #10377
2023-01-17 12:49:16 +01:00
Bjørn Erik Pedersen
2fb40ece5d tpl/strings: Add findRESubmatch
Fixes #10594
2023-01-17 12:14:11 +01:00
Bjørn Erik Pedersen
c6b3887696
config/security: Add O\w+ (e.g. GOROOT) to the default allowed list
Fixes #10429
2023-01-17 10:52:51 +01:00
Bjørn Erik Pedersen
21af5b359f Preserve front matter slice value types (e.g. int)
Fixes #10624
2023-01-17 08:58:05 +01:00
Bjørn Erik Pedersen
f38a2fbd2e Make hugo.toml the new config.toml
Both will of course work, but hugo.toml will win if both are set.

We should have done this a long time ago, of course, but the reason I'm picking this up now is that my VS Code setup by default picks up some
JSON config schema from some random other software which also names its config files config.toml.

Fixes #8979
2023-01-16 15:34:16 +01:00
Bjørn Erik Pedersen
6a579ebac3 Add fill HTTP Response info into .Data in resources.GetRemote
See #10604
2023-01-16 14:44:15 +01:00
Bjørn Erik Pedersen
f13531e608 Fix HEAD method in resources.GetRemote
Fixes #10604
2023-01-16 14:44:15 +01:00
Bjørn Erik Pedersen
b5d485060f Fix order when reading custom headers in resources.GetRemote
Fixes #10616
2023-01-16 14:44:15 +01:00
Bjørn Erik Pedersen
6e9fa9e0fd deps: Upgrade github.com/evanw/esbuild v0.15.18 => v0.17.0
Also add a test to make sure legal comments are preserved in JS bundles.

Closes #10536
2023-01-16 14:41:13 +01:00
Bjørn Erik Pedersen
c4f3a46ce6
Update README.md 2023-01-09 14:13:30 +01:00
Bjørn Erik Pedersen
fbc3e08c64
resource: Fix Go Doc vs .Data.Integrity 2023-01-07 10:58:34 +01:00
Bjørn Erik Pedersen
e402d91ee1 Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
Bjørn Erik Pedersen
3c51625c71 Make readFile return nil when file not found (note)
Fixes #9620
2023-01-04 18:01:26 +01:00
Omar Kohl
dd6d0a6de1 Remove reference to Goreleaser in code comment
Hugo no longer uses the Goreleaser tool.
2023-01-03 20:25:44 +01:00
acclassic
f95fd57aac
tpl/compare: Sort special float values as string
When sorting strings a worng order is returned. This happens because the strings are first converted
to floating values to check whether or not they should be sorted as
floating values. When an error is returned the strings will be
handled as string literals.
No error will be returned when parsing Inf, Infinity or NaN (case insensitive) because they
will be coverted to special floating point values and therefore are
legal float values.
Now we check if the returned converted values are special floating
values and treat them as string literals.

Fixes #10389
2023-01-02 17:35:08 +01:00
Bjørn Erik Pedersen
e754d5cb3e
tpl/diagrams: Move Goat to its own file 2022-12-25 14:02:22 +01:00
Bjørn Erik Pedersen
002cd52807
Update CONTRIBUTING.md 2022-12-24 15:53:27 +01:00
Bjørn Erik Pedersen
a76c405d40
Update CONTRIBUTING.md 2022-12-24 15:49:00 +01:00
Bjørn Erik Pedersen
c0a03a2a39
Update README.md 2022-12-24 15:48:45 +01:00
hugoreleaser
e127d3e5c6 releaser: Prepare repository for 0.110.0-DEV
[ci skip]
2022-12-23 10:50:52 +00:00
hugoreleaser
47b12b83e6 releaser: Bump versions for release of 0.109.0
[ci skip]
2022-12-23 10:38:11 +00:00
Bjørn Erik Pedersen
180dfeba03
Adjust "you need the extended version" error message 2022-12-23 10:33:49 +01:00
Bjørn Erik Pedersen
10bb29d7f3
docs: Regen docs helper JSON 2022-12-23 10:15:48 +01:00
Bjørn Erik Pedersen
eb0c8f9d02 resource/page: Slight adjustment of Page.Ancestors
Fixes #10567
2022-12-23 10:14:53 +01:00
Septs
3a216186b2 resource/page: Add Page.Ancestors
Fixes #10567
2022-12-23 10:14:53 +01:00
dependabot[bot]
7874b96815 build(deps): bump golang.org/x/tools from 0.3.0 to 0.4.0
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-23 09:26:10 +01:00
Joe Mooring
71832328f8 Annotate test assertions 2022-12-22 18:53:12 +01:00
Joe Mooring
37ab1cf12a hugolib: Exclude non-linkable pages from translations map
Fixes #9073
2022-12-22 18:53:12 +01:00
Bjørn Erik Pedersen
59af05cabc Add HUGO_PUBLISHDIR to the Node environment
So you can do  `process.env.HUGO_PUBLISHDIR` in your `postcss.config.js` to figure out where Hugo publishes
its files.

Note that the value will always be an absolute file path and will point to a directory on disk even when running `hugo server` in memory mode.

If you write to this folder from PostCSS when running the server, you could run the server with one of these flags:

```
hugo server --renderToDisk
hugo server --renderStaticToDisk
```

Fixes #10554
2022-12-22 12:43:50 +01:00
Joe Mooring
4989da653d Revert "tpl/tplimpl: Use https in sitemap templates"
This reverts commit 3fd0b78498.
2022-12-22 08:53:58 +01:00
Bjørn Erik Pedersen
cd1ed563a8 tpl: Improve template funcs GoDoc 2022-12-21 15:33:02 +01:00
Bjørn Erik Pedersen
aa2c724195 tpl/resources: Fix data race in ToCSS
Fixes #10542
2022-12-21 12:26:42 +01:00
Bjørn Erik Pedersen
effa6a4226 tocss: Add some more test cases
See #10555
2022-12-21 11:21:07 +01:00
Septs
5d5f0a2371 tocss: Fix unquote case with double quotes
See #10555
2022-12-21 11:21:07 +01:00
Bjørn Erik Pedersen
d20d2651ea
Allow "fast render mode" even if --disableLiveReload is set
Fixes #10561
2022-12-21 11:02:21 +01:00
Bjørn Erik Pedersen
41a080b268 tocss: Add vars option
This commit adds a new `vars` option to both the Sass transpilers (Dart Sass and Libsass).

This means that you can pass a map with key/value pairs to the transpiler:

```handlebars
{{ $vars := dict "$color1" "blue" "$color2" "green" "$font_size" "24px" }}
{{ $cssOpts := (dict "transpiler" "dartsass" "outputStyle" "compressed" "vars" $vars ) }}
{{ $r := resources.Get "scss/main.scss" |  toCSS $cssOpts }}
```

And the the variables will be available in the `hugo:vars` namespace. Example usage for Dart Sass:

```scss
@use "hugo:vars" as v;

p {
    color: v.$color1;
    font-size: v.$font_size;
}
```

Note that Libsass does not support the `use` keyword, so you need to `import` them as global variables:

```scss
@import "hugo:vars";

p {
    color: $color1;
    font-size: $font_size;
}
```

Hugo will:

* Add a missing leading `$` for the variable names if needed.
* Wrap the values in `unquote('VALUE')` (Sass built-in) to get proper handling of identifiers vs other strings.

This means that you can pull variables directly from e.g. the site config:

```toml
[params]
[params.sassvars]
color1 = "blue"
color2 = "green"
font_size = "24px"
image = "images/hero.jpg"
```

```handlebars
{{ $vars := site.Params.sassvars}}
{{ $cssOpts := (dict "transpiler" "dartsass" "outputStyle" "compressed" "vars" $vars ) }}
{{ $r := resources.Get "scss/main.scss" |  toCSS $cssOpts }}
```

Fixes #10555
2022-12-20 19:36:30 +01:00
Bjørn Erik Pedersen
41bc6f702a Squashed 'docs/' changes from 2201ac0e5..2c0125b52
2c0125b52 Remove .Site.Author
2cf8841b3 Update partialCached.md (#1924)
385487191 Update data-templates.md (#1926)
ce207e141 Remove redundant markdown and fix a few typos (#1936)
3687c2953 Make heading id linkable, take 2
45c79bea7 Make heading id linkable
b22079344 Delete duplicates the lines 557-569 and 570-582. (#1934)
0a90dc122 Rework the taxonomy variables page (#1935)
7f8979c50 Update theme
26e682a3a Update multilingual.md
d40e7693f Update postcss.md
375d75c01 Update postcss npm instructions (#1931)
63020094a Emphasize Window shell selection (#1930)
56824be2c Update configuration.md
b7b8f16b3 Docu 'Theme components': minor fix (#1929)
09dc81a05 Remove Docker from BSD page (#1927)
205fea204 netlify: Hugo 0.108.0
6abe49c28 Merge commit 'da670c38ee63a7fef25e2b9f42519232055b60dc'
12b59a4c5 docs: Add basic doc for wrapStandAloneImageWithinParagraph etc.
ba07bd970 dartsass: Add sourceMapIncludeSources option

git-subtree-dir: docs
git-subtree-split: 2c0125b5290494d49334606c451446ebd9df3c21
2022-12-20 11:04:41 +01:00
Bjørn Erik Pedersen
9a215d6950
Merge commit '41bc6f702aa54200530efbf4267e5c823df3028d' 2022-12-20 11:04:41 +01:00