Compare commits

...

2230 Commits

Author SHA1 Message Date
hugoreleaser dd0d3fdbbe releaser: Bump versions for release of 0.90.0
[ci skip]
2021-12-08 09:33:46 +00:00
hugoreleaser b921752331 releaser: Add release notes for 0.90.0
[ci skip]
2021-12-08 09:33:46 +00:00
Bjørn Erik Pedersen 0fa40ce58f releaser: Simplify the release process
Make it into a one step even for major releases.
2021-12-08 09:38:15 +01:00
Bjørn Erik Pedersen bf537f1c6d releaser: Remove unused code 2021-12-08 09:02:45 +01:00
Bjørn Erik Pedersen e86b331138 docs: Regenerate docs helper 2021-12-08 08:56:16 +01:00
Bjørn Erik Pedersen 6c841a691e Merge commit '8d9511a08f14260cbfb73119e4afae50e5a9966d' 2021-12-08 08:54:25 +01:00
Bjørn Erik Pedersen 8d9511a08f Squashed 'docs/' changes from 39a7fac34..316cec249
316cec249 Update future events template example (#1595)
3bde7d489 Install mage outside module (#1592)
762e27eff Clarify ignoreFiles regex matching
4d0032051 Add id attribute to h2 elements (#1590)
8262b077c Improve inline resource examples (#1587)
2eae7c7ec fix disqus example name (#1588)
a772f4804 Added install instructions for openSUSE Tumbleweed (#1459)
7ad1c301b Remove screen capture from Hosting on GitHub page (#1586)
a58541f49 add more details on about gh-pages and baseURL on hosting-on-github.md (#1346)
3bd0b46dc Update configuration page (#1585)
4cf1f013e Update OS functions
2c45a95c2 Remove getting-started/code-toggle/
40fdff598 Describe artificial language private use subtags (#1577)
91011d210 Remove google_news from list of internal templates (#1576)
36c7879e4 Update the .Unix function
731063488 Remove a showcase
818c371a0 Update index.md
3136d39d9 netlify: Hugo 0.89.4
092bc9278 Merge branch 'tempv0.89.4'
18e01f105 releaser: Add release notes to /docs for release of 0.89.4
79135281f Correct and sort list of target image formats (#1574)
af4170c7e netlify: Hugo 0.89.3
7f5444251 Merge branch 'tempv0.89.3'
a32e4a6c2 releaser: Add release notes to /docs for release of 0.89.3
6dd3dc3f9 Update configuration.md
5fbe741d7 Update index.md (#1570)
37a69496f netlify: Bump to Hugo 0.89.2
3b293f1f4 Merge branch 'tempv0.89.2'
64c934e7a releaser: Add release notes to /docs for release of 0.89.2
919c51c7d Update index.md
13dd463b1 netlify: Hugo 0.89.1
d8cda1474 releaser: Add release notes to /docs for release of 0.89.1
a2adf7742 releaser: Add release notes to /docs for release of 0.89.1
c3088c4fc Add code toggle to menus page (#1568)
2d0f38978 Remove blank lines from code-toggle output (#1564)
7cf058bfd Add localization examples (#1563)
cf8627c2e Fixing typos, fixing incomplete link (#1561)
c78cc014b Document the removePathAccents setting
70beddaf4 Make corrections to 0.89.0 release notes (#1560)
1917195f0 Update index.md
7fb8e070c Run hugo --gc
1772d45fb Release 0.89.0
d9006179b Merge branch 'tempv0.89.0'
8db86b61e releaser: Add release notes to /docs for release of 0.89.0
abf268571 docs: Regen CLI docs
fbbdb0ab1 Update the timeout default
9cbd1c15a Fix description of lang.FormatNumberCustom
6043b54cc Remove "render" keyword from Host on Render page
f8ea8e84f Clarify description of front matter url (#1557)
91a0c9954 Update Twitter shortcode oEmbed endpoint
79a7405b8 Merge commit 'aa5ac36a3eb68b86c803caec703869efefc8447e'
57667bae6 hugofs: Add includeFiles and excludeFiles to mount configuration
0c9ee0a04 Allow multiple plugins in the PostCSS options map
155799e6b docs: Create path.Clean documentation

git-subtree-dir: docs
git-subtree-split: 316cec2494
2021-12-08 08:42:31 +01:00
Bjørn Erik Pedersen e71d715b9b Add custom font support to images.Text
Fixes #9253
2021-12-07 16:53:02 +01:00
Bjørn Erik Pedersen e61cdf335f images: Fix cache busting of image text filter
See #9238
2021-12-07 16:53:02 +01:00
dependabot[bot] 6c3bc5ebad build(deps): bump github.com/getkin/kin-openapi from 0.80.0 to 0.85.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.80.0 to 0.85.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.80.0...v0.85.0)

---
updated-dependencies:
- dependency-name: github.com/getkin/kin-openapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-07 13:12:42 +01:00
Paul van Brouwershaven 283394a4fd images: Text filter that draws text with the given options (#9239)
Fixes #9238
2021-12-07 11:29:55 +01:00
Joe Mooring 5538507e90 tpl/transform: Optional options for highlight func
Closes #9249
Fixes gohugoio/hugoDocs#63
2021-12-07 11:26:56 +01:00
Bjørn Erik Pedersen b4f27ef8e7 deps: Upgrade github.com/evanw/esbuild v0.13.12 => v0.14.2 (note)
Note: ESBuild v0.14.0 contains backwards-incompatible changes, see https://github.com/evanw/esbuild/releases/tag/v0.14.0

Fixes #9244
2021-12-04 16:28:50 +01:00
Bjørn Erik Pedersen 3473e31eb1 releaser: Add "note" to Note regexp 2021-12-04 16:27:56 +01:00
dependabot[bot] fa0da004a9 build(deps): bump github.com/mitchellh/mapstructure from 1.4.2 to 1.4.3
Bumps [github.com/mitchellh/mapstructure](https://github.com/mitchellh/mapstructure) from 1.4.2 to 1.4.3.
- [Release notes](https://github.com/mitchellh/mapstructure/releases)
- [Changelog](https://github.com/mitchellh/mapstructure/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitchellh/mapstructure/compare/v1.4.2...v1.4.3)

---
updated-dependencies:
- dependency-name: github.com/mitchellh/mapstructure
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-03 18:16:50 +01:00
Bjørn Erik Pedersen 24a893cf83 releaser: Rework and simplify to use GitHub only for release notes 2021-12-03 17:02:20 +01:00
dependabot[bot] bf1564bd2c build(deps): bump google.golang.org/api from 0.51.0 to 0.61.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.51.0 to 0.61.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.51.0...v0.61.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-03 17:01:37 +01:00
Paul van Brouwershaven cd44d409ba media: Add rss suffix for application/rss+xml
Closes #9233
2021-12-03 12:45:49 +01:00
Bjørn Erik Pedersen 9a326d5636 parser: Add a test case in format resolution
See #9233
2021-12-03 10:34:34 +01:00
Bjørn Erik Pedersen b10381fbe0 lazy: Reset error in Reset
To prevent sticky errors on server rebuilds.

Fixes #7043
Closes #9194
2021-12-02 18:06:19 +01:00
Paul van Brouwershaven 0eaaa8fee3 Implement XML data support
Example:

```
{{ with resources.Get "https://example.com/rss.xml" | transform.Unmarshal }}
    {{ range .channel.item }}
        <strong>{{ .title | plainify | htmlUnescape }}</strong><br />
        <p>{{ .description | plainify | htmlUnescape }}</p>
        {{ $link := .link | plainify | htmlUnescape }}
        <a href="{{ $link }}">{{ $link }}</a><br />
        <hr>
    {{ end }}
{{ end }}
```

Closes #4470
2021-12-02 17:30:36 +01:00
Joe Mooring 58adbeef88 Validate private use language tags
Fixes #9119
2021-12-02 16:30:53 +01:00
Bjørn Erik Pedersen 93572e5318 resources: Add timeout to the HTTP request in Get
Workaround for https://github.com/golang/go/issues/49366
2021-12-02 16:11:14 +01:00
Bjørn Erik Pedersen 94f149b21e Add a remote retry for resources.Get 2021-12-02 16:11:14 +01:00
Paul van Brouwershaven 66753416b5 Make resources.Get use a file cache for remote resources
Closes #9228
2021-12-02 12:56:25 +01:00
Joe Mooring 133e4bfbee Remove empty href element from pagination template
Closes #9149
2021-12-02 09:14:30 +01:00
Joe Mooring f122771fb1 Check for empty deployment targets and matchers
Fixes #9220
2021-12-01 10:17:42 +01:00
Bjørn Erik Pedersen 08a863e1e8 resources: Adjust the remote Get cache so it does not get evicted on restarts
We fill improve this, soon.
2021-11-30 16:54:01 +01:00
Paul van Brouwershaven 8aa7257f65 Add remote support to resources.Get
Closes #5255
Supports #9044
2021-11-30 11:49:51 +01:00
Joe Mooring 75a823a36a Add deprecation warning to google_news template
Closes #9172
2021-11-21 11:25:17 +01:00
Bjørn Erik Pedersen 5e0947c5b5 helpers: Make UniqueStringsReuse allocation free
This should be faster for all of our use cases (small string slices), but more important, it makes UniqueStringsReuse allocation free.

```bash
name                                 old time/op    new time/op    delta
UniqueStrings/Safe-16                   776ns ± 0%     305ns ± 0%   -60.68%  (p=0.029 n=4+4)
UniqueStrings/Reuse_slice-16            621ns ± 3%     174ns ± 0%   -72.01%  (p=0.029 n=4+4)
UniqueStrings/Reuse_slice_sorted-16     319ns ± 4%     313ns ± 0%    -2.01%  (p=0.029 n=4+4)

name                                 old alloc/op   new alloc/op   delta
UniqueStrings/Safe-16                    224B ± 0%      128B ± 0%   -42.86%  (p=0.029 n=4+4)
UniqueStrings/Reuse_slice-16            96.0B ± 0%      0.0B       -100.00%  (p=0.029 n=4+4)
UniqueStrings/Reuse_slice_sorted-16     24.0B ± 0%     24.0B ± 0%      ~     (all equal)

name                                 old allocs/op  new allocs/op  delta
UniqueStrings/Safe-16                    7.00 ± 0%      1.00 ± 0%   -85.71%  (p=0.029 n=4+4)
UniqueStrings/Reuse_slice-16             6.00 ± 0%      0.00       -100.00%  (p=0.029 n=4+4)
UniqueStrings/Reuse_slice_sorted-16      1.00 ± 0%      1.00 ± 0%      ~     (all equal)
```
2021-11-17 10:44:03 +01:00
hugoreleaser 0b70b46aad releaser: Prepare repository for 0.90.0-DEV
[ci skip]
2021-11-17 09:05:38 +00:00
hugoreleaser ab01ba6e7e releaser: Add release notes to /docs for release of 0.89.4
[ci skip]
2021-11-17 08:24:08 +00:00
hugoreleaser cc08c09592 releaser: Bump versions for release of 0.89.4
[ci skip]
2021-11-17 08:24:08 +00:00
hugoreleaser f97da9eca9 releaser: Add release notes for 0.89.4
[ci skip]
2021-11-17 08:24:08 +00:00
Bjørn Erik Pedersen 2e70f61fb0 Fix content dir resolution when main project is a Hugo Module
Fixes #9177
2021-11-16 20:42:34 +01:00
hugoreleaser 1ed8069a3a releaser: Prepare repository for 0.90.0-DEV
[ci skip]
2021-11-15 12:56:41 +00:00
hugoreleaser c88cdb5610 releaser: Add release notes to /docs for release of 0.89.3
[ci skip]
2021-11-15 12:17:45 +00:00
hugoreleaser e1064d2195 releaser: Bump versions for release of 0.89.3
[ci skip]
2021-11-15 12:17:45 +00:00
hugoreleaser bf489b96d3 releaser: Add release notes for 0.89.3
[ci skip]
2021-11-15 12:17:45 +00:00
Bjørn Erik Pedersen b8155452ac Improve error when we cannot determine content directory in "hugo new"
See #9166
2021-11-15 11:21:39 +01:00
Joe Mooring 08552a7a4c deps: Upgrade github.com/yuin/goldmark v1.4.3 => v1.4.4
Fixes #9159
2021-11-15 09:43:24 +01:00
Bjørn Erik Pedersen fdad91fd96 commands: Make sure pollInterval is always set
Fixes #9165
2021-11-13 21:45:51 +01:00
Bjørn Erik Pedersen 5f3f60898c create: Improve archetype directory discovery and tests
Updates #9146
2021-11-12 12:05:31 +01:00
Bjørn Erik Pedersen 057d02de25 create: Add a log statement when archetype is a directory
See #9157
2021-11-12 12:05:31 +01:00
Bjørn Erik Pedersen 43ac59da85 create: Always print "Content ... created"
This indeliberately changed to INFO level in Hugo 0.89.0.

Fixes #9157
2021-11-12 12:05:31 +01:00
Bjørn Erik Pedersen ab5c6990a5 commands: Fix missing file locking in server partial render
Fixes #9162
2021-11-12 09:29:04 +01:00
Patrick Kollitsch 9369d13e59 modules: Improve error message 2021-11-10 09:32:17 +01:00
hugoreleaser 805c24c32c releaser: Prepare repository for 0.90.0-DEV
[ci skip]
2021-11-08 15:56:14 +00:00
hugoreleaser 63e3a5ebb2 releaser: Add release notes to /docs for release of 0.89.2
[ci skip]
2021-11-08 15:22:23 +00:00
hugoreleaser eaa6c96a79 releaser: Bump versions for release of 0.89.2
[ci skip]
2021-11-08 15:22:23 +00:00
hugoreleaser cf3eb580bf releaser: Add release notes for 0.89.2
[ci skip]
2021-11-08 15:22:23 +00:00
Bjørn Erik Pedersen 2b01c85d14 Fix path resolution in hugo new
With theme and project with content directories and command on the form `hugo new posts/test.md`.

Fixes #9129
2021-11-08 14:10:46 +01:00
Bjørn Erik Pedersen c09f5c5fd3 deps: Upgrade github.com/yuin/goldmark v1.4.2 => v1.4.3
Fixes #9137
2021-11-08 11:54:51 +01:00
hugoreleaser 9232e28446 releaser: Prepare repository for 0.90.0-DEV
[ci skip]
2021-11-05 16:24:06 +00:00
hugoreleaser b6a4ae4ad5 releaser: Add release notes to /docs for release of 0.89.1
[ci skip]
2021-11-05 15:44:32 +00:00
hugoreleaser 84de0c3255 releaser: Bump versions for release of 0.89.1
[ci skip]
2021-11-05 15:44:32 +00:00
hugoreleaser a074102262 releaser: Add release notes for 0.89.1
[ci skip]
2021-11-05 15:44:32 +00:00
Bjørn Erik Pedersen da4406ea50 Revert "releaser: Fat MacOS binaries"
This had some side effect that I'm not prepared to fix today ...

This reverts commit 3a977485eb.

Updates #9131
Updates #9128
2021-11-05 16:31:19 +01:00
Bjørn Erik Pedersen 166862a096 create: Make sure the build lock is released before we open editor
Fixes #9121
2021-11-04 15:40:02 +01:00
Andreas Deininger 82c33c7105 readme: Update dependency list 2021-11-03 17:15:33 +01:00
hugoreleaser 41e9e9fe14 releaser: Prepare repository for 0.90.0-DEV
[ci skip]
2021-11-02 10:40:00 +00:00
hugoreleaser ade966b84b releaser: Add release notes to /docs for release of 0.89.0
[ci skip]
2021-11-02 10:00:17 +00:00
hugoreleaser a93d4ba64e releaser: Bump versions for release of 0.89.0
[ci skip]
2021-11-02 10:00:17 +00:00
hugoreleaser 110512a65c releaser: Add release notes for 0.89.0 2021-11-02 10:47:54 +01:00
Bjørn Erik Pedersen f503b63957 docs: Regen CLI docs 2021-11-02 09:01:26 +01:00
Bjørn Erik Pedersen 30aba7fb09 source: Make ContentBaseName() return the directory for branch bundles
Fixes #9112
2021-11-01 21:06:39 +01:00
Joe Mooring 04a3b45db4 Fix description of lang.FormatNumberCustom
It currently refers to itself as a simple alternative, when it should
refer to lang.FormatNumber.
2021-11-01 18:54:43 +01:00
Joe Mooring 0cc39af682 Update Twitter shortcode oEmbed endpoint
The existing endpoint will be retired and removed on November 23, 2021.
References:

- https://twittercommunity.com/t/consolidating-the-oembed-functionality/154690
- https://developer.twitter.com/en/docs/twitter-for-websites/oembed-api#Embedded

This is a backward compatible change.

The existing endpoint requires a single parameter: the id of the tweet.

The new endpoint requires two parameters: the id of the tweet, and the
user with whom it is associated. For the moment, if you supply the wrong
user, the request will be redirected (with a small delay) to the correct
user/id pair. This behavior is undocumented, but we will take advantage
of it as Hugo site authors transition to the new syntax.

{{< tweet 1453110110599868418 >}} --> works, throws warning, deprecate at some point

{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}} --> new syntax

Fixes #8130
2021-11-01 15:51:00 +01:00
Bjørn Erik Pedersen ed6fd26ce8 common/htime: Fix time.Format with Go layouts
Fixes #9107
2021-11-01 15:45:59 +01:00
dependabot[bot] 7fa66425aa build(deps): bump github.com/evanw/esbuild from 0.13.10 to 0.13.12
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.13.10 to 0.13.12.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.13.10...v0.13.12)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-01 15:44:19 +01:00
dependabot[bot] 69210cfdf3 build(deps): bump github.com/yuin/goldmark from 1.4.1 to 1.4.2
Bumps [github.com/yuin/goldmark](https://github.com/yuin/goldmark) from 1.4.1 to 1.4.2.
- [Release notes](https://github.com/yuin/goldmark/releases)
- [Commits](https://github.com/yuin/goldmark/compare/v1.4.1...v1.4.2)

---
updated-dependencies:
- dependency-name: github.com/yuin/goldmark
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-01 15:43:42 +01:00
Bjørn Erik Pedersen 4b36498a85 Merge commit 'aa5ac36a3eb68b86c803caec703869efefc8447e' 2021-10-31 13:53:55 +01:00
Bjørn Erik Pedersen aa5ac36a3e Squashed 'docs/' changes from 327003421..39a7fac34
39a7fac34 Add .hugo_build.lock to .gitignore
920c716a4 fix a typo: to -> two (#1545)
6f0ba9593 Remove godocref from front matter (#1543)
8ec3d5948 remove link to wercker (#1544)
b56008719 Delete deployment-with-wercker.md (#1542)
e33d29b02 Fix broken links (#1538)
29e9d4c21 Sort commenting systems (#1541)
0b7ea60a7 Delete the news page "HTTP/2 Server Push in Hugo"
6e1515857 Fix quick-start.md (#1525)
62168ab35 Update comments.md (#1535)
d92191512 Small typo (#1539)
129c8834a Correct the PostCSS noMap default value (#1534)
6a5b29fcc Add example to index function (#1536)
e3dd8c507 Update output-formats.md
0c9321ca0 Remove reference to using LiveReload in production environment
4072d6776 Mod testing
09fabf7d6 Fix typo (#1524)
2fce813c8 Fix grammatical error in quick-start.md (#1523)
45230ab4a Hugo Mod testing
2dd4cd9e7 Update index.md
2c3ed62fd netlify: Bump to 0.88.1
648e2a007 Merge branch 'tempv0.88.1'
f216eade1 releaser: Add release notes to /docs for release of 0.88.1
8a7b64d4b Fix typographical errors in 0.88.0 release notes
a4bf86300 Release 0.88
738bb8f38 releaser: Add release notes to /docs for release of 0.88.0
8fcf2c55d highlight: Remove some pygments references
f2b173de2 HTTPS link
c88881c8e Adding link to nginx documentation
6b0a74fe0 Fix typos in docs (#1516)
498b8f0f1 Fix typos in time.Format (#1515)
28723fad6 Fix taxonomy and term examples (#1514)
3ffd00e12 Update front-matter.md
7cc1da82e Fix grammar in 0.86.1 release notes (#1510)
0009c51c3 Update docs helper
7e2f430f4 Update index.md
7857eae7e releaser: Add release notes to /docs for release of 0.87.0
1f08b684b releaser: Add release notes to /docs for release of 0.87.0
36a9e701c docs: Adjust config docs
0f588438e docs: Regen CLI docs
1b4682cd8 docs: Regen docs helper
bc8bbaae9 Merge commit 'bd77f6e1c99e04a476f0b1bb4e44569134e02399' into release-0.87.0
6f2480643 docs: Adjust time zone docs

git-subtree-dir: docs
git-subtree-split: 39a7fac343
2021-10-31 13:51:51 +01:00
Bjørn Erik Pedersen 3a977485eb releaser: Fat MacOS binaries
Fixes #9035
2021-10-31 11:30:12 +01:00
Bjørn Erik Pedersen 0f248606d5 releaser: Only build amd64 binary for freebsd, netbsd, openbsd, dragonfly
Fixes #9102
2021-10-31 10:04:01 +01:00
Bjørn Erik Pedersen e82cbd746f tpl/time: Use configured location when date passed to Format is string
Updates #9084
2021-10-30 16:09:38 +02:00
dependabot[bot] 3339c2bb61 build(deps): bump github.com/aws/aws-sdk-go from 1.40.8 to 1.41.14
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.40.8 to 1.41.14.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.40.8...v1.41.14)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-30 11:17:12 +02:00
dependabot[bot] 03bbdba8be build(deps): bump github.com/getkin/kin-openapi from 0.79.0 to 0.80.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.79.0 to 0.80.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.79.0...v0.80.0)

---
updated-dependencies:
- dependency-name: github.com/getkin/kin-openapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-30 11:16:46 +02:00
dependabot[bot] a772b8fc38 build(deps): bump github.com/evanw/esbuild from 0.13.8 to 0.13.10
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.13.8 to 0.13.10.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.13.8...v0.13.10)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-30 09:35:06 +02:00
Anthony Fok dce49d1333 resources: Rename excepted filenames for image golden testdata
As documented in commit 30eea3915b,
some filenames have changed due to cache busting of PNG and Webp images.

This resolves recent TestImageOperationsGolden failure on arm64, ppc64le
and s390x.

See #6387 and #8729
2021-10-30 08:47:22 +02:00
dependabot[bot] 61c5b7a2e6 build(deps): bump github.com/frankban/quicktest from 1.13.1 to 1.14.0
Bumps [github.com/frankban/quicktest](https://github.com/frankban/quicktest) from 1.13.1 to 1.14.0.
- [Release notes](https://github.com/frankban/quicktest/releases)
- [Commits](https://github.com/frankban/quicktest/compare/v1.13.1...v1.14.0)

---
updated-dependencies:
- dependency-name: github.com/frankban/quicktest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-27 14:30:23 +02:00
Joe Mooring 1d60bd1efa Fix typo in error message 2021-10-26 12:59:15 +02:00
Bjørn Erik Pedersen 75c9b893d9 create: Validate the target path in hugo new
Fixes #9072
2021-10-25 19:50:18 +02:00
Bjørn Erik Pedersen 64e1613fb3 Fix panic when specifying multiple excludeFiles directives
Fixes #9076
2021-10-25 19:50:18 +02:00
satotake b959ecbc81 htime: Set zone of datetime from from go-toml
`go-toml/v2`'s unmarshaler does not specify zone name even if value has
offset explicitly.
To make time-formatting behaviour consistent, convert them into string
in hugo.

Close #8895
2021-10-25 19:49:44 +02:00
Sergio Garcia 70e454812e Added nodesource apt repository to snap package 2021-10-22 16:26:07 -06:00
Anthony Fok 355ff83e74 config: Set HUGO_ENABLEGITINFO=false override in Set_in_string
This allows TestLoadConfigWithOsEnvOverrides/Set_in_string to PASS
even if there is no .git directory, e.g. during Debian package build.
2021-10-22 19:40:18 +02:00
Bjørn Erik Pedersen 471ed91c60 hugofs: Add includeFiles and excludeFiles to mount configuration
Fixes #9042
2021-10-20 05:00:17 +02:00
dependabot[bot] 94a5bac5b2 build(deps): bump github.com/mitchellh/mapstructure from 1.4.1 to 1.4.2
Bumps [github.com/mitchellh/mapstructure](https://github.com/mitchellh/mapstructure) from 1.4.1 to 1.4.2.
- [Release notes](https://github.com/mitchellh/mapstructure/releases)
- [Changelog](https://github.com/mitchellh/mapstructure/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitchellh/mapstructure/compare/v1.4.1...v1.4.2)

---
updated-dependencies:
- dependency-name: github.com/mitchellh/mapstructure
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-20 04:17:44 +02:00
Bjørn Erik Pedersen 9830ca9e31 resources: Always preserve the original transform error 2021-10-19 20:38:38 +02:00
itsAftabAlam b64fd0577b readme: Add hyperlink to the banner 2021-10-19 15:59:12 +02:00
dependabot[bot] 2706437a7d build(deps): bump github.com/getkin/kin-openapi from 0.78.0 to 0.79.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.78.0 to 0.79.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.78.0...v0.79.0)

---
updated-dependencies:
- dependency-name: github.com/getkin/kin-openapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-19 15:35:31 +02:00
Bjørn Erik Pedersen ec7c993cfe deps: github.com/evanw/esbuild v0.13.5 => v0.13.8 2021-10-19 15:33:29 +02:00
Bjørn Erik Pedersen 32c6f656d9 create: Return error on no content dirs
Closes #9056
2021-10-19 08:08:21 +02:00
Bjørn Erik Pedersen e02e0727e5 Fix file permissions in new archetype implementation
Closes #9057
2021-10-18 19:08:19 +02:00
Bjørn Erik Pedersen 096f5e1921 Fix the "page picker" logic in --navigateToChanged
Fixes #9051
2021-10-18 12:13:13 +02:00
Bjørn Erik Pedersen ba35e69856 Add a cross process build lock and use it in the archetype content builder
Fixes #9048
2021-10-18 12:13:13 +02:00
nabbisen c7957c90e8 readme: Fix a typo on OpenBSD 2021-10-17 21:23:01 +02:00
Bjørn Erik Pedersen bb05377033 deps: github.com/alecthomas/chroma v0.9.2 => v0.9.4
Fixes #8532
2021-10-17 17:14:03 +02:00
Bjørn Erik Pedersen 9185e11eff Reimplement archetypes
The old implementation had some issues, mostly related to the context (e.g. name, file paths) passed to the template.

This new implementation is using the exact same code path for evaluating the pages as in a regular build.

This also makes it more robust and easier to reason about in a multilingual setup.

Now, if you are explicit about the target path, Hugo will now always pick the correct mount and language:

```bash
hugo new content/en/posts/my-first-post.md
```

Fixes #9032
Fixes #7589
Fixes #9043
Fixes #9046
Fixes #9047
2021-10-16 15:22:03 +02:00
dependabot[bot] 168a3aab46 build(deps): bump github.com/tdewolff/minify/v2 from 2.9.21 to 2.9.22
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.9.21 to 2.9.22.
- [Release notes](https://github.com/tdewolff/minify/releases)
- [Commits](https://github.com/tdewolff/minify/compare/v2.9.21...v2.9.22)

---
updated-dependencies:
- dependency-name: github.com/tdewolff/minify/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-14 10:40:23 +02:00
Bjørn Erik Pedersen 8bcfa3bdf6 deps: Update github.com/evanw/esbuild v0.13.5 2021-10-14 10:25:42 +02:00
Iskander (Alex) Sharipov d7331aaa7e releaser: Fix regexp
Original regexp used a char class which caused the regexp to only
check 1 symbol instead of a substring like "See" and "Closes".
So it would match `e #x` instead of `See #x` and many other
weird combinations.

Tests were passing as they never checked against an input that
would confuse that regexp.

Found with go-critic static analyzer, `badRegexp` checker.
2021-10-12 11:32:09 +02:00
dependabot[bot] cd4e67af18 build(deps): bump github.com/mattn/go-isatty from 0.0.13 to 0.0.14
Bumps [github.com/mattn/go-isatty](https://github.com/mattn/go-isatty) from 0.0.13 to 0.0.14.
- [Release notes](https://github.com/mattn/go-isatty/releases)
- [Commits](https://github.com/mattn/go-isatty/compare/v0.0.13...v0.0.14)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-isatty
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-10 20:45:38 +02:00
dependabot[bot] e6ad1f0e76 build(deps): bump github.com/getkin/kin-openapi from 0.75.0 to 0.78.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.75.0 to 0.78.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.75.0...v0.78.0)

---
updated-dependencies:
- dependency-name: github.com/getkin/kin-openapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-10 20:30:52 +02:00
Bjørn Erik Pedersen 625d2c257a releaser: Update to Go go1.17.2
* This now uses the `golang:1.17.2-buster` Docker image which runs GLIBC 2.28-10.
* Also added a build hook to warn us if this happens again in the future.

Fixes #8955
2021-10-10 16:53:44 +02:00
Joe Mooring e6e44b7c41 Fix value of useResourceCacheWhen in TestResourceChainPostCSS 2021-10-10 11:12:01 +02:00
Joe Mooring 64abc83fc4 Allow multiple plugins in the PostCSS options map
Usage:
{{ $options := dict "use" "autoprefixer postcss-color-alpha" }}
{{ $style := resources.Get "main.css" | resources.PostCSS $options }}

Fixes #9015
2021-10-10 11:11:43 +02:00
Joe Mooring f8d132d731 docs: Create path.Clean documentation
Related to #9005
2021-10-09 20:36:57 +02:00
Bjørn Erik Pedersen 26f1919ae0 Skip a test assertion on CI
Need to investigate later, but got to get the tests green.
2021-10-09 20:36:32 +02:00
Brad e55466ce70 tpl/path: Add path.Clean
Fixes #8885
2021-10-05 16:15:10 +02:00
Shalabh Kamboj ecf025f006 readme: Remove tracking image
The server for the tracking image for analytics is currently down,
therefore I found it convenient to remove the link in order to maintain our readme
2021-10-05 15:09:11 +02:00
digitalcraftsman fab1e43de5 Revert "Remove credit from release notes"
See b2eaf4c8c2
2021-09-23 14:02:00 +02:00
Paul Gottschling e03f82eef2 Pass minification errors to the user
Previously, *minifyTransformation.Transform suppressed the
error returned by t.m.Minify. This meant that when minification
returned an error, the error would not reach the user. Instead,
minification would silently fail. For example, if a JavaScript
file included a call to the Date constructor with:

new Date(2020, 04, 02)

The package that the minification library uses to parse JS files,
github.com/tdewolff/parse would return an error, since "04" would
be parsed as a legacy octal. However, the JS file would remain
un-minified with no error.

Fixing this is not as simple as replacing "_" with an "err" in
*minifyTransformation.Transform, however (though this is
necessary). If we only returned this error from Transform,
then hugolib.TestResourceMinifyDisabled would fail. Instead of
being a no-op, as TestResourceMinifyDisabled expects, using the
"minify" template function with a "disableXML=true" config
setting instead returns the error, "minifier does not exist for
mimetype."

The "minifier does not exist" error is returned because of the
way minifiers.New works. If the user's config disables
minification for a particular MIME type, minifiers.New does
not add it to the resulting Client's *minify.M. However, this
also means that when the "minify" template function is executed,
 a *resourceAdapter's transformations still add a minification.
When it comes time to call the minify.Minifier for a specific
MIME type via *M.MinifyMimetype, the github.com/tdewolff/minify
library throws the "does not exist" error for the missing MIME
type.

The solution was to change minifiers.New so, instead of skipping
a minifier for each disabled MIME type, it adds  a NoOpMinifier,
which simply copies the source to the destination without
minification. This means that when the "minify" template
function is used for a particular resource, and that resource's
MIME type has minification disabled, minification is genuinely
skipped, and does not result in an error.

In order to add this, I've fixed a possibly unwanted interaction
between minifiers.TestConfigureMinify and
hugolib.TestResourceMinifyDisabled. The latter disables
minification and expects minification to be a no-op. The former
disables minification and expects it to result in an error. The
only reason hugolib.TestResourceMinifyDisabled passes in the
original code is that the "does not exist" error is suppressed.
However, we shouldn't suppress minification errors, since they
can leave users perplexed. I've changed the test assertion in
minifiers.TestConfigureMinify to expect no errors and a no-op
if minification is disabled for a particular MIME type.

Fixes #8954
2021-09-22 20:54:40 +02:00
Paul Gottschling a864ffe9ac Clarify "precision" in currency format functions
The documentation of the FormatAccounting and FormatCurrency
functions could be clearer in terms of how the precision param
works. This commit makes it more explicit that adding a precision
of < 2 will not format the return values to include fewer decimals.

Resolves #8858
2021-09-22 20:00:30 +02:00
dependabot[bot] b49da33280 build(deps): bump github.com/evanw/esbuild from 0.12.24 to 0.12.29
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.12.24 to 0.12.29.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.12.24...v0.12.29)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-22 20:00:05 +02:00
Emmanuel T Odeke 7c21eca74f resources: Use default math/rand.Source for concurrency safety
The source from NewSource is documented not to be safe for
concurrency, and instead use the eefault source which is documented
as safe.

Fixes #8981
2021-09-19 12:18:30 +02:00
Bjørn Erik Pedersen 13ad8408fc commands: Make the error handling for the mod commands more lenient
So it at least is possible to do a `hugo mod clean --all` if the cache is in a funky state.
2021-09-17 17:16:34 +02:00
Bjørn Erik Pedersen 1cabf61ddf modules: Add some help text to the 'unknown revision' error
I had a head scratching moment with this myself, so it's safe to say that others will.

See #6825
2021-09-17 09:34:35 +02:00
Joe Mooring 268e3069f3 deps: Update github.com/yuin/goldmark v1.4.0 => v1.4.1
Fixes #8855
2021-09-12 21:55:37 +02:00
hugoreleaser 3efc2e2af8 releaser: Prepare repository for 0.89.0-DEV
[ci skip]
2021-09-04 10:33:09 +00:00
hugoreleaser 5bc547389a releaser: Add release notes to /docs for release of 0.88.1
[ci skip]
2021-09-04 09:39:19 +00:00
hugoreleaser bb3254385a releaser: Bump versions for release of 0.88.1
[ci skip]
2021-09-04 09:39:19 +00:00
hugoreleaser 9b1d6d7e30 releaser: Add release notes for 0.88.1
[ci skip]
2021-09-04 09:39:19 +00:00
Bjørn Erik Pedersen e1ead4dbca Bump down again to Go 1.16.7 for the release builds
Note that this commit has nothing to do with "Hugo not working with Go 1.17", but this is the simplest fix of some build related issues in Hugo 0.88.0.

Updates #8952
Updates #8955
2021-09-04 11:22:51 +02:00
hugoreleaser 5b59b9c171 releaser: Prepare repository for 0.89.0-DEV
[ci skip]
2021-09-02 09:57:36 +00:00
hugoreleaser acc5eb5b51 releaser: Add release notes to /docs for release of 0.88.0
[ci skip]
2021-09-02 09:27:27 +00:00
hugoreleaser 6cacfa329c releaser: Bump versions for release of 0.88.0
[ci skip]
2021-09-02 09:27:27 +00:00
Bjørn Erik Pedersen 4d03cd780e Release 0.88.0 2021-09-02 11:11:08 +02:00
Bjørn Erik Pedersen 8b14fdbf89 Update 0.88.0-relnotes.md
[ci skip]
2021-09-02 11:10:40 +02:00
hugoreleaser fc21b63b46 releaser: Add release notes for 0.88.0
Rename to *-ready.md to continue.
[ci skip]
2021-09-02 08:09:25 +00:00
Bjørn Erik Pedersen 6631c9c7e0 Run go mod tidy 2021-09-01 10:48:13 +02:00
Bjørn Erik Pedersen cf73cc2ece js: Fix import order for ./foo when both ./foo.js and ./foo/index.js exists
This is in line with how both Node and ESBuild's native import resolver does it.

The ambiguous situations above were discovered trying to build AlpineJS v3.

Note that the above was never an issue if you used `./foo.js` and similar to import the component.

Fixes #8945
2021-09-01 10:47:41 +02:00
Bjørn Erik Pedersen 7d1f806ecb commands: Don't fail on template errors on go mod graph etc.
Fixes #8942
2021-08-31 22:16:12 +02:00
dependabot[bot] 04b5959961 build(deps): bump github.com/getkin/kin-openapi from 0.74.0 to 0.75.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.74.0 to 0.75.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.74.0...v0.75.0)

---
updated-dependencies:
- dependency-name: github.com/getkin/kin-openapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-31 12:11:39 +02:00
dependabot[bot] c278b6e45d build(deps): bump github.com/frankban/quicktest from 1.13.0 to 1.13.1
Bumps [github.com/frankban/quicktest](https://github.com/frankban/quicktest) from 1.13.0 to 1.13.1.
- [Release notes](https://github.com/frankban/quicktest/releases)
- [Commits](https://github.com/frankban/quicktest/compare/v1.13.0...v1.13.1)

---
updated-dependencies:
- dependency-name: github.com/frankban/quicktest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-31 12:11:08 +02:00
dependabot[bot] 107c86febb build(deps): bump github.com/evanw/esbuild from 0.12.22 to 0.12.24
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.12.22 to 0.12.24.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.12.22...v0.12.24)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-31 12:10:32 +02:00
Bjørn Erik Pedersen a0489c2dfd Avoid failing with "module not found" for hugo mod init and similar
Fixes #8940
2021-08-31 12:08:11 +02:00
Bjørn Erik Pedersen 0fc2ce9e4b Update to Go 1.17
Go 1.17 now lazy-loads dependencies when `go.mod` is version `go17`. This does not work for us for new projects started with `hugo mod init`.

Before this commit, starting a project with Go 1.17 with `hugo mod init` and then start adding dependencies with transitive dependenies to `config.toml` would treat the transitive dependencies as new, and you would potentially get a too recent version of those.

Note that this does not effect existing projects, where all dependencies are already recorded in `go.mod`.

Fixes #8930
2021-08-31 11:19:51 +02:00
Anthony Fok 32569285c1 Remove Pygments from snapcraft.yml
Pygments support was removed in Hugo v0.60.0
2021-08-25 10:43:32 -06:00
Bjørn Erik Pedersen 5a46eefbc6 Revert "build(deps): bump github.com/fsnotify/fsnotify from 1.4.9 to 1.5.0"
This reverts commit f70165242b.

Closes #8920
2021-08-23 18:20:29 +02:00
Helder Pereira 7a15edafe2 highlight: Add tabindex when code is not highlighted 2021-08-23 12:28:45 +02:00
dependabot[bot] 2f0945bafe build(deps): bump github.com/evanw/esbuild from 0.12.17 to 0.12.22
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.12.17 to 0.12.22.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.12.17...v0.12.22)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-22 13:58:10 +02:00
Bjørn Erik Pedersen f4ffeea71d Fix it so disableKinds etc. does not get merged in from theme
Unless the merge strategy is set up to do so.

For `disableKinds` the current workaround is to make sure the project config has an entry, even if is empty:

```
disableKinds = []
```

Note that this issue only touches root, non-map config-values that either is not set in project config or in Hugo's defaults.

Fixes #8866
2021-08-22 13:25:20 +02:00
dependabot[bot] 7ba3f3d201 build(deps): bump golang.org/x/text from 0.3.6 to 0.3.7
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.3.6 to 0.3.7.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.3.6...v0.3.7)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-22 12:52:31 +02:00
dependabot[bot] f70165242b build(deps): bump github.com/fsnotify/fsnotify from 1.4.9 to 1.5.0
Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.4.9 to 1.5.0.
- [Release notes](https://github.com/fsnotify/fsnotify/releases)
- [Changelog](https://github.com/fsnotify/fsnotify/blob/master/CHANGELOG.md)
- [Commits](https://github.com/fsnotify/fsnotify/compare/v1.4.9...v1.5.0)

---
updated-dependencies:
- dependency-name: github.com/fsnotify/fsnotify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-22 12:52:04 +02:00
Bjørn Erik Pedersen bc0743ed8e Prevent minifier from removing quoutes around post-processed attributes
Fixes #8884
2021-08-22 12:47:47 +02:00
Bjørn Erik Pedersen ffa2fe6117 Revert "commands: Avoid too many watch file handles causing the server to fail to start"
This reverts commit 3f38c785b7.
2021-08-21 16:32:20 +02:00
Helder Pereira d966f5d08d highlight: Remove some pygments references 2021-08-21 15:50:49 +02:00
Shiming Zhang 3f38c785b7 commands: Avoid too many watch file handles causing the server to fail to start
Fixes #8904
2021-08-19 11:04:09 +02:00
dependabot[bot] 24589c0814 build(deps): bump github.com/getkin/kin-openapi from 0.68.0 to 0.74.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.68.0 to 0.74.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.68.0...v0.74.0)

---
updated-dependencies:
- dependency-name: github.com/getkin/kin-openapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-17 10:50:10 +02:00
Bjørn Erik Pedersen efebd756eb deps: Update github.com/spf13/cast v1.4.0 => v1.4.1
Closes #8891
2021-08-16 09:16:41 +02:00
Bjørn Erik Pedersen 58b6742cfe Import time/tzdata on Windows
Updates #8892
2021-08-14 12:09:41 +02:00
Bjørn Erik Pedersen 32ead4b1e7 releaser: Bump to Go 1.16.7 2021-08-10 14:00:49 +02:00
Bjørn Erik Pedersen abd969a670 Revert "tpl/time: Handle nil values in time.AsTime"
This reverts commit 3e11072892.
2021-08-10 13:21:49 +02:00
Bjørn Erik Pedersen 3e11072892 tpl/time: Handle nil values in time.AsTime
Closes #8865
2021-08-09 18:44:35 +02:00
Bjørn Erik Pedersen 9bba9a3a98 parser: Indent TOML tables
Fixes #8850
2021-08-04 11:39:16 +02:00
Salim B d6c8cd7718 Fix lang.FormatPercent description
Successor PR for https://github.com/gohugoio/hugoDocs/pull/1504
2021-08-03 16:56:06 +02:00
hugoreleaser dfe54d3216 releaser: Prepare repository for 0.88.0-DEV
[ci skip]
2021-08-03 12:11:56 +00:00
hugoreleaser b0c541e496 releaser: Add release notes to /docs for release of 0.87.0
[ci skip]
2021-08-03 10:57:26 +00:00
hugoreleaser 2ed7be295c releaser: Bump versions for release of 0.87.0
[ci skip]
2021-08-03 10:57:26 +00:00
Bjørn Erik Pedersen d9d1ef8b07 Release 0.87 2021-08-03 12:42:22 +02:00
Bjørn Erik Pedersen ec1c1c3459 Merge branch 'b087' into release-0.87.0 2021-08-03 12:38:58 +02:00
Bjørn Erik Pedersen c7fd134625 Update 0.87.0-relnotes.md
[ci skip]
2021-08-03 12:31:41 +02:00
Bjørn Erik Pedersen a5d2632ebb Update 0.87.0-relnotes.md
[ci skip]
2021-08-03 12:30:42 +02:00
Bjørn Erik Pedersen 494f284be3 docs: Adjust config docs 2021-08-03 12:22:02 +02:00
Bjørn Erik Pedersen bf738d2f43 docs: Regen CLI docs 2021-08-03 11:55:02 +02:00
Bjørn Erik Pedersen 8d19850e2d docs: Regen docs helper 2021-08-03 11:53:34 +02:00
Bjørn Erik Pedersen 0934983529 Merge commit 'bd77f6e1c99e04a476f0b1bb4e44569134e02399' into release-0.87.0 2021-08-03 11:52:57 +02:00
Bjørn Erik Pedersen bd77f6e1c9 Squashed 'docs/' changes from 60a58d123..327003421
327003421 Update index.md
cafdccc13 Hugo 0.86.1
467a89a02 Merge branch 'v0861'
a22c37bc9 Merge branch 'release-0.86.1'
276da91a8 releaser: Add release notes to /docs for release of 0.86.1
198cdf8f0 tpl/lang: Add new localized versions of lang.FormatNumber etc.
93f986ecc Add timezone support for front matter dates without one
b30b876bb Localize time.Format
950fdab90 Fix AddDate documentation
78d7b52b6 Document config.cascade
fd1e1e4b7 Fix grammar and spelling (#1497)
05bf3aa32 Fix grammar / typos in news
32060a3b4 One more try
f6e24ddfa PNG to JPG for the rel notes image
9ec5bdfad Update index.md
5f5d7f69d Release Hugo 0.86.0
2dd60bb71 releaser: Add release notes to /docs for release of 0.86.0
6445fb36c Merge commit '53a352795a69a9d4a373f50ec62138595948c6ea'
cb57ca73a Simplify "active menu" logic for section menus

git-subtree-dir: docs
git-subtree-split: 327003421d
2021-08-03 11:51:36 +02:00
Bjørn Erik Pedersen 1c5b025dd0 docs: Adjust time zone docs 2021-08-03 11:51:28 +02:00
hugoreleaser c13d33dd5e releaser: Add release notes for 0.87.0
Rename to *-ready.md to continue.
[ci skip]
2021-08-03 08:45:16 +00:00
Bjørn Erik Pedersen d70c485707 Make sure module config loading errors have file positioning info
Fixes #8845
2021-08-03 09:57:14 +02:00
Bjørn Erik Pedersen 9ff17c3324 tpl/time: Adjust tests to handle matching local time zones
Closes #8843
2021-08-03 08:54:45 +02:00
Bjørn Erik Pedersen 7aaaf7e33a mod: Remove superflous replace statement 2021-08-02 20:33:13 +02:00
Bjørn Erik Pedersen 3a96655592 Reduce binary size vs locale, update to CLDR v36.1
Test building with `go build -ldflags="-s -w"`

Hugo 0.86.2: 46MB
Before this commit: 77MB
After this commit: 54MB

Fixes #8839
Fixes #8841
2021-08-02 19:40:32 +02:00
Joe Mooring 9a7383caf3 deps: Update github.com/tdewolff/minify/v2 v2.9.20 => v2.9.21
Closes #8831
2021-08-02 17:27:07 +02:00
Bjørn Erik Pedersen 6c70e1f22f Fix error handling for the time func alias
Fixes #8835
2021-08-01 13:39:30 +02:00
Bjørn Erik Pedersen 4d221ce468 Fail on invalid time zone
Fixes #8832
2021-08-01 13:39:30 +02:00
Bjørn Erik Pedersen e3dc5240f0 Improve handling of <nil> Params
Fixes #8825
2021-07-30 21:07:52 +02:00
Bjørn Erik Pedersen 268065cb2d Merge branch 'release-0.86.1' 2021-07-30 12:58:26 +02:00
hugoreleaser e0304c06ed releaser: Add release notes for 0.86.1
[ci skip]
2021-07-30 12:58:03 +02:00
hugoreleaser 7aa8b1cd7d releaser: Prepare repository for 0.87.0-DEV
[ci skip]
2021-07-30 10:54:50 +00:00
hugoreleaser f6821b88ab releaser: Add release notes to /docs for release of 0.86.1
[ci skip]
2021-07-30 10:13:32 +00:00
hugoreleaser 580d320a66 releaser: Bump versions for release of 0.86.1
[ci skip]
2021-07-30 10:13:32 +00:00
hugoreleaser b75d4526e4 releaser: Add release notes for 0.86.1
[ci skip]
2021-07-30 10:13:32 +00:00
Bjørn Erik Pedersen 94b616bdfa config: Fix a potential deadlock in config reading
Note that the deadlock has not been seen earlier, in tests on in real Hugo sites.

Fixes #8791
2021-07-30 11:53:27 +02:00
dependabot[bot] e90b3591a1 build(deps): bump github.com/evanw/esbuild from 0.12.16 to 0.12.17
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.12.16 to 0.12.17.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.12.16...v0.12.17)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-30 11:11:10 +02:00
dependabot[bot] 4b7da6a9d7 build(deps): bump github.com/getkin/kin-openapi from 0.67.0 to 0.68.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.67.0 to 0.68.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.67.0...v0.68.0)

---
updated-dependencies:
- dependency-name: github.com/getkin/kin-openapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-30 11:10:45 +02:00
Bjørn Erik Pedersen 7907d24ba1 tpl/lang: Add new localized versions of lang.FormatNumber etc.
Fixes #8820
2021-07-29 16:40:06 +02:00
Bjørn Erik Pedersen 726fe9c3c9 Go back to WARNING for Page deprecations
Do that in the next release, let's reduce the noise, we have enough changes as it is.
2021-07-29 16:18:38 +02:00
Bjørn Erik Pedersen b5de37ee79 Handle toml.LocalDate and toml.LocalDateTime in front matter
See #8801
2021-07-28 18:02:42 +02:00
Bjørn Erik Pedersen bf301daf15 deps: Upgrade github.com/pelletier/go-toml/v2 v2.0.0-beta.3 => v2.0.0-beta.3.0.20210727221244-fa0796069526 2021-07-28 17:27:31 +02:00
Bjørn Erik Pedersen a3701e0931 Switch to go-toml v2
We have been using `go-toml` for language files only. This commit makes it the only TOML library.

It's spec compliant and very fast.

A benchark building a site with 200 pages with TOML front matter:

```bash
name                                  old time/op    new time/op    delta
SiteNew/Regular_TOML_front_matter-16    48.5ms ± 1%    47.1ms ± 1%  -2.85%  (p=0.029 n=4+4)

name                                  old alloc/op   new alloc/op   delta
SiteNew/Regular_TOML_front_matter-16    16.9MB ± 0%    16.7MB ± 0%  -1.56%  (p=0.029 n=4+4)

name                                  old allocs/op  new allocs/op  delta
SiteNew/Regular_TOML_front_matter-16      302k ± 0%      296k ± 0%  -2.20%  (p=0.029 n=4+4)
```

Note that the front matter unmarshaling is only a small part of building a site, so the above is very good.

Fixes #8801
2021-07-28 11:51:13 +02:00
dependabot[bot] 40b6016cf3 build(deps): bump github.com/tdewolff/minify/v2 from 2.9.19 to 2.9.20
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.9.19 to 2.9.20.
- [Release notes](https://github.com/tdewolff/minify/releases)
- [Commits](https://github.com/tdewolff/minify/compare/v2.9.19...v2.9.20)

---
updated-dependencies:
- dependency-name: github.com/tdewolff/minify/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-28 11:21:50 +02:00
Bjørn Erik Pedersen 7e1305710f Add a TOML front matter benchmark 2021-07-27 19:27:54 +02:00
Bjørn Erik Pedersen efa5760db5 Add timezone support for front matter dates without one
Fixes #8810
2021-07-27 19:02:48 +02:00
Bjørn Erik Pedersen a57dda854b Localize time.Format
Fixes #8797
2021-07-27 19:02:48 +02:00
dependabot[bot] f9afba9335 build(deps): bump github.com/getkin/kin-openapi from 0.61.0 to 0.67.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.61.0 to 0.67.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.61.0...v0.67.0)

---
updated-dependencies:
- dependency-name: github.com/getkin/kin-openapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-27 16:25:09 +02:00
dependabot[bot] a5d2ba429d build(deps): bump github.com/spf13/cast from 1.3.1 to 1.4.0
Bumps [github.com/spf13/cast](https://github.com/spf13/cast) from 1.3.1 to 1.4.0.
- [Release notes](https://github.com/spf13/cast/releases)
- [Commits](https://github.com/spf13/cast/compare/v1.3.1...v1.4.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cast
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-27 15:37:30 +02:00
dependabot[bot] 31972f3647 build(deps): bump google.golang.org/api from 0.45.0 to 0.51.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.45.0 to 0.51.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/master/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.45.0...v0.51.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-27 15:04:20 +02:00
dependabot[bot] 2e58782f96 build(deps): bump github.com/sanity-io/litter from 1.5.0 to 1.5.1
Bumps [github.com/sanity-io/litter](https://github.com/sanity-io/litter) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/sanity-io/litter/releases)
- [Changelog](https://github.com/sanity-io/litter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sanity-io/litter/compare/v1.5.0...v1.5.1)

---
updated-dependencies:
- dependency-name: github.com/sanity-io/litter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-27 15:01:24 +02:00
dependabot[bot] 7b68f6524d build(deps): bump github.com/mattn/go-isatty from 0.0.12 to 0.0.13
Bumps [github.com/mattn/go-isatty](https://github.com/mattn/go-isatty) from 0.0.12 to 0.0.13.
- [Release notes](https://github.com/mattn/go-isatty/releases)
- [Commits](https://github.com/mattn/go-isatty/compare/v0.0.12...v0.0.13)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-isatty
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-27 14:58:39 +02:00
dependabot[bot] 81265af2cc build(deps): bump github.com/spf13/cobra from 1.1.3 to 1.2.1
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.1.3 to 1.2.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Changelog](https://github.com/spf13/cobra/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spf13/cobra/compare/v1.1.3...v1.2.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-27 14:05:28 +02:00
dependabot[bot] c102c9719b build(deps): bump github.com/mitchellh/mapstructure from 1.3.3 to 1.4.1
Bumps [github.com/mitchellh/mapstructure](https://github.com/mitchellh/mapstructure) from 1.3.3 to 1.4.1.
- [Release notes](https://github.com/mitchellh/mapstructure/releases)
- [Changelog](https://github.com/mitchellh/mapstructure/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitchellh/mapstructure/compare/v1.3.3...v1.4.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-27 13:16:44 +02:00
dependabot[bot] 7c0f904f29 build(deps): bump github.com/google/go-cmp from 0.5.5 to 0.5.6
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.5 to 0.5.6.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.5...v0.5.6)

---
updated-dependencies:
- dependency-name: github.com/google/go-cmp
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-27 12:42:16 +02:00
dependabot[bot] b2fbd4d13a build(deps): bump github.com/mitchellh/hashstructure from 1.0.0 to 1.1.0
Bumps [github.com/mitchellh/hashstructure](https://github.com/mitchellh/hashstructure) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/mitchellh/hashstructure/releases)
- [Commits](https://github.com/mitchellh/hashstructure/compare/v1.0.0...v1.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-27 12:36:11 +02:00
dependabot[bot] 90041d1b6d build(deps): bump github.com/gobuffalo/flect from 0.2.2 to 0.2.3
Bumps [github.com/gobuffalo/flect](https://github.com/gobuffalo/flect) from 0.2.2 to 0.2.3.
- [Release notes](https://github.com/gobuffalo/flect/releases)
- [Commits](https://github.com/gobuffalo/flect/compare/v0.2.2...v0.2.3)

---
updated-dependencies:
- dependency-name: github.com/gobuffalo/flect
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-27 10:07:34 +02:00
dependabot[bot] 05047096f5 build(deps): bump github.com/pelletier/go-toml from 1.9.0 to 1.9.3
Bumps [github.com/pelletier/go-toml](https://github.com/pelletier/go-toml) from 1.9.0 to 1.9.3.
- [Release notes](https://github.com/pelletier/go-toml/releases)
- [Commits](https://github.com/pelletier/go-toml/compare/v1.9.0...v1.9.3)

---
updated-dependencies:
- dependency-name: github.com/pelletier/go-toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-27 09:37:05 +02:00
dependabot[bot] a469156ea4 build(deps): bump github.com/aws/aws-sdk-go from 1.38.23 to 1.40.8
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.38.23 to 1.40.8.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.38.23...v1.40.8)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-26 21:21:26 +02:00
dependabot[bot] 18fdd85bcc build(deps): bump github.com/tdewolff/minify/v2 from 2.9.18 to 2.9.19
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.9.18 to 2.9.19.
- [Release notes](https://github.com/tdewolff/minify/releases)
- [Commits](https://github.com/tdewolff/minify/compare/v2.9.18...v2.9.19)

---
updated-dependencies:
- dependency-name: github.com/tdewolff/minify/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-26 20:23:32 +02:00
Bjørn Erik Pedersen aeb1935d44 deps: Update github.com/evanw/esbuild v0.11.16 => v0.12.16 2021-07-26 20:23:00 +02:00
Bjørn Erik Pedersen c7252224c4 Deprecate Blackfriday and fix a potential deadlock in config
Note that the deadlock has not been seen earlier, in tests on in real Hugo sites.

Fixes #8792
Fixes #8791
2021-07-26 16:28:16 +02:00
Bjørn Erik Pedersen e09d7882c8 deps: Update github.com/yuin/goldmark v1.3.9 => v1.4.0 2021-07-26 14:54:56 +02:00
dependabot[bot] 15c0eed048 build(deps): bump github.com/frankban/quicktest from 1.12.0 to 1.13.0
Bumps [github.com/frankban/quicktest](https://github.com/frankban/quicktest) from 1.12.0 to 1.13.0.
- [Release notes](https://github.com/frankban/quicktest/releases)
- [Commits](https://github.com/frankban/quicktest/compare/v1.12.0...v1.13.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-26 11:31:33 +02:00
Bjørn Erik Pedersen 91cbb96302 Bump all long-living deprecations to ERRORs 2021-07-25 17:17:21 +02:00
Digitalcraftsman a352d19d88 Fix theme count in release notes 2021-07-21 16:35:38 +02:00
hugoreleaser 11bb67dcfd releaser: Prepare repository for 0.87.0-DEV
[ci skip]
2021-07-21 11:13:04 +00:00
hugoreleaser 41c6c52ead releaser: Add release notes to /docs for release of 0.86.0
[ci skip]
2021-07-21 09:53:11 +00:00
hugoreleaser d270eaf4fc releaser: Bump versions for release of 0.86.0
[ci skip]
2021-07-21 09:53:11 +00:00
Bjørn Erik Pedersen b2e67505f8 Release 0.86.0 2021-07-21 11:37:16 +02:00
Bjørn Erik Pedersen 32508045d3 navigation: Check Page first in URL()
In Hugo #8776 we added `pageRef`, a way to connect menu items in site config to pages.

This means that you now can have both a Page and a configured URL.

Having the configured URL as a fallback if the Page isn't found is obviously more useful, especially in multilingual sites.

See #8776
2021-07-21 11:36:15 +02:00
Bjørn Erik Pedersen e521c9a36d Update 0.86.0-relnotes.md
[ci skip]
2021-07-21 11:28:32 +02:00
hugoreleaser dfb1cc4315 releaser: Add release notes for 0.86.0
Rename to *-ready.md to continue.
[ci skip]
2021-07-21 09:04:02 +00:00
Bjørn Erik Pedersen 0294a4a4f8 Merge commit '53a352795a69a9d4a373f50ec62138595948c6ea' 2021-07-21 10:45:53 +02:00
Bjørn Erik Pedersen 53a352795a Squashed 'docs/' changes from 6ebb5dad9..60a58d123
60a58d123 Remove outdated references in scss-sass.md
225a03834 Revert "Update menus.md"
7d149dd1e Update menus.md
3694ecafc Fix theme submission process/repository
0277c202c Update index.md - fix typo (#1490)
8921f0462 Fix link to theme components in 0.42 release notes (#1489)
c948bd519 Release 0.85.0
ee5bc5be9 releaser: Add release notes to /docs for release of 0.85.0
f2f692c32 commands: Make the --poll flag a duration
13070337a docs: Regen CLI docs

git-subtree-dir: docs
git-subtree-split: 60a58d123d
2021-07-21 10:45:05 +02:00
Bjørn Erik Pedersen 351ed0f569 commands: Fix panic on invalid config in "hugo mod get" and similar
Fixes #8773
2021-07-20 18:23:09 +02:00
Bjørn Erik Pedersen d831d2fce8 Simplify "active menu" logic for section menus
Fixes #8776
2021-07-20 17:50:59 +02:00
Bjørn Erik Pedersen 634481ba8c Fix Params case handling for menu items defined in site config
Fixes #8775
2021-07-20 17:50:59 +02:00
Bjørn Erik Pedersen c19f65f956 minifiers: Make keepWhitespace = true default for HTML
Fixes #8771
2021-07-19 23:35:20 +02:00
Bjørn Erik Pedersen 022c479551 hugofs: Make FileMeta a struct
This commit started out investigating a `concurrent map read write` issue, ending by replacing the map with a struct.

This is easier to reason about, and it's more effective:

```
name                                  old time/op    new time/op    delta
SiteNew/Regular_Deep_content_tree-16    71.5ms ± 3%    69.4ms ± 5%    ~     (p=0.200 n=4+4)

name                                  old alloc/op   new alloc/op   delta
SiteNew/Regular_Deep_content_tree-16    29.7MB ± 0%    27.9MB ± 0%  -5.82%  (p=0.029 n=4+4)

name                                  old allocs/op  new allocs/op  delta
SiteNew/Regular_Deep_content_tree-16      313k ± 0%      303k ± 0%  -3.35%  (p=0.029 n=4+4)
```

See #8749
2021-07-15 17:14:26 +02:00
rhymes f27e542442 markup: Add tabindex="0" to default <pre> wrapper
Currently the generated `<pre>` element isn't fully accessible as it can't be focused by keyboard users.
To make this fully accessible, the attribute `tabindex="0"` should be added to the `<pre>` tag.

Closes #7194
2021-07-15 16:48:39 +02:00
Bjørn Erik Pedersen ae6cf93c84 Fix default values when loading from config dir
By waiting until we've loaded the config dir config before applying the default values.

Fixes #8763
2021-07-15 16:15:32 +02:00
Bjørn Erik Pedersen a70da2b74a Fix the deprecation error/warn log levels 2021-07-15 12:24:20 +02:00
Bjørn Erik Pedersen 805664818d markup/goldmark: Rename/reorder the hook methods
To make them easier to follow.

See #8755
2021-07-15 10:14:52 +02:00
Bjørn Erik Pedersen ee3d2bb1d3 markup/goldmark: Support auto links in render hook
Fixes #8755
2021-07-15 10:14:52 +02:00
Bjørn Erik Pedersen eb2a500367 Adjust a test helper 2021-07-14 21:47:26 +02:00
Bjørn Erik Pedersen 5cb52c2315 Add config.cascade
This commit adds support for using the `cascade` keyword in your configuration file(s), e.g. `config.toml`.

Note that

* Every feature of `cascade` is available, e.g. `_target` to target specific page sets.
* Pages, e.g. the home page, can overwrite the cascade defined in config.

Fixes #8741
2021-07-10 11:13:41 +02:00
Bjørn Erik Pedersen 30eea3915b resources: Regenerate image golden testdata
Keep this as a separate commit as this isn't because the files have changed. The filenames have changed due to cache busting of PNG and Webp images.

See #8729
2021-07-07 17:25:14 +02:00
Bjørn Erik Pedersen 8f40f34cd1 Fix transparency problem when converting 32-bit images to WebP
Fixes #8729
2021-07-07 17:25:14 +02:00
hugoreleaser 8ddbc95466 releaser: Prepare repository for 0.86.0-DEV
[ci skip]
2021-07-05 11:37:38 +00:00
hugoreleaser 724d5db580 releaser: Add release notes to /docs for release of 0.85.0
[ci skip]
2021-07-05 10:46:25 +00:00
hugoreleaser 875fe4050c releaser: Bump versions for release of 0.85.0
[ci skip]
2021-07-05 10:46:25 +00:00
Bjørn Erik Pedersen 56362e4bc7 Update 0.85.0-relnotes.md 2021-07-05 12:38:14 +02:00
hugoreleaser f5cfb9e251 releaser: Add release notes for 0.85.0
Rename to *-ready.md to continue.
[ci skip]
2021-07-05 10:27:32 +00:00
John Hollowell 04dc469fbd commands: Move time notification to after any build errors
This allows error parsers (VSCode problemMatchers) to use the time notification as bounds for detecting errors.

Closes #8403
2021-07-05 10:38:54 +02:00
Brandon Woodford 07919d1ccb exif: Log warning for metadata decode error
see #8519
2021-07-05 10:31:35 +02:00
Raoul f75f90079a Fix tab selection of disabled items in internal pagination template 2021-07-05 10:30:59 +02:00
Bjørn Erik Pedersen e31b1d1946 commands: Make the --poll flag a duration
So you can do:

```
hugo server --poll 700ms
```

See #8720
2021-07-05 10:23:29 +02:00
Bjørn Erik Pedersen 43a23239b2 docs: Regen CLI docs 2021-07-04 16:35:21 +02:00
Bjørn Erik Pedersen 4479f09c9c Merge commit '7eb0e10a80708c638554b8221a3120dc1168566c' 2021-07-04 16:34:53 +02:00
Bjørn Erik Pedersen 7eb0e10a80 Squashed 'docs/' changes from 710856e5a..6ebb5dad9
6ebb5dad9 Remove file
27cc23ef4 Hugo 0.84.4
94dccbfa4 Merge branch 'tempv0.84.4'
e9d8b61fb releaser: Add release notes to /docs for release of 0.84.4
51e472005 Improve readability of examples on shortcode templates page
0aef26479 Fix lookup order typos (#1484)
534a527fe Fix two typos (#1483)
394aabd5a Higo "0.84.3
03ee92c1c Merge branch 'tempv0.84.3'
96a8be0f1 releaser: Add release notes to /docs for release of 0.84.3
9a770323f Update index.md
7f65cfcbe Hugo 0.84.2
444422515 releaser: Add release notes to /docs for release of 0.84.2
a2f29c5d8 modules: Add module.import.noMounts config
e00e4a7e7 releaser: Add release notes to /docs for release of 0.84.2
af04b53b3 modules: Add module.import.noMounts config
f7d5669c7 Remove Appernetic (#1481)
14f8d4029 Clarify interaction of sections and top-level leaf bundles
d140b6a62 Update lookup-order.md
399904959 Update shortcode-templates.md
e78aa4865 Hugo 0.84.1
35d7c1c22 Merge branch 'tempv0.84.1'
a6be65b0d releaser: Add release notes to /docs for release of 0.84.1
7b3b3ca45 Hugo 0.84.0 News Grammar fixes
cbc23bf5a Remove trailing newlines
69349198d Fix erroridf docs
dbc1157c1 Fix missing deep

git-subtree-dir: docs
git-subtree-split: 6ebb5dad9a
2021-07-04 16:34:26 +02:00
Bjørn Erik Pedersen 24ce98b6d1 Add polling as a fallback to native filesystem events in server watch
Fixes #8720
Fixes #6849
Fixes #7930
2021-07-04 16:12:28 +02:00
Bjørn Erik Pedersen 0019d60f67 deps: Bump github.com/yuin/goldmark v1.3.9
Closes #8727
2021-07-04 15:48:33 +02:00
Bjørn Erik Pedersen e451b984cf Fix panic when theme has permalinks config
Fixes #8724
2021-07-03 15:53:21 +02:00
hugoreleaser b4d60b3db1 releaser: Prepare repository for 0.85.0-DEV
[ci skip]
2021-07-01 12:59:47 +00:00
hugoreleaser 020e4acee4 releaser: Add release notes to /docs for release of 0.84.4
[ci skip]
2021-07-01 11:51:53 +00:00
hugoreleaser 4c34faf426 releaser: Bump versions for release of 0.84.4
[ci skip]
2021-07-01 11:51:53 +00:00
hugoreleaser a339f62664 releaser: Add release notes for 0.84.4
[ci skip]
2021-07-01 11:51:53 +00:00
Bjørn Erik Pedersen 4c8552b114 Fix Cloudflare vs Netlify cache dir issue
Re-add the additional environment checks to determine if its Netlify. Seems that Cloudflare also sets `NETLIFY=true`.

This makes it look, basically, like a variant of the conditional we had before we started fixing this, but I have checked this logic on Netlify now and it should work.

Fixes #8714
2021-06-30 12:58:43 +02:00
Joe Mooring 34e4742f0c Fix date format in schema and opengraph templates
Fixes #8671
2021-06-29 20:20:38 +02:00
hugoreleaser bffa2a2a98 releaser: Prepare repository for 0.85.0-DEV
[ci skip]
2021-06-29 12:27:15 +00:00
hugoreleaser a1b0353ccb releaser: Add release notes to /docs for release of 0.84.3
[ci skip]
2021-06-29 11:40:19 +00:00
hugoreleaser bc6f84c581 releaser: Bump versions for release of 0.84.3
[ci skip]
2021-06-29 11:40:19 +00:00
hugoreleaser 80410257e3 releaser: Add release notes for 0.84.3
[ci skip]
2021-06-29 11:40:19 +00:00
Bjørn Erik Pedersen 6c8c0c8b6a config: Fix Netlify default cache dir logic
Fixes #8710
2021-06-29 09:51:09 +02:00
Bjørn Erik Pedersen 49fedbc51c config: Fix handling of invalid OS env config overrides
Fixes #8709
2021-06-29 09:38:05 +02:00
hugoreleaser 8290720107 releaser: Prepare repository for 0.85.0-DEV
[ci skip]
2021-06-28 11:41:38 +00:00
hugoreleaser e0c67958f1 releaser: Add release notes to /docs for release of 0.84.2
[ci skip]
2021-06-28 10:59:18 +00:00
hugoreleaser f6b9ce6ebd releaser: Bump versions for release of 0.84.2
[ci skip]
2021-06-28 10:59:18 +00:00
hugoreleaser 4b03399b78 releaser: Add release notes for 0.84.2
[ci skip]
2021-06-28 10:59:18 +00:00
Bjørn Erik Pedersen 40dfdd0952 modules: Add module.import.noMounts config
Fixes #8708
2021-06-28 10:39:52 +02:00
Bjørn Erik Pedersen 3a6dc6d3f4 modules: Use value type for module.Time
Which is in line with how we do it elsewhere.
2021-06-27 18:06:52 +02:00
Bjørn Erik Pedersen 6cd2110ab2 commands: Add version time to "hugo config mounts" 2021-06-27 18:00:20 +02:00
Bjørn Erik Pedersen 6a365c2712 commands: Add some more info to "hugo config mounts"
* Add owner path and version.
* Also add thme meta info and Hugo version when run with -v flag
2021-06-27 16:08:28 +02:00
Bjørn Erik Pedersen 19aa95fc7f Fix config handling with empty config entries after merge
Fixes #8701
2021-06-27 15:01:56 +02:00
Bjørn Erik Pedersen 923dd9d1c1 Fix config loading for "hugo mod init"
We have some commands that will continue even if the config loading fails (e.g. because a module can not be found). In Hugo 0.84.0 we introduced a new `_merge` flag that we removed once the configuration was loaded. But we did not do that in error situations, leading to failures in some situations.

This commit fixes that by making sure the configuration is always cleaned before return, even in error situations.

Fixes #8697
2021-06-27 12:03:43 +02:00
Bjørn Erik Pedersen d9bdd37d35 deps: Update to Minify v2.9.18
Closes #8693
2021-06-26 17:15:55 +02:00
digitalcraftsman b2eaf4c8c2 Remove credit from release notes 2021-06-25 21:14:11 +02:00
hugoreleaser efb6ee6c1c releaser: Prepare repository for 0.85.0-DEV
[ci skip]
2021-06-24 12:33:45 +00:00
hugoreleaser 4bd65e224f releaser: Add release notes to /docs for release of 0.84.1
[ci skip]
2021-06-24 11:44:21 +00:00
hugoreleaser ff2266300a releaser: Bump versions for release of 0.84.1
[ci skip]
2021-06-24 11:44:21 +00:00
hugoreleaser 8677cfb04f releaser: Add release notes for 0.84.1
[ci skip]
2021-06-24 11:44:21 +00:00
Bjørn Erik Pedersen 093dacab29 Fix language menu config regression
Fixes #8672
2021-06-24 13:03:09 +02:00
Bjørn Erik Pedersen 4a9d408fe0 config: Fix merge of config with map[string]string values.
Fixes #8679
2021-06-22 21:38:28 +02:00
Bjørn Erik Pedersen 9312059888 releaser: Bump to Goreleaser v0.171.0
Closes #8665
2021-06-21 16:12:18 +02:00
Bjørn Erik Pedersen a7e3da242f markup: Rename Header(s) to Heading(s) in ToC struct
Because that is what it is.
2021-06-19 18:19:46 +02:00
Bjørn Erik Pedersen b70a12ec45 Merge commit '4dd90050f154c91373329a5d7e348289c40be12f' 2021-06-18 17:50:27 +02:00
Bjørn Erik Pedersen 4dd90050f1 Squashed 'docs/' changes from 3a923e155..710856e5a
710856e5a Release 0.84.0
362f4ea7b releaser: Add release notes to /docs for release of 0.84.0
6bb8800f7 docs: Regenerate docs helper
00a522e6a docs: Regenerate docshelper
bc171954b Merge commit '92405e5b0adc5d8c3dfde88d6a8b67eb09169190'
ef73ffc3b Misc config loading fixes
0b4117f7f docs: Regenerate docs helper
9b9452b9c Merge commit '32ba623541d74ee0b7ae4efb1b8326dc49af28b8'
9c4413dd9 tpl/fmt: Add erroridf template func
e1875742e tpl/data: Misc header improvements, tests, allow multiple headers of same key
e4560893c Add math.Max and math.Min
7dc282eaf common/maps: Add Scratch.DeleteInMap
b9cd77171 docs: Update querify function description and examples

git-subtree-dir: docs
git-subtree-split: 710856e5a6
2021-06-18 17:49:54 +02:00
hugoreleaser 3d544c9ae4 releaser: Prepare repository for 0.85.0-DEV
[ci skip]
2021-06-18 15:36:43 +00:00
hugoreleaser 2c4689f7b8 releaser: Add release notes to /docs for release of 0.84.0
[ci skip]
2021-06-18 14:55:51 +00:00
hugoreleaser 9c0860f749 releaser: Bump versions for release of 0.84.0
[ci skip]
2021-06-18 14:55:51 +00:00
Bjørn Erik Pedersen a1694b06af releaser: Increase timeout 2021-06-18 16:44:12 +02:00
hugoreleaser 219ec38007 releaser: Add release notes for 0.84.0 2021-06-18 14:42:14 +02:00
Bjørn Erik Pedersen be6b901cf7 docs: Regenerate docs helper 2021-06-18 13:21:10 +02:00
Bjørn Erik Pedersen 643b671931 output: Make WebAppManifestFormat NotAlternative=true
Updates #8624
2021-06-18 13:19:37 +02:00
Bjørn Erik Pedersen ab4e1dfa4e media: Adjust test assertion
Closes #8625
2021-06-18 13:15:00 +02:00
Rohan Kumar 02f31897b4 media: support application/manifest+json
The standard file extension for Web App Manifest files is
".webmanifest". This commit allows Hugo to recognize .webmanifest files
as "application/manifest+json" files and to minify them using its
JSON minifier.

The .webmanifest file extension is recommended in the w3c spec to
simplify media type registration:
https://www.w3.org/TR/appmanifest/#media-type-registration

Webhint docs are also relevant:
https://webhint.io/docs/user-guide/hints/hint-manifest-file-extension/

Closes #8624
2021-06-18 13:11:44 +02:00
Bjørn Erik Pedersen 402da3f8f3 docs: Regenerate docshelper 2021-06-18 12:58:07 +02:00
Bjørn Erik Pedersen 92405e5b0a Squashed 'docs/' changes from 4c81c6c2a..3a923e155
3a923e155 Update configuration.md

git-subtree-dir: docs
git-subtree-split: 3a923e1550
2021-06-18 12:57:19 +02:00
Bjørn Erik Pedersen a074f758b0 Merge commit '92405e5b0adc5d8c3dfde88d6a8b67eb09169190' 2021-06-18 12:57:19 +02:00
Bjørn Erik Pedersen bb2aa08709 Implement configuration in a directory for modules
Fixes #8654
2021-06-18 12:54:30 +02:00
Bjørn Erik Pedersen 9096842b04 tpl: Rename err-missing-instagram-accesstoken => error-missing-instagram-accesstoken
To get it in line with the other.
2021-06-18 12:27:37 +02:00
Bjørn Erik Pedersen 3aa7f0b27f deps: Update github.com/alecthomas/chroma v0.9.1 => v0.9.2
Closes #8658
2021-06-18 12:14:52 +02:00
Bjørn Erik Pedersen 9b870aa788 deps: Run go mod tidy 2021-06-18 12:13:17 +02:00
Bjørn Erik Pedersen 93aad3c543 Split out the puthe path/filepath functions into common/paths
So they can be used from the config package without cyclic troubles.

Updates #8654
2021-06-18 10:55:00 +02:00
Bjørn Erik Pedersen 5af045ebab resources/image: Fix fill with smartcrop sometimes returning 0 bytes images
Fixes #7955
2021-06-17 23:52:27 +02:00
Joe Mooring 8eafe0845d deps: Update to Goldmark v1.3.8
Fixes #8648
2021-06-17 19:34:26 +02:00
Bjørn Erik Pedersen 31fb29fb3f Do not read config from os.Environ when running tests
Fixes #8655
2021-06-16 18:58:40 +02:00
Bjørn Erik Pedersen d392893cd7 Misc config loading fixes
The main motivation behind this is simplicity and correctnes, but the new small config library is also faster:

```
BenchmarkDefaultConfigProvider/Viper-16         	  252418	      4546 ns/op	    2720 B/op	      30 allocs/op
BenchmarkDefaultConfigProvider/Custom-16        	  450756	      2651 ns/op	    1008 B/op	       6 allocs/op
```

Fixes #8633
Fixes #8618
Fixes #8630
Updates #8591
Closes #6680
Closes #5192
2021-06-14 17:00:32 +02:00
Bjørn Erik Pedersen a886dd53b8 github: Set a dummy Instagram token
For now, need to debug why this fails.
2021-06-13 11:09:50 +02:00
Bjørn Erik Pedersen a91cd7652f docs: Regenerate docs helper 2021-06-08 18:52:38 +02:00
Bjørn Erik Pedersen 162f41d0ef Merge commit '32ba623541d74ee0b7ae4efb1b8326dc49af28b8' 2021-06-08 18:47:53 +02:00
Bjørn Erik Pedersen 32ba623541 Squashed 'docs/' changes from bcc4f9324..4c81c6c2a
4c81c6c2a live reload: add section about `--navigateToChanged`
271014257 Update netify hugo version to 0.83.1
14199cff1 Add pull_request event
0c33b05de Hosting on GitHub: Little wording fixes and update Ubuntu runner in example workflow to 20.04 (#1457)
e47b6c33a Hugo Modules plural typo (#1266)
0f2bbacdd Add node_modules to .gitignore
1d645d79f Overhaul scratch.md (#1451)
572766889 Add link to golang regex syntax, change modified date
21b0c7459 Add info about contentType config
de7d96fa2 Document Go template's multiline support
0c8f2dcb1 Avoid scratch usage
696fa92e1 Rename scratch var
44193f267 Update usage instructions
4230f8fa5 Rename and refactor shortcode
e9953751e Strip leading whitespaces
d61a58010 Add `insertpages` shortcode
04d30677d Mention WebP under 'Target Format' (#1431)
946784508 Update lookup-order.md (#1443)
a7b587988 Update index.md
27907f7ea netlify: Hugo 0.83.1
044d37e57 Merge branch 'tempv0.83.1'
b81aedb03 Fix page `.Kind`
fcf7775ad releaser: Add release notes to /docs for release of 0.83.1
9b39c77c8 fix typo in 0.83 release notes
1c38993ce Update index.md
45b8aefa6 Update index.md
43902dfaa Update index.md
3d959c7ae Merge branch 'tempv0.83.0'
6c22dc327 Fix URL
497ea3224 Use Hugo version badge shortcode
a182d10dd releaser: Add release notes to /docs for release of 0.83.0
287fd9ac0 docs: Fix shortcode
e789c879a docs: Regenerate docs helper
1666c7f31 docs: Regenerate CLI docs
117de1d12 Merge commit 'c239c643fee10bfa217cb108755b798f8f5f3b10'
a6bf3f7d9 docs: Regen docs helper

git-subtree-dir: docs
git-subtree-split: 4c81c6c2ac
2021-06-08 18:46:58 +02:00
Bjørn Erik Pedersen 552cef5c57 Update to Go 1.16.5, Goreleaser 0.169.0
Fixes #8619
Fixes #8263
2021-06-08 18:46:35 +02:00
Joe Mooring 73483d0f9e tpl: Add a terse pagination template variant to improve performance
These calls are equivalent:

{{ template "_internal/pagination.html" . }}
{{ template "_internal/pagination.html" (dict "page" .) }}
{{ template "_internal/pagination.html" (dict "page" . "format" "default") }}

To use an alternate format:

{{ template "_internal/pagination.html" (dict "page" . "format" "terse") }}

Fixes #8599
2021-06-08 10:41:21 +02:00
Bjørn Erik Pedersen 9b5debe4b8 Upgrade Instagram shortcode
Fixes #7879
2021-06-08 10:30:45 +02:00
Bjørn Erik Pedersen 12530519d8 Fix nested OS env config override when parent does not exist
Fixes #8618
2021-06-08 09:57:18 +02:00
Bjørn Erik Pedersen f55d2f4376 tpl/fmt: Add erroridf template func
Fixes #8613
2021-06-07 19:11:03 +02:00
Bjørn Erik Pedersen 282f1aa3db tpl/data: Print response body on HTTP errors
Which makes it easier to debug.
2021-06-07 12:06:27 +02:00
Bjørn Erik Pedersen fcd63de3a5 tpl/data: Misc header improvements, tests, allow multiple headers of same key
Closes #5617
2021-06-06 13:32:12 +02:00
Paul Chamberlain 150d75738b tpl/data: Allows user-defined HTTP headers with getJSON and getCSV
Updates #5617
2021-06-06 13:32:12 +02:00
Bjørn Erik Pedersen 06d295427f hugofs: Set modTime at creation time
As `ModTime()` should return the same value on each invocation.

See #6161
2021-06-05 11:45:56 +02:00
Anthony Fok 26ae12c0c6 Fix invalid timestamp of the "public" folder
Special thanks to both Richard Mortimer (@oldelvet) and
Joshua M. Clulow (@jclulow) for their analysis and suggested fix:

 * https://github.com/gohugoio/hugo/issues/6161#issuecomment-574336088
 * https://github.com/gohugoio/hugo/issues/6161#issuecomment-596805273

Fixes #6161
2021-06-04 14:50:30 -06:00
卜木 ee733085b7 config: Fix env split to allow = character in values
Fixes #8589
2021-05-30 20:25:37 +02:00
Joe Mooring 01758f99b9 Add math.Max and math.Min
Closes #8583
2021-05-28 20:38:45 +02:00
satotake 845a7ba4fc Catch incomplete shortcode error
Currently, no name shortcodes (`{{< >}}`) enter unexpected branch and
throw `BUG: template info not set`. This patch checks if shortcode has
name or not earlier and throws specific error.

Closes #6866
2021-05-24 14:59:02 +02:00
Joe Mooring 10f60de89a Use SPDX license identifier
See <https://spdx.org/licenses/>
Fixes #8555
2021-05-24 11:54:46 +02:00
satotake 785a31b5b8 navigation: Cache and copy Menu for sorting
.Site.Menus is mutated when it is sorted for now and this causes concurrency problem (#7594)
In this patch, each related sort function copies Menu before sorting to prevent
race condition.

Pages already have such a sort and cache logic and this patch is identical to it.

Closes #7594
2021-05-23 10:42:01 +02:00
Bjørn Erik Pedersen bc1e05286a deps: Update to LibSASS 3.6.5
See https://github.com/sass/libsass/releases/tag/3.6.5
2021-05-23 10:33:56 +02:00
Bjørn Erik Pedersen f518b4f71e publisher: Make the HTML element collector more robust
Fixes #8530
2021-05-19 20:43:49 +02:00
Bjørn Erik Pedersen dc6b7a75ff Revert "publisher: Make the HTML element collector more robust"
This reverts commit ef0f1a7269.
2021-05-19 03:45:36 +02:00
Bjørn Erik Pedersen 3f515f0e33 Revert "publisher: Get the collector in line with the io.Writer interface"
This reverts commit a9bcd38181.
2021-05-19 03:45:30 +02:00
Bjørn Erik Pedersen a9bcd38181 publisher: Get the collector in line with the io.Writer interface
As in: Do not retain the input slice.
2021-05-17 19:39:40 +02:00
Bjørn Erik Pedersen ef0f1a7269 publisher: Make the HTML element collector more robust
Fixes #8530
2021-05-17 17:15:32 +02:00
meehawk abbc99d4c6 common/maps: Add Scratch.DeleteInMap
Add Scratch.DeleteInMap method. This method works similar to Scratch.SetInMap. It takes in two string parameters, key and mapKey and deletes the value mapped to mapKey in key

Closes #8504
2021-05-17 15:45:33 +02:00
Joe Mooring 76c95f55a5 Display version when building site (#8533)
Closes #8531
2021-05-14 16:45:13 +02:00
Joe Mooring 2c7f5b62f6 docs: Update querify function description and examples
The querify function now accepts a slice per #8305.
2021-05-10 17:18:37 +02:00
Ujjwal Goyal c46fc838a9 tpl: Allow 'Querify' to take lone slice/interface argument
Querify can now take a lone string/interface slice (with string
keys) as a parameter, or multiple string parameters, to build
URL queries.

Querify earlier used 'Dictionary' to add key/value pairs to a
map to build URL queries. Changed to dynamically generate ordered
key/value pairs. Cannot take string slice as key (earlier
possible due to Dictionary).

Added tests and benchmarks for querify.

Closes #6735
2021-05-09 13:14:14 +02:00
Shohei Ueda 504c78da4b modules/npm: Change SetEscapeHTML to false
Closes #8512
2021-05-09 00:20:28 +02:00
Bjørn Erik Pedersen b660ea8d54 Add a benchmark 2021-05-04 17:59:04 +02:00
Bjørn Erik Pedersen 64f88f3011 readme: Update dependency list 2021-05-03 15:55:28 +02:00
Julien Midedji 7a2c10ae60 tpl: Fix countwords to handle special chars
Fixes #8479
2021-05-03 09:10:06 +02:00
hugoreleaser e1c328df25 releaser: Prepare repository for 0.84.0-DEV
[ci skip]
2021-05-02 15:28:40 +00:00
hugoreleaser 5afe0a57d0 releaser: Add release notes to /docs for release of 0.83.1
[ci skip]
2021-05-02 14:38:02 +00:00
hugoreleaser 8900e33918 releaser: Bump versions for release of 0.83.1
[ci skip]
2021-05-02 14:38:02 +00:00
hugoreleaser 9753e1b9c5 releaser: Add release notes for 0.83.1
[ci skip]
2021-05-02 14:38:02 +00:00
Bjørn Erik Pedersen ececd1b122 langs/i18n: Fix warning regression in i18n
Fix this by

1. Making sure that only numerical values are treated as plural counts
2. Making sure that `i18n.pluralFormNotFoundError` is not logged as a warning if `other` resolved.

Note that 2. isn't a new problem, but became visible because of the plural improvements in Hugo `0.83.0`.

Fixes #8492
2021-05-02 16:27:22 +02:00
hugoreleaser b0ca723eb2 releaser: Prepare repository for 0.84.0-DEV
[ci skip]
2021-05-01 12:56:59 +00:00
hugoreleaser 4c65ceccc7 releaser: Add release notes to /docs for release of 0.83.0
[ci skip]
2021-05-01 12:10:05 +00:00
hugoreleaser 57a471a0db releaser: Bump versions for release of 0.83.0
[ci skip]
2021-05-01 12:10:05 +00:00
Bjørn Erik Pedersen 9b63af55bd Update 0.83.0-relnotes.md 2021-05-01 13:53:25 +02:00
Bjørn Erik Pedersen 23fc65832c docs: Fix shortcode 2021-05-01 13:01:23 +02:00
hugoreleaser e7b5e36e04 releaser: Add release notes for 0.83.0
Rename to *-ready.md to continue.
[ci skip]
2021-05-01 10:23:21 +00:00
Bjørn Erik Pedersen a9b52b4175 docs: Regenerate docs helper 2021-05-01 12:06:24 +02:00
Bjørn Erik Pedersen b073a1c972 docs: Regenerate CLI docs 2021-05-01 12:05:31 +02:00
Bjørn Erik Pedersen 4227cc1bd3 commands: Remove all dates from gendoc
It creates lots of diffs even if there are no changes.
2021-05-01 12:03:56 +02:00
Bjørn Erik Pedersen c239c643fe Squashed 'docs/' changes from fb551cc75..bcc4f9324
bcc4f9324 Add transparent background in rgba for search field
fce835fea Trim newlines from .Inner in the 'code' shortcode
9117f54b3 Remove code toggle from netlify.toml
babbb9090 fix version number - 404 error
d28cf15e1 The input search is not displayed correctly in Safari because of the one declaration CSS background property. Safari needs the no-repeat to be after position and size property. Adjusting the search icon to be vertically on center.
f4ef4c146 Repairing link from issue 131 using jamesrhea's comment https://github.com/gohugoio/hugoDocs/issues/131#issuecomment-324083739
7f73f5685 Update related.md (#1436)
41d24297c Mention `not` (#1432)

git-subtree-dir: docs
git-subtree-split: bcc4f93242
2021-05-01 11:45:45 +02:00
Bjørn Erik Pedersen d7b22aee46 Merge commit 'c239c643fee10bfa217cb108755b798f8f5f3b10' 2021-05-01 11:45:45 +02:00
Bjørn Erik Pedersen 3cc4fdd6f3 deps: Update getkin/kin-openapi v0.60.0 => v0.61. 2021-04-30 14:27:21 +02:00
Bjørn Erik Pedersen 7eb80a9e6f langs/i18n: Fix multiple unknown language codes
This fixes a bug upstream by temporarily using a patched version of go-i18n.

Closes #7838
2021-04-30 14:26:49 +02:00
Bjørn Erik Pedersen 78c1a6a7c6 deps: Update github.com/evanw/esbuild v0.11.14 => v0.11.16 2021-04-30 12:43:39 +02:00
Joe Mooring f6745ad358 Remove .Site.Authors from embedded templates
Closes #4458
2021-04-29 17:07:05 +02:00
Robert van Gent f523e9f0fd deploy: Don't treat a NotFound response for Delete as a fatal error. 2021-04-29 07:07:01 +02:00
Anthony Fok 63cd05ce5a snap: Switch to deb packages of nodejs and python3-pygments
node/14/stable snap package is not available on ppc64el and s390x.

nodejs deb package currently at 10.19.0~dfsg-3ubuntu1
in Ubuntu 20.04 LTS (base: core20)
2021-04-27 09:04:24 -06:00
Anthony Fok 902535ef11 snapcraft.yaml: Install bin/node from node/14/stable
Resolves regression introduced in my previous commit 243951e.
Special thanks to @jmooring for reporting the issue!

TODO: Strip the bin/node binary?
2021-04-26 10:17:44 -06:00
dependabot[bot] 70aebba04d build(deps): bump github.com/getkin/kin-openapi from 0.55.0 to 0.60.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.55.0 to 0.60.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.55.0...v0.60.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-26 10:56:48 +02:00
dependabot[bot] 3e3b7d4474 build(deps): bump github.com/evanw/esbuild from 0.11.13 to 0.11.14
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.11.13 to 0.11.14.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.11.13...v0.11.14)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-26 10:56:03 +02:00
Bjørn Erik Pedersen c13d368746 resources/page: Fix permalinks pattern detection for some of the sections variants
See #8363
2021-04-25 16:57:09 +02:00
Carlos Alexandro Becker 048418ba74 deps: Update to Chroma v0.9.1 2021-04-25 11:14:25 +02:00
Bjørn Erik Pedersen eebde0c2ac langs/i18n: Improve plural handling of floats
The go-i18n library expects plural counts with floats to be represented as strings.

Fixes #8464
2021-04-25 11:12:30 +02:00
Bjørn Erik Pedersen e4dc9a82b5 tpl/collections: Fix where on type mismatches
Fixes #8353
2021-04-23 18:06:49 +02:00
Bjørn Erik Pedersen 0d86a32d8f Make the shortcode template lookup for output formats stable
Fixes #7774
2021-04-23 15:04:35 +02:00
dependabot[bot] 65c502cc81 build(deps): bump github.com/evanw/esbuild from 0.11.12 to 0.11.13
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.11.12 to 0.11.13.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.11.12...v0.11.13)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-23 09:03:16 +02:00
Bjørn Erik Pedersen 537c905ec1 langs/i18n: Revise the plural implementation
There were some issues introduced with the plural counting when we upgraded from v1 to v2 of go-i18n.

This commit improves that situation given the following rules:

* A single integer argument is used as plural count and passed to the i18n template as a int type with a `.Count` method. The latter is to preserve compability with v1.
* Else the plural count is either fetched from the `Count`/`count` field/method/map or from the value itself.
* Any data type is accepted, if it can be converted to an integer, that value is used.

The above means that you can now do pass a single integer and both of the below will work:

```
{{ . }} minutes to read
{{ .Count }} minutes to read
```

Fixes #8454
Closes #7822
See https://github.com/gohugoio/hugoDocs/issues/1410
2021-04-23 07:39:59 +02:00
Anthony Fok 243951ebe9 snapcraft.yaml: Update to "base: core20"
That is, switch to using Ubuntu 20.04 LTS as base,
leveraging new features in Snapcraft 4.x, etc.

It is far from complete, with npm temporarily disabled (hence no PostCSS)
and with Pandoc probably not working yet, but would hopefully get our
Hugo Snap build, which stopped working shortly after v0.80.0, working again.
2021-04-22 09:57:40 -06:00
dependabot[bot] fe2ee02802 build(deps): bump github.com/frankban/quicktest from 1.11.3 to 1.12.0
Bumps [github.com/frankban/quicktest](https://github.com/frankban/quicktest) from 1.11.3 to 1.12.0.
- [Release notes](https://github.com/frankban/quicktest/releases)
- [Commits](https://github.com/frankban/quicktest/compare/v1.11.3...v1.12.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-22 15:24:15 +02:00
dependabot[bot] 316d65cd70 build(deps): bump google.golang.org/api from 0.44.0 to 0.45.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.44.0 to 0.45.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/master/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.44.0...v0.45.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-22 13:43:11 +02:00
dependabot[bot] b95229ab49 build(deps): bump github.com/aws/aws-sdk-go from 1.37.11 to 1.38.23
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.37.11 to 1.38.23.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.37.11...v1.38.23)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-22 13:42:15 +02:00
Santiago De la Cruz 0551df090e Correct function name in comment
IsInt to IsNumber
2021-04-22 12:24:12 +02:00
Bjørn Erik Pedersen bca40cf0c9 Fix Params case handling in where with slices of structs (e.g. Pages)
Fixes #7009
2021-04-21 19:28:18 +02:00
Bjørn Erik Pedersen 057e5a22af deps: Upgraded github.com/evanw/esbuild v0.11.0 => v0.11.12 2021-04-21 13:07:16 +02:00
Bjørn Erik Pedersen fd96f65a3d docs: Regen docs helper 2021-04-20 20:23:36 +02:00
Bjørn Erik Pedersen 8f7891e70c Merge commit '07b8d9466dfb59c429c1b470a0443337bc0aeefe' 2021-04-20 20:22:53 +02:00
Bjørn Erik Pedersen 07b8d9466d Squashed 'docs/' changes from 9cece6640..fb551cc75
fb551cc75 Update index.md
7af894857 Update index.md
d235753ea Hugo 0.82.1
e03e72deb Merge branch 'temp0821'
e62648961 Merge branch 'release-0.82.1'
e1ab0f6eb releaser: Add release notes to /docs for release of 0.82.1
5d354c38d Replaced ``` code blocks with Code Toggler
c9d065c20 Remove duplicate YAML keys (#1420)
8ae31e701 Add webp image encoding support
848f2af26 Update internal.md (#1407)
c103a86a4 Fix `ref` shortcode example output (#1409)
9f8ba56dc Remove leading dot from where function KEY (#1419)
363251a51 Improve presentation of template lookup order (#1382)
b73da986d Improve description of Page Resources (#1381)
4e0bb96d5 Rework robots.txt page (#1405)
edf893e6f Update migrations.md (#1412)
450f1580b Add link to `site` function doc (#1417)
cfffa6e6f Added one extension to the list (#1414)
05f1665a0 Update theme
5de0b1c6a Update theme
250e20552 Add hugo.IsExtended
dea5e1fd7 Fix typo on merge function page (#1408)
1bbed2cf3 Update configuration.md
be0b64a46 Omit ISO
cbb5b8367 Fix `dateFormat` documentation
698f15466 Regenerate the docshelper
f9a8a7cb6 Update multilingual.md
a22dc6267 Fix grammar (#1398)
eb98b0997 Fix pretty URL example (#1397)
f4c4153dc Mention date var complementation in post scheduling (#1396)
17fae284c Fix resources.ExecuteAsTemplate argument order (#1394)
97e2c2abb Use code-toggle shortcode in `multilingual.md` (#1388)
3a84929bb Harmonize capitalization (#1393)
17f15daa6 fix file naming used in example (#1392)
5d97b6a18 Add slice syntax to sections permalinks config
00665b97b Improve description of `site.md`
edcf5e3fc Fix example in `merge.md`
f275ab778 Update postprocess.md
9593e3991 Fix file name
59bd9656f Update postprocess.md
1172fb6d0 Update to theNewDynamic repository (#1263)
f5b5c1d2c Update Hugo container image
4f2e92f2a Adapt anchorize.md to Goldmark
98aa19073 Directly link to `highlight` shortcode (#1384)
4c75c2422 Fix header level
f15c06f23 markdownify: add note about render-hooks and .RenderString (#1281)
69c82eb68 Remove Blackfriday reference from shortcode desc (#1380)
36de478df Update description of ignoreFiles config setting (#1377)
6337699d8 Remove "Authors" page from documentation (#1371)
35e73ca90 fix indent in example (#1372)
d3f01f19a Remove opening body tag from header example (#1376)
341a5a7d8 Update index.md
c9bfdbee6 Release 0.82.0
119644949 releaser: Add release notes to /docs for release of 0.82.0
32efaed78 docs: Regenerate docs helper
dea5449a2 docs: Regen CLI docs
eeab18fce Merge commit '81689af79901f0cdaff765cda6322dd4a9a7ccb3'
d508a1259 Attributes for code fences should be placed after the lang indicator only
c80905cef deps: Update to esbuild v0.9.0
95350eb79 Add support for Google Analytics v4
02d36f9bc Allow markdown attribute lists to be used in title render hooks
7df220a64 Merge commit '9d31f650da964a52f05fc27b7fb99cf3e09778cf'
d80bf61b7 Fixes #7698.

git-subtree-dir: docs
git-subtree-split: fb551cc750
2021-04-20 20:21:45 +02:00
dependabot[bot] d3a64708f4 build(deps): bump github.com/tdewolff/minify/v2 from 2.9.15 to 2.9.16
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.9.15 to 2.9.16.
- [Release notes](https://github.com/tdewolff/minify/releases)
- [Commits](https://github.com/tdewolff/minify/compare/v2.9.15...v2.9.16)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-20 19:19:07 +02:00
dependabot[bot] 3b56244f42 build(deps): bump golang.org/x/text from 0.3.5 to 0.3.6
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.3.5 to 0.3.6.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.3.5...v0.3.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-20 18:06:30 +02:00
Bjørn Erik Pedersen f5d3d635e6 publisher: Remove some unreachable code 2021-04-20 17:47:09 +02:00
dependabot[bot] 0d3c42da56 build(deps): bump github.com/getkin/kin-openapi from 0.39.0 to 0.55.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.39.0 to 0.55.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.39.0...v0.55.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-20 17:34:05 +02:00
Bjørn Erik Pedersen ef34dd8f0e publisher: Some performance tweaks for the HTML elements collector 2021-04-20 17:24:17 +02:00
Dirk Olbrich bc80022e03 publisher: Exclude comment and doctype elements from writeStats
- Reorder code blocks
- Rename cssClassCollectorWriter to htmlElementCollectorWriter, as it just collect html element information
- Expand benchmark to test for minified and unminified content

Fixes #8396
Fixes #8417
2021-04-20 17:24:17 +02:00
Bjørn Erik Pedersen 2bb9496ce2 Merge branch 'release-0.82.1' 2021-04-20 13:48:04 +02:00
hugoreleaser fda3c4d1ed releaser: Prepare repository for 0.83.0-DEV
[ci skip]
2021-04-20 11:44:34 +00:00
hugoreleaser 60618210b8 releaser: Add release notes to /docs for release of 0.82.1
[ci skip]
2021-04-20 11:02:48 +00:00
hugoreleaser f8b064f3c0 releaser: Bump versions for release of 0.82.1
[ci skip]
2021-04-20 11:02:48 +00:00
hugoreleaser 4713e509b6 releaser: Add release notes for 0.82.1
[ci skip]
2021-04-20 11:02:48 +00:00
Bjørn Erik Pedersen 6e9d2bf0c9 Regression in media type suffix lookup
Introduced in Hugo 0.82.0.

Fixes #8406
2021-04-20 12:52:30 +02:00
Bjørn Erik Pedersen e73f7a770d Regression in media type suffix lookup
Introduced in Hugo 0.82.0.

Fixes #8406
2021-04-20 12:51:11 +02:00
Joe Mooring 3ddffd064d build(deps): bump github.com/yuin/goldmark from 1.3.2 to 1.3.5
Updated test per <https://github.com/yuin/goldmark/pull/205>.

Fixes #8377
2021-04-16 09:12:28 +02:00
Joe Mooring 6fc52d185a Remove duplicate references from release notes
Closes #8360
2021-04-15 21:15:20 +02:00
dependabot[bot] 73c3ae818a build(deps): bump github.com/spf13/afero from 1.5.1 to 1.6.0
Bumps [github.com/spf13/afero](https://github.com/spf13/afero) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/spf13/afero/releases)
- [Commits](https://github.com/spf13/afero/compare/v1.5.1...v1.6.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-15 21:08:33 +02:00
dependabot[bot] 7ca118fdfd build(deps): bump github.com/pelletier/go-toml from 1.8.1 to 1.9.0
Bumps [github.com/pelletier/go-toml](https://github.com/pelletier/go-toml) from 1.8.1 to 1.9.0.
- [Release notes](https://github.com/pelletier/go-toml/releases)
- [Commits](https://github.com/pelletier/go-toml/compare/v1.8.1...v1.9.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-15 21:05:43 +02:00
Bjørn Erik Pedersen 33d5f80592 Add webp image encoding support
Fixes #5924
2021-04-15 17:22:55 +02:00
dependabot[bot] 509d39fa6d build(deps): bump google.golang.org/api from 0.40.0 to 0.44.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.40.0 to 0.44.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/master/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.40.0...v0.44.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-15 16:13:49 +02:00
dependabot[bot] 7725c41d40 build(deps): bump github.com/nicksnyder/go-i18n/v2 from 2.1.1 to 2.1.2
Bumps [github.com/nicksnyder/go-i18n/v2](https://github.com/nicksnyder/go-i18n) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/nicksnyder/go-i18n/releases)
- [Changelog](https://github.com/nicksnyder/go-i18n/blob/main/CHANGELOG.md)
- [Commits](https://github.com/nicksnyder/go-i18n/compare/v2.1.1...v2.1.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-15 16:13:26 +02:00
dependabot[bot] 5d36d80153 build(deps): bump github.com/rogpeppe/go-internal from 1.6.2 to 1.8.0
Bumps [github.com/rogpeppe/go-internal](https://github.com/rogpeppe/go-internal) from 1.6.2 to 1.8.0.
- [Release notes](https://github.com/rogpeppe/go-internal/releases)
- [Commits](https://github.com/rogpeppe/go-internal/compare/v1.6.2...v1.8.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-15 14:44:37 +02:00
Joe Mooring 9b34d42bb2 Remove extraneous space from figure shortcode
Fixes #8401
2021-04-15 14:43:32 +02:00
dependabot[bot] c2d8f87cfc build(deps): bump github.com/magefile/mage from 1.10.0 to 1.11.0
Bumps [github.com/magefile/mage](https://github.com/magefile/mage) from 1.10.0 to 1.11.0.
- [Release notes](https://github.com/magefile/mage/releases)
- [Changelog](https://github.com/magefile/mage/blob/master/.goreleaser.yml)
- [Commits](https://github.com/magefile/mage/compare/v1.10.0...v1.11.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-14 11:55:38 +02:00
dependabot[bot] cbc246616e build(deps): bump github.com/google/go-cmp from 0.5.4 to 0.5.5
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.4 to 0.5.5.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.4...v0.5.5)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-14 11:55:18 +02:00
Niklas Fasching fa432b17b3 org: Disable broken pretty relative links feature
go-org PrettyRelativeLinks rewrites relative org links by
- adding `../` in front
- removing any `.org` suffix

This was meant to play well with hugo pretty urls (which pretty much renders
posts in a subdirectory without the file suffix) and allow use of normal org
file links to reference other posts.

There's a lot of edge cases I didn't consider and multiple bug reports in
go-org [1] later I don't think the complexity of handling those edge cases is
worth it - so let's disable it.

[1]
- https://github.com/niklasfasching/go-org/issues/53
- https://github.com/niklasfasching/go-org/commit/5dadf8c4c2924cbb3b93be45f96e1147596ca6f2 (comment)
- https://github.com/niklasfasching/go-org/issues/51
2021-04-12 08:08:53 +02:00
Niklas Fasching 0cd55c66d3 deps: Update go-org to v1.5.0 2021-04-12 08:08:53 +02:00
dependabot[bot] 0d5cf256e4 build(deps): bump github.com/jdkato/prose from 1.2.0 to 1.2.1
Bumps [github.com/jdkato/prose](https://github.com/jdkato/prose) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/jdkato/prose/releases)
- [Commits](https://github.com/jdkato/prose/compare/v1.2.0...v1.2.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-11 13:54:16 +02:00
dependabot[bot] 36527576b3 build(deps): bump github.com/spf13/cobra from 1.1.1 to 1.1.3
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.1.1 to 1.1.3.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Changelog](https://github.com/spf13/cobra/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spf13/cobra/compare/v1.1.1...v1.1.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-11 13:53:45 +02:00
Bjørn Erik Pedersen 9b83f45b6d Add complete dependency list in "hugo env -v"
Fixes #8400
2021-04-09 08:07:22 +02:00
Bjørn Erik Pedersen 7fdd2b95e2 Add hugo.IsExtended
Fixes #8399
2021-04-09 07:28:27 +02:00
Bjørn Erik Pedersen 3d5dbdcb1a publisher: Also test minified HTML in the element collector
Updates #7567
2021-04-07 16:40:15 +02:00
Bjørn Erik Pedersen 8a308944e4 publisher: Skip script, pre and textarea content when looking for HTML elements
Updates #7567
2021-04-07 00:26:02 +02:00
Bjørn Erik Pedersen 7b4ade56dd output: Only output mediaType once in docshelper JSON
Fixes #8379
2021-04-01 19:05:33 +02:00
Joe Mooring 7c7974b711 Fix typo in docshelper.go
Fixes #8380
2021-04-01 18:44:39 +02:00
Bjørn Erik Pedersen 5656a908d8 tpl: Remove the FuzzMarkdownify func for now
It has gotten us nothing but "build fails" mail and work we don't have time to follow up on.
2021-03-30 20:57:31 +02:00
Bjørn Erik Pedersen 2dc222cec4 Add slice syntax to sections permalinks config
Fixes #8363
2021-03-30 07:55:24 +02:00
Bjørn Erik Pedersen 4d22ad580e deps: Upgrade github.com/evanw/esbuild v0.9.6 => v0.11.0 2021-03-29 12:00:47 +02:00
Bjørn Erik Pedersen 5e2f128911 Try to fix the fuzz build 2021-03-28 21:42:44 +02:00
hugoreleaser 97934779ed releaser: Prepare repository for 0.83.0-DEV
[ci skip]
2021-03-21 18:12:42 +00:00
hugoreleaser 9d96078439 releaser: Add release notes to /docs for release of 0.82.0
[ci skip]
2021-03-21 17:28:02 +00:00
hugoreleaser 1efd93c097 releaser: Bump versions for release of 0.82.0
[ci skip]
2021-03-21 17:28:02 +00:00
hugoreleaser 584a9b3e2e releaser: Add release notes for 0.82.0 2021-03-21 18:16:55 +01:00
Bjørn Erik Pedersen 86b4fd35e7 docs: Regenerate docs helper 2021-03-21 13:33:26 +01:00
Bjørn Erik Pedersen 195d108da7 docs: Regen CLI docs 2021-03-21 13:32:12 +01:00
Bjørn Erik Pedersen 81689af799 Squashed 'docs/' changes from bb15e9804..9cece6640
9cece6640 Function sort: fix example labels (#1344)
84444120f Revert "Fix sample data for sort function (#1363)" (#1364)
05c8619f4 Fix sample data for sort function (#1363)
2beb1c0ed Fix "Configure taxonomies" title (#1361)
cd777b9fb Fix sitemap configuration link (#1360)
52251fb42 Update the 'Customize Dates' example to not error (#1357)
1a14cc08a Update quick-start.md
17bb98a94 Add note about image metadata removal
ec4f7bfff Update 404.md
cebfb7a90 explaination that `weight` key is used for sorting
83190ff12 fix typo: "advance settings" → "advanced settings"
75743968c Update quick-start.md
f1c64cd5a Improved documentation.
8af3b236c Update theme

git-subtree-dir: docs
git-subtree-split: 9cece66400
2021-03-21 13:31:17 +01:00
Bjørn Erik Pedersen c94aa5cf46 Merge commit '81689af79901f0cdaff765cda6322dd4a9a7ccb3' 2021-03-21 13:31:17 +01:00
Bjørn Erik Pedersen df8bb8812f Simplify some config loading code 2021-03-21 13:29:11 +01:00
Bjørn Erik Pedersen 57d8d208ed deps: Update github.com/evanw/esbuild v0.9.0 => v0.9.6 2021-03-21 11:24:43 +01:00
Bjørn Erik Pedersen fc06e85082 Apply OS env overrides twice
The recent fix for #8346 had an unfortunate side-effect, as it prevented overrides of config options used in the module collector, e.g. `HUGO_MODULE_REPLACEMENTS`.

This commit fixes that by applying the overrides twice.
2021-03-21 10:54:30 +01:00
Bjørn Erik Pedersen b725253f9e Attributes for code fences should be placed after the lang indicator only
Fixes #8313
2021-03-20 19:15:11 +01:00
Bjørn Erik Pedersen 35dedf15c0 deps: Bump github.com/tdewolff/minify/v2 v2.9.15
Fixes #8332
2021-03-20 15:51:20 +01:00
Bjørn Erik Pedersen 7ed56c6941 Fix OS env override for nested config param only available in theme
Fixes #8346
2021-03-20 13:34:51 +01:00
Avinash Sonawane 24c716cac3 Fix new theme command description
`hugo new theme foo` creates theme `foo` in `./themes` and not in current directory.
2021-03-14 18:47:23 +01:00
Patrick Kollitsch 137d2dab32 github: More explicit support link to discourse 2021-03-14 18:27:15 +01:00
Bjørn Erik Pedersen ba1d0051b4 media: Make Type comparable
So we can use it and output.Format as map key etc.

This commit also fixes the media.Type implementation so it does not need to mutate itself to handle different suffixes for the same MIME type, e.g. jpg vs. jpeg.

This means that there are no Suffix or FullSuffix on media.Type anymore.

Fixes #8317
Fixes #8324
2021-03-14 15:21:54 +01:00
Bjørn Erik Pedersen 1b1dcf586e deps: Update to esbuild v0.9.0 2021-03-14 11:51:25 +01:00
Cameron Moore f6612d8bd8 exif: Fix handling of utf8 runes in nullString() 2021-03-13 21:20:10 +01:00
Cameron Moore 0a2ab3f8fe exif: Allow more spacing characters in strings
The root cause of issue #8079 was a non-breaking space (U+0160).
`unicode.IsPrint` only allows the ASCII space (U+0020).  Be more lenient
by using `unicode.IsGraphic` instead.

Fixes #8079
2021-03-13 21:20:10 +01:00
Bjørn Erik Pedersen 4d24e2a326 media: Add a basic benchmark 2021-03-11 10:08:51 +01:00
Bjørn Erik Pedersen 18074d0c23 Fix output format handling for render hooks
Fixes #8176
2021-03-09 13:26:39 +01:00
Bjørn Erik Pedersen 35bfb66222 Rename a test 2021-03-04 13:46:31 +01:00
Bjørn Erik Pedersen 6d21559fb5 Add a debug helper 2021-03-03 20:16:58 +01:00
Daniel Atwood ba16a14c6e Add support for Google Analytics v4 2021-03-03 13:30:06 +01:00
Bjørn Erik Pedersen 782c79ae61 Bump go.mod to Go 1.16
Fixes #8294
2021-03-03 09:17:57 +01:00
Systemkern 5afcae7e0b #8210 Upgrade golang version for Dockerfile
https://github.com/gohugoio/hugo/issues/8210
relates to: #8210
2021-02-28 14:14:06 +01:00
Bjørn Erik Pedersen 60469f429e Update CONTRIBUTING.md 2021-02-25 11:50:08 +01:00
Bjørn Erik Pedersen aed7df62a8 markup: Handle attribute lists in code fences
Fixes #8278
2021-02-24 11:16:06 +01:00
Bjørn Erik Pedersen cd0c5d7ef3 Allow markdown attribute lists to be used in title render hooks
Fixes #8270
2021-02-23 18:08:39 +01:00
Bjørn Erik Pedersen e7e194435b Merge commit '9d31f650da964a52f05fc27b7fb99cf3e09778cf' 2021-02-23 17:41:05 +01:00
Bjørn Erik Pedersen 9d31f650da Squashed 'docs/' changes from d343ebf71..bb15e9804
bb15e9804 Update index.md (#1339)
ffb2f21d1 Update index.md
fc154ac02 Regenerate CLI docs
a0a687738 Update index.md
d0e35a844 Update index.md
86d0cc042 Update index.md
bdaf7e022 Release 0.81.0
b51017445 releaser: Add release notes to /docs for release of 0.81.0
888dd8fcc docs: Regen CLI docs
8c3e8b270 docs: Regen docs helper
79e3e1ebc Merge commit 'acb9109df778fa4a51c0d8b29b3212b12988908f'
31f70af7e modules: Add config option modules.vendorClosest
2631df94e markup/goldmark: Add attributes support for blocks (tables etc.)
19dee04ad Update to Dart Sass Protocol beta6
e507721fe Refactor: Write to stdout by default
d204bf160 Refactor: Remove powershell support
91bea48f5 Feat: Add zsh, fish and powershell completion support
9c915ea27 docs: Remove mention of a file size limit for readFile
5acc8b6c7 js: Add Inject config option
45321989e js: Add Shims option

git-subtree-dir: docs
git-subtree-split: bb15e9804a
2021-02-23 17:39:59 +01:00
dependabot[bot] 88a85dcea9 build(deps): bump github.com/kyokomi/emoji/v2 from 2.2.7 to 2.2.8
Bumps [github.com/kyokomi/emoji/v2](https://github.com/kyokomi/emoji) from 2.2.7 to 2.2.8.
- [Release notes](https://github.com/kyokomi/emoji/releases)
- [Commits](https://github.com/kyokomi/emoji/compare/v2.2.7...v2.2.8)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-23 10:55:29 +01:00
Bjørn Erik Pedersen 7f8530039a tpl: Add method mappings for strings.Contains, strings.ContainsAny
Just to confirm/document the function signature.
2021-02-23 09:36:43 +01:00
gzagatti 01dd7c16af Fixes #7698.
markup: Allow installed arbitrary Asciidoc extension via path validation.
2021-02-22 13:52:04 +01:00
Bjørn Erik Pedersen c8f45d1d86 commands: Fix autocomplete docs 2021-02-20 14:08:51 +01:00
hugoreleaser b3504a0ee8 releaser: Prepare repository for 0.82.0-DEV
[ci skip]
2021-02-19 17:55:53 +00:00
hugoreleaser 59d15c97d8 releaser: Add release notes to /docs for release of 0.81.0
[ci skip]
2021-02-19 17:07:09 +00:00
hugoreleaser 9e2d086ca7 releaser: Bump versions for release of 0.81.0
[ci skip]
2021-02-19 17:07:09 +00:00
Bjørn Erik Pedersen b65518ac63 releaser: Increase build timeout 2021-02-19 17:57:24 +01:00
hugoreleaser 0e9cd8128d releaser: Add release notes for 0.81.0 2021-02-19 16:52:22 +01:00
Bjørn Erik Pedersen fe77f7434b tpl: Make the build green again 2021-02-18 18:17:43 +01:00
Bjørn Erik Pedersen 9e99950c6e docs: Regen CLI docs 2021-02-18 17:55:38 +01:00
Bjørn Erik Pedersen 1b364b003f docs: Regen docs helper 2021-02-18 17:54:25 +01:00
Bjørn Erik Pedersen acb9109df7 Squashed 'docs/' changes from ef9c4913c..d343ebf71
d343ebf71 Document ignoreImports
f912ea1cc Fix the github workflow (#1332)
617894052 Add site function
f3be651f9 Minor typo/markdown fixes (#1328)
7a95e9db5 Fix a formatting error for Github Actions (#1323)
260106669 Fix #1120 Use Github Action
d8847a144 docs: Fix HTML code in .RenderString description being stripped out (#1320)
7a67c38c4 Correct sitemap version (#1318)
6a163f53a Removed noise. (#1317)
b02902121 Fix a minor typo (#1314)
399c74acd Revert "js: Update shims setup"
77def8a8c Revert "Update js.md"
13aeb2c73 Update js.md
704987dc1 js: Update shims setup

git-subtree-dir: docs
git-subtree-split: d343ebf718
2021-02-18 17:52:49 +01:00
Bjørn Erik Pedersen 7d0a261981 Merge commit 'acb9109df778fa4a51c0d8b29b3212b12988908f' 2021-02-18 17:52:49 +01:00
Bjørn Erik Pedersen c60806550a tpl: Regenerate internal templates 2021-02-18 17:52:32 +01:00
Daniel Atwood ffd9dac421 tpl: Update date logic of opengraph and schema internal templates
* Fix: updated date logic in opengraph template

* Updated date logic in schema template

* Reformatted opengraph and schema

* Wrapped PublishDate and Lastmod in with
2021-02-18 17:51:32 +01:00
Bjørn Erik Pedersen 88b93a09dc Run go mod tidy 2021-02-18 14:22:25 +01:00
Bjørn Erik Pedersen 29fb456c9e build: Add arm64 to Darwinextended build and add vendorInfo
Closes #8003
2021-02-18 14:11:48 +01:00
Bjørn Erik Pedersen 718fba7d63 Update Travis, GitHub, CircleCI and Snap to Go 1.16 (only) 2021-02-18 14:11:48 +01:00
Bjørn Erik Pedersen 9650e56841 tpl: Add temporary patch to fix template data race
Keep this as a separate commit so we can reapply it if needed.

Fixes #7293
2021-02-18 14:11:48 +01:00
Bjørn Erik Pedersen e77b2e3aa0 Pull in latest Go 1.16 template source 2021-02-18 14:11:48 +01:00
Bjørn Erik Pedersen b5485aeae7 Add breaking tests for "map read and map write in templates"
The fix upstream in Go was reverted, so we apply a temporary patch for this in Hugo.

Updates #7293
2021-02-18 14:11:48 +01:00
Bjørn Erik Pedersen ccb822eb5a Pull in latest Go template source 2021-02-18 14:11:48 +01:00
Bjørn Erik Pedersen 21e9eb18ac Expand template newline testcase to commands 2021-02-18 14:11:48 +01:00
Bjørn Erik Pedersen ae57ba6a9d Add a test case for Go 1.16 template action newlines 2021-02-18 14:11:48 +01:00
Bjørn Erik Pedersen cf3e077da3 tpl/internal: Synch Go templates fork with Go 1.16dev 2021-02-18 14:11:48 +01:00
Bjørn Erik Pedersen 66beac99c6 deps: Update github.com/tdewolff/minify/v2 v2.6.2 => v2.9.13
Fixes #8258
2021-02-18 10:19:22 +01:00
dependabot[bot] 968dd7a711 build(deps): bump github.com/frankban/quicktest from 1.11.2 to 1.11.3
Bumps [github.com/frankban/quicktest](https://github.com/frankban/quicktest) from 1.11.2 to 1.11.3.
- [Release notes](https://github.com/frankban/quicktest/releases)
- [Commits](https://github.com/frankban/quicktest/compare/v1.11.2...v1.11.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-16 22:10:33 +01:00
dependabot[bot] 38f29e817f build(deps): bump github.com/getkin/kin-openapi from 0.32.0 to 0.39.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.32.0 to 0.39.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.32.0...v0.39.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-16 21:18:35 +01:00
dependabot[bot] cd87813aa0 build(deps): bump github.com/aws/aws-sdk-go from 1.36.33 to 1.37.11
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.36.33 to 1.37.11.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.36.33...v1.37.11)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-16 18:43:30 +01:00
dependabot[bot] 4e815b063e build(deps): bump github.com/sanity-io/litter from 1.3.0 to 1.5.0
Bumps [github.com/sanity-io/litter](https://github.com/sanity-io/litter) from 1.3.0 to 1.5.0.
- [Release notes](https://github.com/sanity-io/litter/releases)
- [Changelog](https://github.com/sanity-io/litter/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sanity-io/litter/compare/v1.3.0...v1.5.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-16 18:42:55 +01:00
dependabot[bot] 652a59d385 build(deps): bump github.com/olekukonko/tablewriter from 0.0.4 to 0.0.5
Bumps [github.com/olekukonko/tablewriter](https://github.com/olekukonko/tablewriter) from 0.0.4 to 0.0.5.
- [Release notes](https://github.com/olekukonko/tablewriter/releases)
- [Commits](https://github.com/olekukonko/tablewriter/compare/v0.0.4...v0.0.5)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-16 18:39:44 +01:00
Bjørn Erik Pedersen 84f0ec7f80 deps: Update to esbuild v0.8.46 2021-02-16 18:37:30 +01:00
Bjørn Erik Pedersen bdfbcf6f4b modules: Add config option modules.vendorClosest
Fixes #8235
Fixes #8242
2021-02-16 16:30:01 +01:00
Bjørn Erik Pedersen b60e9279ab js: Fix potential path issue on Windows 2021-02-16 16:10:46 +01:00
dependabot[bot] a9b0fea6a3 build(deps): bump google.golang.org/api from 0.26.0 to 0.40.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.26.0 to 0.40.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/master/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.26.0...v0.40.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-16 16:10:12 +01:00
Anthony Fok e8df097745 Change version string format and add VendorInfo to help with issue triaging
* Change version string format as proposed by @moorereason

 1. shorten program name
 2. make version string semver compliant with +extended.
    The slash is not allowed in semver.
 3. Use key=value pairs for BuildDate etc.

* Add optional vendorInfo to version string

to help with issue triaging, e.g. VendorInfo=debian:0.80.0-7
2021-02-16 16:08:24 +01:00
Bjørn Erik Pedersen 3a5ee0d2d6 modules: Allow absolute paths for any modules resolved via project replacement
Fixes #8240
2021-02-15 11:11:34 +01:00
Bjørn Erik Pedersen 4ffaeaf155 modules: Throw an error running hugo mod vendor on mountless module 2021-02-15 10:47:32 +01:00
susiwen8 bf55afd71f Fix some humanize issues
Fixes #7912
2021-02-14 18:30:59 +01:00
Anthony Fok 5f621df257 commands: Add PowerShell completion support
Revert "Refactor: Remove powershell support" with fixes

Thanks to Ben Mezger (@benmezger) for the original code.
See #8122

This reverts commit a7c515e1b5.
2021-02-09 13:37:36 -07:00
Anthony Fok 7118f89cf3 Refer to mage instead of make in comment regarding commitHash 2021-02-09 09:57:18 -07:00
Bjørn Erik Pedersen e6dd312812 markup/goldmark: Fix handling of legacy attribute config
See #7548
2021-02-09 09:23:18 +01:00
Bjørn Erik Pedersen 2681633db8 markup/goldmark: Add attributes support for blocks (tables etc.)
E.g.:

```
> foo
> bar
{.myclass}
```

There are some current limitations: For tables you can currently only apply it to the full table, and for lists the ul/ol-nodes only, e.g.:

```
* Fruit
  * Apple
  * Orange
  * Banana
  {.fruits}
* Dairy
  * Milk
  * Cheese
  {.dairies}
{.list}
```

Fixes #7548
2021-02-08 19:52:55 +01:00
Bjørn Erik Pedersen 1b24728256 deps: Update to Goldmark v1.3.2
Closes #8143
2021-02-08 12:16:21 +01:00
Bjørn Erik Pedersen 441b11beec Update to Dart Sass Protocol beta6
Note that this version is not backwards compatible, so you have to update the protocol binary.
2021-02-06 18:34:19 +01:00
Jeremy Epstein 4867cd1dea tpl/embedded: Exclude pages without Permalink from sitemap 2021-02-06 18:30:09 +01:00
Bjørn Erik Pedersen 92c6c40419 langs/i18n: Support translation files with suffix *.yml
Fixes #8212
2021-02-06 18:12:54 +01:00
Ben Mezger d36fd5b3ee Refactor: Write to stdout by default 2021-02-04 15:32:51 -07:00
Ben Mezger a7c515e1b5 Refactor: Remove powershell support 2021-02-04 15:32:51 -07:00
Ben Mezger 216b00f358 Feat: Add zsh, fish and powershell completion support
See issue #4296
2021-02-04 15:32:51 -07:00
Bjørn Erik Pedersen 144943798c github: Enable NPM tests on Windows
Fixes #8196
2021-02-01 11:32:17 +01:00
Bjørn Erik Pedersen 440fdb0eb9 deps: Update to esbuild v0.8.39
Fixes #8189
2021-02-01 11:28:12 +01:00
Pavlo Matiash b2a48dce58 Trim whitespace in elements written to hugo_stats.json
Fixes #7958
2021-02-01 09:32:39 +01:00
Baris Ceviz 35def0ae45 tpl/data: Add default user-agent header for getJSON requests 2021-02-01 09:31:02 +01:00
dependabot[bot] 2f9dadae40 build(deps): bump github.com/aws/aws-sdk-go from 1.35.0 to 1.36.33
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.35.0 to 1.36.33.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.35.0...v1.36.33)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-28 22:20:00 +01:00
Aleksandr Demakin ed3071b753 docs: Remove mention of a file size limit for readFile
The limit itself was removed in this PR: https://github.com/gohugoio/hugo/pull/8172.
2021-01-23 14:14:51 +01:00
Aleksandr Demakin ee9c136763 tpl/os: remove 1mb limit for readFile. 2021-01-23 00:39:14 +01:00
Bjørn Erik Pedersen 32b86076ee js: Add Inject config option
Fixes #8164
2021-01-22 23:43:44 +01:00
Cameron Moore 241b7483ea tpl: Fix race condition in text template baseof
Copy most of the htmltemplate cloning to the textemplate implementation
in the same function.
2021-01-22 19:25:45 +01:00
Bjørn Erik Pedersen e19a046c4b js: Add Shims option
This commit adds a new `shims` option to `js.Build` that allows swapping out a component with another.

Fixes #8165
2021-01-22 09:03:24 +01:00
Bjørn Erik Pedersen a1fe552fc9 Fix nilpointer in js.Build error handling
Fixes #8162
2021-01-21 10:09:33 +01:00
Bjørn Erik Pedersen a1a9f088b1 Merge commit 'e48ffb763572814a3788780bb9653dfa2daeae22' 2021-01-20 12:48:39 +01:00
Bjørn Erik Pedersen e48ffb7635 Squashed 'docs/' changes from 1de7a358c..ef9c4913c
ef9c4913c Clean up and removal of outdated examples
46122c9aa add godot tutorials to showcase
06d1d1ea2 Update scss-sass.md
1fc63c100 Spelling fix in 0.79.1 release notes
ad2f50e3d Update plainwords description (#1296)
33021d451 Update substr examples (#1304)
6b1cc59bb Release 0.80.0
521db8c6d Merge branch 'tempv0.80.0'
58626c2b3 releaser: Add release notes to /docs for release of 0.80.0
f81d118af dartsass: Dart Sass only supports `expanded` and `compressed`
7da6f54be Add Dart Sass support
b1f2661bb Replace jsconfig.js with jsconfig.json
38de0c1a4 Update index.md
223ceae80 Update index.md
f7ac0e59d Release v0.79.1
2d4583d43 Merge branch 'temp791-2'
1d34e609b releaser: Add release notes to /docs for release of 0.79.1
e26769988 Merge branch 'temp791'
75694d904 Fix Resource.ResourceType so it always returns MIME's main type
0f65d7783 Typo s/adds/add (#1298)
0b896b2c0 images: Add images.Overlay filter
0d4257dcd Clarify documentation on shimming
fcf601ddf Update index.html
6bf9bc1c1 Update index.html
1ce76bf3a Update index.html
e7d976eec Update index.html
db2996e64 Update index.html
245e5bfc9 news: Add post about Apple M1
3ad4115ed tpl: Add title parameter to YouTube shortcode
76ed976f8 Added two useful extensions to the list (#1243)
e5a30dd11 Update related.md
25cf8f48b Improve substr examples
e16e57e9a Update path.Split.md
2749b88fd Update path.Split.md
d76cad3ff Release 0.79.0
f5ccfbe98 releaser: Add release notes to /docs for release of 0.79.0
ebf1b87b0 Merge commit '9f1265fde4b9ef186148337c99f08601633b6056'
1f1e8f39c Allow setting the delimiter used for setting config via OS env, e.g. HUGO_
e9b1414dd deps: Update to github.com/evanw/esbuild 0.8.11 to 0.8.14
0f76cf66c docs: Regen docshelper
1ada5d47e Add menu params
1c120aef0 Revert "docs: Regenerate docshelper"
7b60b5624 docs: Regenerate docshelper

git-subtree-dir: docs
git-subtree-split: ef9c4913cd
2021-01-20 12:47:49 +01:00
Robert-André Mauchin 07ad283f68 build(deps): bump github.com/spf13/afero from 1.4.1 to 1.5.1
Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
2021-01-19 17:25:20 +01:00
Andreas Richter 2c8b5d9165 pipes: Add external source map support to js.Build and Babel
Fixes #8132
2021-01-18 10:38:09 +01:00
Cameron Moore 0004a733c8 tpl: Fix metrics hint tracking
When tracking for cache hints, track the same template name as the call
to MeasureSince in Execute.  When referencing a partial "foo", the value
of `n` does not match `templ.Name()` (`partials/foo` versus
`partials/foo.html`).  This was causing hints to go untracked since
there was no existing metric to append the hint to.

Fixes #8125
2021-01-08 20:01:11 +01:00
Cameron Moore 8a26ab0bc5 tpl: Do not return errors in substr for out-of-bounds cases
Most other substr implementations don't error out in out-of-bounds cases
but simply return an empty string (or a value that's printed as an empty
string). We'll follow their lead and not exit template execution.  Allow
the user decide what to do with the empty result.

Fixes #8113
2021-01-08 10:13:10 +01:00
Cameron Moore 788e50ad3a tpl: Add missing test scenario for strings.Substr 2021-01-08 10:13:10 +01:00
Bjørn Erik Pedersen 4d2b6fc4c0 Run go mod tidy 2021-01-03 18:48:35 +01:00
Niklas Fasching 212e5e5542 deps: Update go-org to v1.4.0
- Add support for pretty urls [1]. Rewrite file links:
  1. replace the `.org` extension with `/` (`/foo.org` -> `/foo/`)
  2. prefix unrooted links with `../` as relative links start in the fake
  subdirectory `/foo/` rather than `/`
- Fix case-sensitivity of org drawer `🔚`

[1] https://gohugo.io/content-management/urls/#pretty-urls
2021-01-02 22:29:06 +01:00
Bjørn Erik Pedersen 4fdec67b11 rst: Adjust log level 2021-01-01 11:50:13 +01:00
hugoreleaser 9b681ecfbd releaser: Prepare repository for 0.81.0-DEV
[ci skip]
2020-12-31 13:49:02 +00:00
hugoreleaser 792ef0f41a releaser: Add release notes to /docs for release of 0.80.0
[ci skip]
2020-12-31 13:36:35 +00:00
hugoreleaser 5b3fc1c673 releaser: Bump versions for release of 0.80.0
[ci skip]
2020-12-31 13:36:35 +00:00
Bjørn Erik Pedersen 63a33afee7 Update 0.80.0-relnotes.md 2020-12-31 14:26:00 +01:00
hugoreleaser 69aa3d4599 releaser: Add release notes for 0.80.0
Rename to *-ready.md to continue.
[ci skip]
2020-12-31 13:09:24 +00:00
Bjørn Erik Pedersen ffbf5e45fa Allow Dart Sass transformations to be cached on disk
This enbles people to build their sites/themes on servers where the Dart Sass binary is not available.
2020-12-31 11:32:20 +01:00
Bjørn Erik Pedersen 48994ea766 dartsass: Dart Sass only supports expanded and compressed 2020-12-31 11:18:54 +01:00
Bjørn Erik Pedersen 428b0b3294 dartsass: Add missing OutputStyle option 2020-12-31 10:49:59 +01:00
Cameron Moore 1f7e9f7333 Update emoji import paths and version
Since emoji is v2, we must import it with the `/v2` suffix.  Doing so
allows the Go tools to detect the latest release.
2020-12-30 22:46:19 +01:00
Bjørn Erik Pedersen cea1574023 Add Dart Sass support
But note that the Dart Sass Embedded Protocol is still in beta (beta 5), a main release scheduled for Q1 2021.

Fixes #7380
Fixes #8102
2020-12-30 17:32:25 +01:00
Horst Gutmann f9f779786e GroupByParamDate now supports datetimes
Previously, the method only worked for date strings but not (for
instance) full RFC3339 datetime strings.
2020-12-28 17:50:55 +01:00
Bjørn Erik Pedersen a9718f44cd para: Skip para test when not on CI
Fixes #6963
2020-12-23 19:47:20 +01:00
Bjørn Erik Pedersen f802bb236a Update SECURITY.md 2020-12-22 10:09:59 +01:00
hugoreleaser 6c29418278 releaser: Add release notes to /docs for release of 0.79.1
[ci skip]
2020-12-19 17:09:29 +01:00
Bjørn Erik Pedersen 10ae7c3210 Improve LookPath 2020-12-19 17:03:07 +01:00
Patrick Kollitsch ae2d1bd52d docs: create a SECURITY.md
This file is used by Github as a tab on the repos homepage to access information about how to report security issues. The text is kept simple.

Will solve #8074
2020-12-18 17:55:49 +01:00
Bjørn Erik Pedersen 81975f847d Fix Resource.ResourceType so it always returns MIME's main type
The one exception being for the Page, which does not have a MIME type, in which you will get the value `page`.

Fixes #8052
2020-12-17 22:20:12 +01:00
Cameron Moore 8103188b9b para: Show more detail on failed time test
Give us more visibility into how badly a given host is failing in the
time test.

Updates #6963
2020-12-17 22:19:17 +01:00
Bjørn Erik Pedersen 3ba147e702 images: Add images.Overlay filter
This allows for constructs ala:

```
{{ $overlay := $img.Filter (images.Overlay $logo 50 50 )}}
```
Or:

```
{{ $logoFilter := (images.Overlay $logo 50 50 ) }}
{{ $overlay := $img | images.Filter $logoFilter }}
```

Which will overlay the logo in the top left corner (x=50, y=50) of `$img`.

Fixes #8057
Fixes #4595
Updates #6731
2020-12-17 09:14:18 +01:00
Bjørn Erik Pedersen a2d146ec32 tpl: Regenerate templates 2020-12-16 12:20:02 +01:00
Maciej Sawicki d2d493ab5d tpl: Fix series detection in opengraph
When inside front matter you specified series with spaces,
then the opengraph template wouldn't detect other articles,
because in `.Site.Taxonomies.series` they are stored by 
urlized key.

Example:

```yaml
# in front matter
series:
    - My Series
```

```gohtml
{{/* in a template */}}
{{- $series := index .Site.Taxonomies.series$name }}

{{/* was resolved to */}}
{{- $series := index {'my-series': ...} "MySeries" }}
```
2020-12-16 12:13:30 +01:00
真夜 ce96895deb hugolib/paths: Fix typo 2020-12-16 12:12:14 +01:00
Phil Davis 04b89857e1 all: Fix minor typos 2020-12-16 12:11:32 +01:00
Bjørn Erik Pedersen 21fa1e86f2 Fix BenchmarkMergeByLanguage
Fixes #7914
2020-12-09 17:47:10 +01:00
Anthony Fok c84ad8db82 deps: Bump github.com/spf13/cobra from 0.15.0 to 0.20.0
The substring match in TestExecute deploy test is adjusted accordingly.
2020-12-04 20:43:03 -07:00
Patrick Kollitsch 4e0acb89b7 chore: configure proper link to discourse.gohugo.io (#8020)
* chore: configure proper link to discourse.gohugo.io 

This adds a configuration file to the issue templates for this repo. In this config file, an issue template is added that will look like the existing issue templates, but on click will lead directly to the discourse forum instead of hoping that people read what it says there. The support.md can be deleted.

* chore: remove obsolete support.md configuration

* chore: remove obsolete autoclosing workflow
2020-12-04 10:04:35 +01:00
Bjørn Erik Pedersen 718e09ed4b tpl/internal/go_templates: Revert formatting
Should make future fork synch easier.
2020-12-03 13:47:43 +01:00
Bjørn Erik Pedersen d90e37e0c6 all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
2020-12-03 13:12:58 +01:00
dependabot[bot] 32471b57bd build(deps): bump github.com/evanw/esbuild from 0.8.15 to 0.8.17
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.8.15 to 0.8.17.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.8.15...v0.8.17)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-02 13:04:16 +01:00
Andrew Zenk 4fc918e02c tpl: Add title parameter to YouTube shortcode 2020-12-02 12:53:53 +01:00
sth 0ad378b09c Use --baseURL path for live-reload URL
Fixes #6595
2020-12-02 12:52:26 +01:00
ivan-meridianbanc-com aebfe156fb Fix RelURL and AbsURL when path starts with language 2020-12-02 12:47:01 +01:00
dependabot[bot] 907d9e9268 build(deps): bump github.com/getkin/kin-openapi from 0.31.0 to 0.32.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.31.0 to 0.32.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.31.0...v0.32.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-02 12:26:27 +01:00
Cameron Moore 5862fd2a60 tpl: Fix substr when length parameter is zero
When length parameter is zero, always return an empty string.

Updates #7993
2020-12-01 23:20:04 +01:00
Cameron Moore 64789fb5dc tpl: Refactor and fix substr logic
Fix miscalculations when start is negative.  Results should now match
PHP substr.

Fixes #7993
2020-11-28 11:53:46 +01:00
hugoreleaser 32d4bf68da releaser: Prepare repository for 0.80.0-DEV
[ci skip]
2020-11-27 09:19:04 +00:00
hugoreleaser 1415efdcd8 releaser: Add release notes to /docs for release of 0.79.0
[ci skip]
2020-11-27 09:06:36 +00:00
hugoreleaser 4e6bf7907d releaser: Bump versions for release of 0.79.0
[ci skip]
2020-11-27 09:06:36 +00:00
Bjørn Erik Pedersen 50be4370b0 Update 0.79.0-relnotes.md 2020-11-27 09:55:51 +01:00
hugoreleaser 3d2e6a30d4 releaser: Add release notes for 0.79.0
Rename to *-ready.md to continue.
[ci skip]
2020-11-27 08:44:33 +00:00
Bjørn Erik Pedersen 4f1e4bb3fe Merge commit '9f1265fde4b9ef186148337c99f08601633b6056' 2020-11-27 09:30:05 +01:00
Bjørn Erik Pedersen 9f1265fde4 Squashed 'docs/' changes from 57c1d1a67..1de7a358c
1de7a358c Clarify that "with" blocks do not render with empty values (#1287)
b48de8b0a Update js.md
e0124e4b1 Update js.md
087b39d74 Update hosting-on-render.md (#1286)
8f02b5412 Update js.md (#1284)
8dd8a8d1d Add link to "Build Websites with Hugo" book (#1174)
ae2dc138a Fix typo in page bundles (#1283)
ab14bfec3 Update configuration directory section
17da77ff1 Update multilingual.md (#1280)
5bce8db3a Fix for site-hierarchy image, issue #60
9d7a2366d Fix typo
ad4210c41 Fix typo
c88bc0383 Fix orphan branch url (#1262)
1cf6cf5b3 Hugo 0.78.2
538c3cb86 Merge branch 'tempv0.78.2'
e5e07fc81 releaser: Add release notes to /docs for release of 0.78.2
120a61a47 Fixed wrong var assignment example
4cebbb1a7 Ignore remote JSON errors (for now)
618fcf9ba Add a link to modules config option 'replacements'
e12722779 Fix typo ("wil" -> "will") (#1273)
0670e9894 Update js.md
5bde834cf Update GH docs to say "main" as default branch
26312f93d Update index.md
eb6f51df1 Update js.md
b890dc84d Merge branch 'tempv0.78.1'
6b73ea450 releaser: Add release notes to /docs for release of 0.78.1
46e582112 Update starter-kits.md (#1268)
a62786235 Update 404 docs: GitLab auto-detects 404.html (#1173)
cbd4fd2d9 Fix typo (#1271)
2ba3f9386 Update js.md
7b5109d90 Update js.md
bc75bc962 Release 0.78.0
0b2e8b0f1 releaser: Add release notes to /docs for release of 0.78.0
9ecba8480 Merge commit 'b74591123eac47a20d1f26ff3e2d291cd9c5cfc0'
60a475df7 js: Add avoidTDZ option
3b895261f Make js.Build fully support modules

git-subtree-dir: docs
git-subtree-split: 1de7a358ca
2020-11-27 09:26:24 +01:00
Bjørn Erik Pedersen d162bbd799 publisher: Fix memory usage in writeStats
```
name                     old time/op    new time/op    delta
ClassCollectorWriter-16    72.1µs ± 0%    32.3µs ± 0%  -55.17%  (p=0.029 n=4+4)

name                     old alloc/op   new alloc/op   delta
ClassCollectorWriter-16    85.9kB ± 0%    35.1kB ± 0%  -59.16%  (p=0.029 n=4+4)

name                     old allocs/op  new allocs/op  delta
ClassCollectorWriter-16       329 ± 0%       149 ± 0%  -54.71%  (p=0.029 n=4+4)
```

Fixes #7945
2020-11-27 09:13:16 +01:00
dependabot[bot] 17e0bbe821 build(deps): bump gopkg.in/yaml.v2 from 2.3.0 to 2.4.0
Bumps [gopkg.in/yaml.v2](https://github.com/go-yaml/yaml) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/go-yaml/yaml/releases)
- [Commits](https://github.com/go-yaml/yaml/compare/v2.3.0...v2.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-26 21:41:21 +01:00
Bjørn Erik Pedersen e442cf30a2 Fix server rebuild issue with partials referenced from render hooks
Fixes #7990
2020-11-26 20:41:54 +01:00
Bjørn Erik Pedersen 7e223b3baa Allow setting the delimiter used for setting config via OS env, e.g. HUGO_
Fixes #7829
2020-11-25 20:34:34 +01:00
Bjørn Erik Pedersen 8a6e706053 deps: Update to github.com/evanw/esbuild 0.8.11 to 0.8.14
Closes #7986
2020-11-25 17:39:51 +01:00
Cameron Moore 34061706e6 output: Add more layout lookup tests
Add more tests to cover more cases and to help with documentation and
discussion of template lookup order.

Updates #7964
2020-11-25 12:52:33 +01:00
dependabot[bot] 6f7633df7d build(deps): bump github.com/google/go-cmp from 0.5.2 to 0.5.3
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.2 to 0.5.3.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.2...v0.5.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-24 20:20:40 +01:00
Christian Oliff a546059a9c examples: Remove unneeded meta tag from blog example
```html
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
```
This was only needed for IE10 and lower (which are no longer supported) and chromeframe which was a Google plugin for IE8 and lower and was discontinued many years ago. So this meta tag can be safely removed.
2020-11-24 20:20:04 +01:00
dependabot[bot] b5d906e31e build(deps): bump github.com/getkin/kin-openapi from 0.30.0 to 0.31.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.30.0 to 0.31.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.30.0...v0.31.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-24 14:48:09 +01:00
Bjørn Erik Pedersen fd70bdafe7 docs: Regen docshelper 2020-11-24 13:49:01 +01:00
David Jones 8f5c9a747f Add menu params
Fixes #7951
2020-11-22 22:09:59 +01:00
SatowTakeshi e4fcb672ed resources: Preserve url set in frontmatter without sanitizing
related #6007 (already closed)
2020-11-21 23:37:58 +01:00
Bjørn Erik Pedersen 18c13adcd4 watcher: Add file deleted by accident
See #7972
2020-11-21 17:21:14 +01:00
Bjørn Erik Pedersen 20a35374a3 Revert "docs: Regenerate docshelper"
This reverts commit caf16c2085.

Closes #7972
2020-11-21 12:48:48 +01:00
Bjørn Erik Pedersen caf16c2085 docs: Regenerate docshelper 2020-11-20 09:32:16 +01:00
Bjørn Erik Pedersen b298c06e05 deps: Update to Chroma v0.8.2
Closes #7970
2020-11-20 09:30:05 +01:00
dependabot[bot] 55e290af41 build(deps): bump github.com/evanw/esbuild from 0.8.8 to 0.8.11
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.8.8 to 0.8.11.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.8.8...v0.8.11)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-19 09:51:30 +01:00
dependabot[bot] 506a190a82 build(deps): bump github.com/getkin/kin-openapi from 0.26.0 to 0.30.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.26.0 to 0.30.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.26.0...v0.30.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-16 12:33:31 +01:00
dependabot[bot] fc81de6439 build(deps): bump github.com/evanw/esbuild from 0.8.6 to 0.8.8
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.8.6 to 0.8.8.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.8.6...v0.8.8)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-16 12:32:33 +01:00
hugoreleaser fcaa324e3c releaser: Prepare repository for 0.79.0-DEV
[ci skip]
2020-11-13 10:19:23 +00:00
hugoreleaser 959724f0e0 releaser: Add release notes to /docs for release of 0.78.2
[ci skip]
2020-11-13 10:07:00 +00:00
hugoreleaser a3012d85d1 releaser: Bump versions for release of 0.78.2
[ci skip]
2020-11-13 10:07:00 +00:00
hugoreleaser fc7f739275 releaser: Add release notes for 0.78.2
[ci skip]
2020-11-13 10:07:00 +00:00
Bjørn Erik Pedersen 78f227b664 js: Let ESBuild handle all imports from node_modules
This commit fixes some issues where modules in /assets share the same name as in node_modules.

This was not intended, and with this commit the node_modules-components should be isolated. If you want to redefine something inside node_modules, use the `defines` option.

Fixes #7948
2020-11-13 08:54:29 +01:00
dependabot[bot] 5e03f644a4 build(deps): bump github.com/evanw/esbuild from 0.8.5 to 0.8.6
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.8.5 to 0.8.6.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.8.5...v0.8.6)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-12 13:59:18 +01:00
dependabot[bot] a92ef20ff6 build(deps): bump github.com/evanw/esbuild from 0.8.4 to 0.8.5
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.8.4 to 0.8.5.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.8.4...v0.8.5)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-11 23:00:27 +01:00
dependabot[bot] 0d54a84406 build(deps): bump github.com/getkin/kin-openapi from 0.22.1 to 0.26.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.22.1 to 0.26.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.22.1...v0.26.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-08 12:44:01 +01:00
Mackenzie Morgan 943f3c932f Update GH docs to say "main" as default branch 2020-11-06 20:57:52 +01:00
AdamKorcz 4f20bf29eb Updated year in header 2020-11-06 13:19:18 +01:00
AdamKorcz 4c613d5d5d Added first fuzzer 2020-11-06 13:19:18 +01:00
dependabot[bot] 82a182e52c build(deps): bump github.com/frankban/quicktest from 1.11.1 to 1.11.2
Bumps [github.com/frankban/quicktest](https://github.com/frankban/quicktest) from 1.11.1 to 1.11.2.
- [Release notes](https://github.com/frankban/quicktest/releases)
- [Commits](https://github.com/frankban/quicktest/compare/v1.11.1...v1.11.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-06 13:18:22 +01:00
dependabot[bot] dfc662b208 build(deps): bump golang.org/x/text from 0.3.3 to 0.3.4
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.3.3 to 0.3.4.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.3.3...v0.3.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-06 09:09:13 +01:00
dependabot[bot] 2f0917cc01 build(deps): bump github.com/evanw/esbuild from 0.8.3 to 0.8.4
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.8.3 to 0.8.4.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.8.3...v0.8.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-06 09:01:32 +01:00
hugoreleaser 7565cda1ff releaser: Prepare repository for 0.79.0-DEV
[ci skip]
2020-11-05 09:50:35 +00:00
hugoreleaser 347f2de67d releaser: Add release notes to /docs for release of 0.78.1
[ci skip]
2020-11-05 09:38:59 +00:00
hugoreleaser 210f6d38ac releaser: Bump versions for release of 0.78.1
[ci skip]
2020-11-05 09:38:59 +00:00
hugoreleaser 03f87f8f06 releaser: Add release notes for 0.78.1
[ci skip]
2020-11-05 09:38:59 +00:00
Bjørn Erik Pedersen 3437174c3a Disable NPM test on Travis on Windows
For now.
2020-11-05 09:56:22 +01:00
Bjørn Erik Pedersen f66302ca05 travis: Install nodejs on Windows 2020-11-05 07:51:41 +01:00
Bjørn Erik Pedersen 944150bafb js: Remove external source map option
It was merged by accident and the implementation does not look correct.

Fixes #7932
2020-11-04 23:04:12 +01:00
Bjørn Erik Pedersen bf2837a314 js: Misc fixes
* Fix resolve of package.json deps in submodules
* Fix directory logic for writing assets/jsconfig.json

Fixes #7924
Fixes #7923
2020-11-04 19:21:43 +01:00
hugoreleaser cf6131dc18 releaser: Prepare repository for 0.79.0-DEV
[ci skip]
2020-11-03 13:25:12 +00:00
hugoreleaser fd62817bba releaser: Add release notes to /docs for release of 0.78.0
[ci skip]
2020-11-03 13:13:12 +00:00
hugoreleaser 3ebe83aea7 releaser: Bump versions for release of 0.78.0
[ci skip]
2020-11-03 13:13:12 +00:00
Bjørn Erik Pedersen 0c16debc7f Update 0.78.0-relnotes.md 2020-11-03 14:03:53 +01:00
hugoreleaser 794e1f9e72 releaser: Add release notes for 0.78.0
Rename to *-ready.md to continue.
[ci skip]
2020-11-03 12:23:42 +00:00
Bjørn Erik Pedersen c64e9504d8 Merge commit 'b74591123eac47a20d1f26ff3e2d291cd9c5cfc0' 2020-11-03 13:05:34 +01:00
Bjørn Erik Pedersen b74591123e Squashed 'docs/' changes from d1157b687..57c1d1a67
57c1d1a67 Add note about issue with Instagram shortcode
2a4355113 Add example for regional language tags (#1139)
5e9a60fc0 Format dates with "th", "nd", and "rd". (#1254)
43df9a7f6 Update index.md
f15f32590 Update index.md
5a15be93d Update configuration.md
e71c1c545 Update configuration.md
5fd0439ff Release Hugo 0.77.0
5b875477c releaser: Add release notes to /docs for release of 0.77.0
09a2a3199 docs: Regen docs helper
bebef9bbe Merge commit '9cabb46f68bae01aeb1859727dcb21e8a10f5ec7'
f5ed02685 tpl: Refactor time.AsTime location implementation
f3b8eccd2 tpl: Update Hugo time to support optional [LOCATION] parameter

git-subtree-dir: docs
git-subtree-split: 57c1d1a67b
2020-11-03 13:04:56 +01:00
Bjørn Erik Pedersen 3b2fe3cd33 js: Add avoidTDZ option
Fixes #7865
2020-11-03 13:04:37 +01:00
Bjørn Erik Pedersen 85e4dd7370 Make js.Build fully support modules
Fixes #7816
Fixes #7777
Fixes #7916
2020-11-03 13:04:37 +01:00
Andreas Richter 3089fc0ba1 js.Build: Generate tsconfig files
Updates #7777

Added support to allow SourceMap files to be external to the build.
In addition added more information when the js compilation has an error.
Correctly append sourceMappingURL to output file.
Fix merge conflict.
2020-11-03 13:04:37 +01:00
hugoreleaser e10e36cf70 releaser: Prepare repository for 0.78.0-DEV
[ci skip]
2020-10-30 10:24:27 +00:00
hugoreleaser ef290125c9 releaser: Add release notes to /docs for release of 0.77.0
[ci skip]
2020-10-30 10:12:16 +00:00
hugoreleaser 5d2fceecaf releaser: Bump versions for release of 0.77.0
[ci skip]
2020-10-30 10:12:16 +00:00
Bjørn Erik Pedersen 0696df6686 Release 0.77.0 2020-10-30 11:05:21 +01:00
Bjørn Erik Pedersen 5ba49c8778 Update 0.77.0-relnotes.md
[ci skip]
2020-10-30 10:39:04 +01:00
hugoreleaser c3ccda8fab releaser: Add release notes for 0.77.0
Rename to *-ready.md to continue.
[ci skip]
2020-10-30 09:22:42 +00:00
Bjørn Erik Pedersen beabc8d998 modules: Allow absolute paths for project imports
Fixes #7910
2020-10-30 10:14:08 +01:00
Bjørn Erik Pedersen 332b65e4cc docs: Regen docs helper 2020-10-30 09:52:32 +01:00
Bjørn Erik Pedersen 3553fc533a Merge commit '9cabb46f68bae01aeb1859727dcb21e8a10f5ec7' 2020-10-30 09:50:15 +01:00
Bjørn Erik Pedersen 9cabb46f68 Squashed 'docs/' changes from 9abd3043a..d1157b687
d1157b687 Fix typo -- missing word in title
34c9a9ff3 Remove Hartwell Insurance subpage broken link
d42f6d8eb Fix strings.Repeat documentation
09b49debb Release 0.76.5
149877735 Merge branch 'tempv0.76.5'
72ffeb026 releaser: Add release notes to /docs for release of 0.76.5
4150d8ae8 Fixed typo: update PrevPage to Prev
c3e630db1 Update index.md
deb7520a8 Release 0.76.4
f58bd7134 Merge branch 'tempv0.76.4'
2581fe4bc releaser: Add release notes to /docs for release of 0.76.4
26d8417fc Release 0.76.3
34c49e06a Merge branch 'tempv0.76.3'
0de2af2ef releaser: Add release notes to /docs for release of 0.76.3
cce12c0f7 Add missing closing quotes and fix code-block lang (#1250)
8c1c80d9f Update AMP link (#1251)
7b1211ffa Fix typos in multilingual.md
29e9d70fd Update index.md
172a5480b Release 0.76.2
93ff424d3 Merge branch 'temp762'
3cad3c23a releaser: Add release notes to /docs for release of 0.76.2
610221964 Update index.md
8a9d31709 Release 0.76.1
64b245aa4 Merge branch 'temp761'
f19469ff8 releaser: Add release notes to /docs for release of 0.76.1
97f0ed030 Update front-matter.md
cca71f263 Update index.md
23c64f6a3 Fix typo in 0.76.0 release note
5f79e034d Update index.md
b66567de2 netlify: Bump to Hugo 0.76.0
a3e30300d Release 0.76.0
3b057e8fe releaser: Add release notes to /docs for release of 0.76.0
7fa1cd912 docs: Regen docshelper
769712aec Merge commit 'e5568488051a571df48401e03f1304b95dbc9028'
70ce6ae33 pagemeta: Make BuildConfig.Render an enum
a78d3849f Allow cascade to be a slice with a _target discriminator
705fea656 Add force flag to server redirects config
04e4e1cc1 tpl: Add Do Not Track (dnt) option to Vimeo shortcode
025c19fe1 Fix CLI example for PostCSS 8
0c70c47b2 markup/asciidocext: Add preserveTOC option

git-subtree-dir: docs
git-subtree-split: d1157b687e
2020-10-30 09:49:15 +01:00
Bjørn Erik Pedersen 173187e263 Add module.replacements
Fixes #7904
Fixes #7908
2020-10-30 09:41:05 +01:00
Bjørn Erik Pedersen 8a1c637c44 Fix setting HUGO_MODULE_PROXY etc. via env vars
Fixes #7903
2020-10-30 09:41:04 +01:00
Cameron Moore 6d95dc9d74 tpl: Fix reflection bug in merge
Value.Type().Key() must only be called on map values.

Fixes #7899
2020-10-29 19:19:41 +01:00
José Moreira 56a343507c deploy: Do not call CDN service invalidation when executing a dry run deployment
Currently, if cache invalidation is enabled when running `hugo deploy --dryRun` with , the deployer does not take the dry run flag into consideration and triggers CloudFront/GoogleCloudCDN cache invalidation if any of those services are configured.

This change will instead print a feedback message if a dry run is in effect and quiet mode is not enabled.

Fixes #7884
2020-10-28 11:19:40 +01:00
Bhavin Gandhi d48a98c477 create: Pass editor arguments from newContentEditor correctly
If newContentEditor has editor name with arguments like `emacsclient
-n`, it fails with `executable file not found in $PATH`. This change
parses the value correctly and passes it to the given editor.

Signed-off-by: Bhavin Gandhi <bhavin7392@gmail.com>
2020-10-24 20:34:03 +02:00
Anthony Fok 3261678f63 deps: Bump github.com/spf13/cobra from 0.0.7 to 1.1.1
Cobra 1.1.1 fixes internal formatting for go-md2man v2 (which caused
man page generation e.g. "hugo gen man" to be broken since Cobra 0.0.6).
See spf13/cobra#1049 for context.
2020-10-24 03:39:53 -06:00
Eric Hagman f465c5c307 build: Allow optional "nodeploy" tag to exclude deploy command from bin
Fixes #7826
2020-10-23 09:03:41 +02:00
Gareth Watts 3400aff258 Allow cascade _target to work with non toml fm
The TOML lib unmarshals slices of string maps to []map[string]interface{}
whereas YAML and JSON decode to []interface{}

The existing tests only check for TOML working correctly, and _target
with cascade did not work at all for frontmatter defined in other formats.

Add a function to normalize those slices

Fixes #7874
2020-10-22 23:00:19 +02:00
Bjørn Erik Pedersen fdfa4a5fe6 Allow getJSON errors to be ignored
This change is mostly motivated to get a more stable CI build (we're building the Hugo site there, with Instagram and Twitter shortcodes sometimes failing).

Fixes #7866
2020-10-22 09:09:29 +02:00
dependabot[bot] 8cbe2bbfad build(deps): bump github.com/evanw/esbuild from 0.7.15 to 0.7.18
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.7.15 to 0.7.18.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.7.15...v0.7.18)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-21 10:19:40 +02:00
Cameron Moore 807db97af8 tpl: Refactor time.AsTime location implementation 2020-10-21 09:49:25 +02:00
Mark Johnson 26eeb29147 tpl: Update Hugo time to support optional [LOCATION] parameter 2020-10-21 09:49:25 +02:00
Bjørn Erik Pedersen b886fa46bb Revert "Add benchmark for building docs site"
We already have a lot of site building benchmarks. The main problem with adding the "Hugo site docs" to the list is that it cannot easiliy  be compared to any previous release, because its content/template/whatever has changed.

This reverts commit 837e084bbe.
2020-10-17 00:37:42 +02:00
Cameron Moore 14bce18a6c highlight: Avoid making unnecessary allocation
Avoid creating a local copy of the highlight configuration when no
options are passed.

Benchmarks of building the docs site:

name        old time/op    new time/op    delta
DocsSite-2     1.94s ± 4%     1.93s ± 4%    ~     (p=0.841 n=5+5)

name        old alloc/op   new alloc/op   delta
DocsSite-2     666MB ± 1%     656MB ± 0%  -1.48%  (p=0.008 n=5+5)

name        old allocs/op  new allocs/op  delta
DocsSite-2     8.85M ± 0%     8.76M ± 0%  -1.04%  (p=0.029 n=4+4)
2020-10-16 21:14:02 +02:00
Cameron Moore 837e084bbe Add benchmark for building docs site 2020-10-16 21:13:39 +02:00
Cameron Moore 08e4f9ff9c embedded: Always show page number when 5 pages or less
Fixes #7523
2020-10-16 16:16:49 +02:00
Cameron Moore acfa153863 output: Improve layout path construction 2020-10-15 20:54:47 +02:00
dependabot[bot] f033d9f01d build(deps): bump github.com/frankban/quicktest from 1.11.0 to 1.11.1
Bumps [github.com/frankban/quicktest](https://github.com/frankban/quicktest) from 1.11.0 to 1.11.1.
- [Release notes](https://github.com/frankban/quicktest/releases)
- [Commits](https://github.com/frankban/quicktest/compare/v1.11.0...v1.11.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-15 00:01:45 +02:00
dependabot[bot] 59fe279424 build(deps): bump github.com/evanw/esbuild from 0.7.14 to 0.7.15
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.7.14 to 0.7.15.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.7.14...v0.7.15)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-14 21:59:26 +02:00
Bjørn Erik Pedersen 62119022d1 Merge branch 'release-0.76.5' 2020-10-14 17:44:47 +02:00
hugoreleaser 2f3f41f736 releaser: Prepare repository for 0.77.0-DEV
[ci skip]
2020-10-14 15:28:16 +00:00
hugoreleaser 60f0725b3e releaser: Add release notes to /docs for release of 0.76.5
[ci skip]
2020-10-14 15:15:22 +00:00
hugoreleaser dcf70ea5a5 releaser: Bump versions for release of 0.76.5
[ci skip]
2020-10-14 15:15:22 +00:00
hugoreleaser 7487c0abf2 releaser: Add release notes for 0.76.5
[ci skip]
2020-10-14 15:15:22 +00:00
Bjørn Erik Pedersen 79a022a15c Render aliases even if render=link
Fixes #7832
2020-10-14 17:06:34 +02:00
Bjørn Erik Pedersen ead5799f7e Render aliases even if render=link
Fixes #7832
2020-10-14 16:59:37 +02:00
dependabot[bot] d57be11324 build(deps): bump github.com/spf13/afero from 1.4.0 to 1.4.1
Bumps [github.com/spf13/afero](https://github.com/spf13/afero) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/spf13/afero/releases)
- [Commits](https://github.com/spf13/afero/compare/v1.4.0...v1.4.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-12 22:54:09 +02:00
dependabot[bot] d070596694 build(deps): bump github.com/evanw/esbuild from 0.7.9 to 0.7.14
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.7.9 to 0.7.14.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.7.9...v0.7.14)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-12 22:51:34 +02:00
Daniel Sutton f5ea359dd3 docker: Update to Go 1.15 and Alpine 3.12 2020-10-12 22:51:08 +02:00
Cameron Moore 78b26d538c output: Test all lookup permutations in TestLayout 2020-10-12 22:24:47 +02:00
Cameron Moore 28179bd556 output: Reformat TestLayout table 2020-10-12 22:24:47 +02:00
hugoreleaser fef057b489 releaser: Prepare repository for 0.77.0-DEV
[ci skip]
2020-10-12 08:45:25 +00:00
hugoreleaser 50dfe40b91 releaser: Add release notes to /docs for release of 0.76.4
[ci skip]
2020-10-12 08:32:44 +00:00
hugoreleaser 1ef4211fea releaser: Bump versions for release of 0.76.4
[ci skip]
2020-10-12 08:32:44 +00:00
hugoreleaser b148063ec0 releaser: Add release notes for 0.76.4
[ci skip]
2020-10-12 08:32:44 +00:00
Anthony Fok e9a7ebaf67 snap: Install postcss v8 explicitly as it is now a peer dependency
Fix Snap build failures since 2020-09-21
2020-10-09 12:23:38 -06:00
Bjørn Erik Pedersen 506820435c lang/i18n: Fix for language code case issue with pt-br etc.
Fixes #7804
2020-10-09 18:02:43 +02:00
Bjørn Erik Pedersen 49972d0792 Merge branch 'release-0.76.3' 2020-10-08 19:33:23 +02:00
Bjørn Erik Pedersen c98132e30e Add merge helper 2020-10-08 19:32:53 +02:00
hugoreleaser af19253f43 releaser: Prepare repository for 0.77.0-DEV
[ci skip]
2020-10-08 17:20:03 +00:00
hugoreleaser e96234590d releaser: Add release notes to /docs for release of 0.76.3
[ci skip]
2020-10-08 17:07:29 +00:00
hugoreleaser d62bc74770 releaser: Bump versions for release of 0.76.3
[ci skip]
2020-10-08 17:07:29 +00:00
hugoreleaser 1b1d62fdc9 releaser: Add release notes for 0.76.3
[ci skip]
2020-10-08 17:07:29 +00:00
Bjørn Erik Pedersen 33e9d79b78 langs/i18n: Add workaround for known language, but missing plural rule error
Closes #7798
2020-10-08 14:20:18 +02:00
Bjørn Erik Pedersen fc6abc39c7 langs/i18n: Fix for bare TOML keys
Hugo 0.76.0 updated go-i18n from v1 to v2. This allowed us to set the TOML unmarshaler to use, so we set the one we use in other places in Hugo.

But that does not support dotted bare keys, which caused some breakage in the wild.

This commit fixes that by:

* Using go-toml for language files
* Updating go-toml to the latest version
2020-10-08 14:20:18 +02:00
hugoreleaser 18ed22be5c releaser: Prepare repository for 0.77.0-DEV
[ci skip]
2020-10-07 09:11:54 +00:00
hugoreleaser 207913f349 releaser: Add release notes to /docs for release of 0.76.2
[ci skip]
2020-10-07 08:59:11 +00:00
hugoreleaser 830b1a94de releaser: Bump versions for release of 0.76.2
[ci skip]
2020-10-07 08:59:11 +00:00
hugoreleaser 605cff4071 releaser: Add release notes for 0.76.2
[ci skip]
2020-10-07 08:59:11 +00:00
Bjørn Erik Pedersen 6dd60fca73 Revert "deps: Update to github.com/tdewolff/minify v2.9.4"
Closes #7792

This reverts commit b254532b52.
2020-10-07 10:46:19 +02:00
hugoreleaser 138a025916 releaser: Prepare repository for 0.77.0-DEV
[ci skip]
2020-10-07 07:45:26 +00:00
hugoreleaser 58ac83a98c releaser: Add release notes to /docs for release of 0.76.1
[ci skip]
2020-10-07 07:33:10 +00:00
hugoreleaser 2b8e8e6d96 releaser: Bump versions for release of 0.76.1
[ci skip]
2020-10-07 07:33:10 +00:00
hugoreleaser aef8369865 releaser: Add release notes for 0.76.1
[ci skip]
2020-10-07 07:33:10 +00:00
Bjørn Erik Pedersen f9e798e8c4 langs/i18n: Fix i18n .Count regression
Fixes #7787
2020-10-07 00:32:21 +02:00
digitalcraftsman ee56efffcb Fix typo in 0.76.0 release note 2020-10-06 19:03:36 +02:00
hugoreleaser 2c4e76e962 releaser: Prepare repository for 0.77.0-DEV
[ci skip]
2020-10-06 15:42:25 +00:00
hugoreleaser 9c7d6e475c releaser: Add release notes to /docs for release of 0.76.0
[ci skip]
2020-10-06 15:29:25 +00:00
hugoreleaser 4482958f96 releaser: Bump versions for release of 0.76.0
[ci skip]
2020-10-06 15:29:25 +00:00
Bjørn Erik Pedersen e1ec3bc2b2 Release 0.76.0 2020-10-06 17:21:35 +02:00
hugoreleaser 1cfa63b9ec releaser: Add release notes for 0.76.0
Rename to *-ready.md to continue.
[ci skip]
2020-10-06 17:21:23 +02:00
Bjørn Erik Pedersen b9318e4315 docs: Regen docshelper 2020-10-06 16:25:23 +02:00
Bjørn Erik Pedersen 5e39eb20a6 Merge commit 'e5568488051a571df48401e03f1304b95dbc9028' 2020-10-06 16:24:00 +02:00
Bjørn Erik Pedersen e556848805 Squashed 'docs/' changes from 4895c29c5..9abd3043a
9abd3043a Add docs for shimming JS libraries
6a1c8dcd7 Update sitemap-template.md (#1245)
37c397332 Update frontends.md
a0f86f6df Update configuration.md
bb00cb2c1 Update page-bundles.md
773212de6 Restructure and simplify
fcba7dddf Some minor clarifications of weight sorting
759b967fc Update configuration-markup.md
56708f0b7 module import path remove slash at end
59f4f4acd Doc: Fix typo in hugo command
faacf2e97 Clarify pagination documentation (#1208)
d8eb60887 netlify: Bump to 0.75.1
8cedf6231 Merge branch 'temp751'
188e2bf56 releaser: Add release notes to /docs for release of 0.75.1
c96d4b7a3 Update index.md
1a9d192f7 Update index.md
32731b916 Update index.md
a5bfa0c9a Restore the ... home page
b6850bf96 Release 0.75.0
d6e5e624f releaser: Add release notes to /docs for release of 0.75.0
8cd6b4f47 typo: already -> already
2cb2b22bb Merge commit '534ae9c57a902aea9ed6e62390dec11fa74b7122'
e3525de23 docs: Regen docs helper
fd746dd83 docs: Regenerate CLI docs
e20127980 Add "hugo mod npm pack"
8e82c7ce1 markup/highlight: Add support to linkable line anchors on Chroma
21e94911b markup/asciidocext: Fix AsciiDoc TOC with code
50b8dace5 modules: Add noVendor to module config
d05b541fe modules: Make ignoreVendor a glob pattern
c946082e7 docs: Update replaceRE func
149054341 docs: Update replace func
d917567df docs: Update merge function
f1e093c92 docs: Regen CLI docs
c7bac967d docs: Regen docs helper
7a38f7a45 Merge commit '7d7771b673e5949f554515a2c236b23192c765c8'
1a5a7263a markup/asciidoc: Add support for .TableOfContents

git-subtree-dir: docs
git-subtree-split: 9abd3043a9
2020-10-06 16:22:20 +02:00
Bjørn Erik Pedersen 634938908e pagemeta: Make BuildConfig.Render an enum
Allowing links on pages without rendering them.

Fixes #7783
2020-10-06 14:06:10 +02:00
Bjørn Erik Pedersen c63db7f1f6 Allow cascade to be a slice with a _target discriminator
Fixes #7782
2020-10-06 14:06:10 +02:00
Bjørn Erik Pedersen 5e2a547cb5 Add force flag to server redirects config
Fixes #7778
2020-10-05 22:20:00 +02:00
dependabot[bot] ee090c0940 build(deps): bump github.com/evanw/esbuild from 0.7.8 to 0.7.9
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.7.8 to 0.7.9.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.7.8...v0.7.9)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-05 12:13:46 +02:00
Josh Gerdes edc5c4741c tpl: Add Do Not Track (dnt) option to Vimeo shortcode
Added a Vimeo EnableDNT privacy option to the Hugo config. This will enable the Vimeo 'Do Not Track' flag when either Vimeo shortcode tempalte options are used. When enabled, it will force the Vimeo player to be blocked from tracking any session data, including all cookies and stats.

Fixes #7700
2020-10-02 23:02:38 +02:00
dependabot[bot] 05e358fd33 build(deps): bump github.com/tdewolff/minify/v2 from 2.9.5 to 2.9.7
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.9.5 to 2.9.7.
- [Release notes](https://github.com/tdewolff/minify/releases)
- [Commits](https://github.com/tdewolff/minify/compare/v2.9.5...v2.9.7)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-02 14:09:16 +02:00
dependabot[bot] a2e85d9a75 build(deps): bump github.com/aws/aws-sdk-go from 1.34.34 to 1.35.0
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.34.34 to 1.35.0.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.34.34...v1.35.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-01 12:13:53 +02:00
dependabot[bot] 4fba78dd0e build(deps): bump github.com/getkin/kin-openapi from 0.22.0 to 0.22.1
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.22.0 to 0.22.1.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.22.0...v0.22.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-01 12:13:30 +02:00
dependabot[bot] c011b4667f build(deps): bump github.com/aws/aws-sdk-go from 1.34.33 to 1.34.34
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.34.33 to 1.34.34.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.34.33...v1.34.34)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-30 12:13:40 +02:00
dependabot[bot] 35348b4b34 build(deps): bump github.com/evanw/esbuild from 0.7.7 to 0.7.8
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.7.7 to 0.7.8.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.7.7...v0.7.8)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-30 12:13:00 +02:00
dependabot[bot] 34915777c2 build(deps): bump github.com/aws/aws-sdk-go from 1.34.27 to 1.34.33
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.34.27 to 1.34.33.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.34.27...v1.34.33)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-29 19:48:58 +02:00
dependabot[bot] 0f4a837ed1 build(deps): bump github.com/evanw/esbuild from 0.7.4 to 0.7.7
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.7.4 to 0.7.7.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.7.4...v0.7.7)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-29 19:48:21 +02:00
dependabot[bot] b395d686e9 build(deps): bump github.com/tdewolff/minify/v2 from 2.9.4 to 2.9.5
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.9.4 to 2.9.5.
- [Release notes](https://github.com/tdewolff/minify/releases)
- [Commits](https://github.com/tdewolff/minify/compare/v2.9.4...v2.9.5)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-29 19:47:59 +02:00
Bjørn Erik Pedersen 97987e5c02 langs/i18n: Upgrade to go-i18n v2
Fixes #5242
2020-09-29 17:48:07 +02:00
Bjørn Erik Pedersen 111344113b publisher: Fix writeStats with quote inside quotes
Fixes #7746
2020-09-28 22:17:36 +02:00
dependabot[bot] 4855c186d8 build(deps): bump github.com/evanw/esbuild from 0.7.2 to 0.7.4
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.7.2 to 0.7.4.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.7.2...v0.7.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-24 10:36:14 +02:00
Andrey Sitnik 0c3d2b67e0 Fix CLI example for PostCSS 8 2020-09-22 19:31:02 +02:00
dependabot[bot] 6f07ec7e9e build(deps): bump github.com/aws/aws-sdk-go from 1.34.26 to 1.34.27
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.34.26 to 1.34.27.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.34.26...v1.34.27)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-21 13:24:10 +02:00
dependabot[bot] 4318dc72f8 build(deps): bump github.com/alecthomas/chroma from 0.8.0 to 0.8.1
Bumps [github.com/alecthomas/chroma](https://github.com/alecthomas/chroma) from 0.8.0 to 0.8.1.
- [Release notes](https://github.com/alecthomas/chroma/releases)
- [Changelog](https://github.com/alecthomas/chroma/blob/master/.goreleaser.yml)
- [Commits](https://github.com/alecthomas/chroma/compare/v0.8.0...v0.8.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-21 13:23:46 +02:00
dependabot[bot] acdc27a32d build(deps): bump github.com/evanw/esbuild from 0.7.1 to 0.7.2
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.7.1 to 0.7.2.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.7.1...v0.7.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-21 13:23:01 +02:00
Bjørn Erik Pedersen 3acde9ae04 Make sure CSS is rebuilt when postcss.config.js or tailwind.config.js changes
Fixes #7715
2020-09-20 13:35:41 +02:00
Joe Mooring 473b6610d5 Fix typo in redirect error message 2020-09-19 22:06:54 +02:00
dependabot[bot] 0bce97703c build(deps): bump github.com/aws/aws-sdk-go from 1.34.22 to 1.34.26
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.34.22 to 1.34.26.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.34.22...v1.34.26)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-19 21:18:16 +02:00
Bjørn Erik Pedersen b254532b52 deps: Update to github.com/tdewolff/minify v2.9.4 2020-09-19 21:17:02 +02:00
Anthony Fok 05a2289292 snap: Bump bundled Node.js from v12.18.3 to v12.18.4
due to CVE-2020-8201, CVE-2020-8251 and CVE-2020-8252,
see https://nodejs.org/en/blog/vulnerability/september-2020-security-releases/
2020-09-18 12:13:31 -06:00
Helder Pereira 8e553dcdef markup/asciidocext: Add preserveTOC option 2020-09-17 10:50:25 +02:00
dependabot[bot] d4fc70a3b3 build(deps): bump github.com/frankban/quicktest from 1.10.2 to 1.11.0
Bumps [github.com/frankban/quicktest](https://github.com/frankban/quicktest) from 1.10.2 to 1.11.0.
- [Release notes](https://github.com/frankban/quicktest/releases)
- [Commits](https://github.com/frankban/quicktest/compare/v1.10.2...v1.11.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-17 09:55:45 +02:00
dependabot[bot] d905abc002 build(deps): bump github.com/evanw/esbuild from 0.6.32 to 0.7.1
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.6.32 to 0.7.1.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.6.32...v0.7.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-16 20:52:20 +02:00
dependabot[bot] 8f3946746d build(deps): bump github.com/rogpeppe/go-internal from 1.5.1 to 1.6.2
Bumps [github.com/rogpeppe/go-internal](https://github.com/rogpeppe/go-internal) from 1.5.1 to 1.6.2.
- [Release notes](https://github.com/rogpeppe/go-internal/releases)
- [Commits](https://github.com/rogpeppe/go-internal/compare/v1.5.1...v1.6.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-16 20:50:54 +02:00
dependabot[bot] b01b2564ee build(deps): bump github.com/jdkato/prose from 1.1.1 to 1.2.0
Bumps [github.com/jdkato/prose](https://github.com/jdkato/prose) from 1.1.1 to 1.2.0.
- [Release notes](https://github.com/jdkato/prose/releases)
- [Commits](https://github.com/jdkato/prose/compare/v1.1.1...v1.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-16 20:50:25 +02:00
dependabot[bot] 9fa5ebe2c4 build(deps): bump github.com/spf13/afero from 1.2.2 to 1.4.0
Bumps [github.com/spf13/afero](https://github.com/spf13/afero) from 1.2.2 to 1.4.0.
- [Release notes](https://github.com/spf13/afero/releases)
- [Commits](https://github.com/spf13/afero/compare/v1.2.2...v1.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-16 20:48:25 +02:00
hugoreleaser efaed306b1 releaser: Prepare repository for 0.76.0-DEV
[ci skip]
2020-09-15 07:00:54 +00:00
hugoreleaser a4a7bab734 releaser: Add release notes to /docs for release of 0.75.1
[ci skip]
2020-09-15 06:45:52 +00:00
hugoreleaser 2a9dce423f releaser: Bump versions for release of 0.75.1
[ci skip]
2020-09-15 06:45:52 +00:00
hugoreleaser 30159b58e9 releaser: Add release notes for 0.75.1
[ci skip]
2020-09-15 06:45:52 +00:00
Bjørn Erik Pedersen cd00f7f966 resources/image: Fix nilpointer for images with no Exif
E.g. PNG files.

Fixes #7688
2020-09-15 07:54:24 +02:00
Bjørn Erik Pedersen 214afe4c1b modules/npm: Preserve the original package.json if it exists
Fixes #7690
2020-09-15 01:04:31 +02:00
Evgeny Kuznetsov cd830bb027 tpl: Fix grammar in the new 'requires non-zero' error message 2020-09-14 19:54:48 +02:00
hugoreleaser a8458bfb25 releaser: Prepare repository for 0.76.0-DEV
[ci skip]
2020-09-14 09:31:44 +00:00
hugoreleaser fef924baf1 releaser: Add release notes to /docs for release of 0.75.0
[ci skip]
2020-09-14 09:19:06 +00:00
hugoreleaser 07b5e602f8 releaser: Bump versions for release of 0.75.0
[ci skip]
2020-09-14 09:19:06 +00:00
Bjørn Erik Pedersen 70f16e84e2 Release 0.75.0 2020-09-14 11:08:48 +02:00
hugoreleaser abadf29542 releaser: Add release notes for 0.75.0
Rename to *-ready.md to continue.
[ci skip]
2020-09-14 08:51:14 +00:00
Bjørn Erik Pedersen 377ad87a51 Set PWD in environment when running the Node apps
E.g. PostCSS and Babel.

This is in line with what we do when running Go.
2020-09-14 10:22:24 +02:00
Daniel Holbach 292b0e26ec typo: already -> already 2020-09-14 10:15:59 +02:00
Bjørn Erik Pedersen 534ae9c57a Squashed 'docs/' changes from d3eb97a33..4895c29c5
4895c29c5 Document strings.Count function

git-subtree-dir: docs
git-subtree-split: 4895c29c5b
2020-09-13 21:58:53 +02:00
Bjørn Erik Pedersen df56682a10 Merge commit '534ae9c57a902aea9ed6e62390dec11fa74b7122' 2020-09-13 21:58:53 +02:00
Bjørn Erik Pedersen be2404c8b1 docs: Regen docs helper 2020-09-13 21:58:38 +02:00
Bjørn Erik Pedersen c8da8eb1f5 docs: Regenerate CLI docs 2020-09-13 21:58:10 +02:00
Bjørn Erik Pedersen 787da6bd5f releaser: Drop 32-bit for MacOS
Fixes #7576
2020-09-13 21:07:08 +02:00
Bjørn Erik Pedersen 85ba9bfffb Add "hugo mod npm pack"
This commit also introduces a convention where these common JS config files, including `package.hugo.json`, gets mounted into:

```
assets/_jsconfig
´``

These files mapped to their real filename will be added to the environment when running PostCSS, Babel etc., so you can do `process.env.HUGO_FILE_TAILWIND_CONFIG_JS` to resolve the real filename.

But do note that `assets` is a composite/union filesystem, so if your config file is not meant to be overridden, name them something specific.

This commit also adds adds `workDir/node_modules` to `NODE_PATH` and `HUGO_WORKDIR` to the env when running the JS tools above.

Fixes #7644
Fixes #7656
Fixes #7675
2020-09-13 20:55:29 +02:00
Andreas Richter 9df60b62f9 Print layout name if it was specified when showing missing layout file error
Fixes #7617
2020-09-13 20:36:37 +02:00
dependabot[bot] 4fad43c8bd build(deps): bump github.com/aws/aws-sdk-go from 1.34.21 to 1.34.22
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.34.21 to 1.34.22.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.34.21...v1.34.22)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-13 18:39:37 +02:00
Fernando Jorge Mota fb0f2cc718 markup/highlight: Add support to linkable line anchors on Chroma
Fixes #7622
2020-09-13 11:00:16 +02:00
Anthony Fok 748fd4cb0d snap: Bump bundled Node.js from v8.12.0 to v12.18.3
Fixes #7278
2020-09-12 00:01:16 -06:00
Anthony Fok b82f440c59 Revert "snap: Change confinement from strict to classic"
We need to wait until classic confinement review process at
https://forum.snapcraft.io/t/request-for-classic-confinement-for-hugo-snap/19892
is completed before "confinement: classic" uploads to the Snap Store
are accepted.

This reverts commit 6f4ff1a461.
2020-09-11 23:56:29 -06:00
dependabot[bot] c8143efa5d build(deps): bump github.com/getkin/kin-openapi from 0.14.0 to 0.22.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.14.0 to 0.22.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.14.0...v0.22.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-11 22:08:53 +02:00
dependabot[bot] c80132bbe5 build(deps): bump github.com/aws/aws-sdk-go from 1.34.20 to 1.34.21
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.34.20 to 1.34.21.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.34.20...v1.34.21)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-11 22:07:18 +02:00
dependabot[bot] 75fa4c5c95 build(deps): bump github.com/spf13/viper from 1.6.1 to 1.7.1
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.6.1 to 1.7.1.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.6.1...v1.7.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-11 22:06:42 +02:00
Bjørn Erik Pedersen fd7969e0b0 deps: Run "go mod tidy" 2020-09-11 07:50:07 +02:00
Bjørn Erik Pedersen b7fa3c4bba deps: Update to Goldmark v1.2.1 2020-09-11 07:49:35 +02:00
Helder Pereira 6a848cbc3a markup/asciidocext: Fix AsciiDoc TOC with code
Fixes #7649
2020-09-10 21:53:13 +02:00
dependabot[bot] 746ba803af build(deps): bump github.com/aws/aws-sdk-go from 1.27.1 to 1.34.20
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.27.1 to 1.34.20.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.27.1...v1.34.20)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-10 21:42:13 +02:00
dependabot[bot] 612b7d376f build(deps): bump github.com/mitchellh/mapstructure from 1.1.2 to 1.3.3
Bumps [github.com/mitchellh/mapstructure](https://github.com/mitchellh/mapstructure) from 1.1.2 to 1.3.3.
- [Release notes](https://github.com/mitchellh/mapstructure/releases)
- [Changelog](https://github.com/mitchellh/mapstructure/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitchellh/mapstructure/compare/v1.1.2...v1.3.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-10 21:39:36 +02:00
Anthony Fok 6f4ff1a461 snap: Change confinement from strict to classic
See gohugoio/hugoDocs#1222
2020-09-10 09:40:28 -06:00
dependabot[bot] ddeca45933 build(deps): bump github.com/spf13/cobra from 0.0.5 to 0.0.7
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 0.0.5 to 0.0.7.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Changelog](https://github.com/spf13/cobra/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spf13/cobra/compare/0.0.5...0.0.7)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-10 15:11:20 +02:00
dependabot[bot] 31f2091f58 build(deps): bump github.com/sanity-io/litter from 1.2.0 to 1.3.0
Bumps [github.com/sanity-io/litter](https://github.com/sanity-io/litter) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/sanity-io/litter/releases)
- [Changelog](https://github.com/sanity-io/litter/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sanity-io/litter/compare/v1.2.0...v1.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-10 15:09:08 +02:00
Bjørn Erik Pedersen d4611c4322 modules: Add noVendor to module config
Fixes #7647
2020-09-10 08:47:05 +02:00
Bjørn Erik Pedersen 20af9a0781 modules: Add ignoreImports to module imports config
Fixes #7646
2020-09-10 08:47:05 +02:00
Bjørn Erik Pedersen 9a1e6d15a3 modules: Make ignoreVendor a glob pattern
Fixes #7642
2020-09-10 08:47:05 +02:00
dependabot[bot] 84adecf97b build(deps): bump github.com/gorilla/websocket from 1.4.1 to 1.4.2
Bumps [github.com/gorilla/websocket](https://github.com/gorilla/websocket) from 1.4.1 to 1.4.2.
- [Release notes](https://github.com/gorilla/websocket/releases)
- [Commits](https://github.com/gorilla/websocket/compare/v1.4.1...v1.4.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-09 22:39:47 +02:00
dependabot[bot] 573558a078 build(deps): bump github.com/fsnotify/fsnotify from 1.4.7 to 1.4.9
Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.4.7 to 1.4.9.
- [Release notes](https://github.com/fsnotify/fsnotify/releases)
- [Changelog](https://github.com/fsnotify/fsnotify/blob/master/CHANGELOG.md)
- [Commits](https://github.com/fsnotify/fsnotify/compare/v1.4.7...v1.4.9)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-09 22:39:25 +02:00
dependabot[bot] 8b10c22f82 build(deps): bump github.com/kyokomi/emoji
Bumps [github.com/kyokomi/emoji](https://github.com/kyokomi/emoji) from 2.2.1+incompatible to 2.2.4+incompatible.
- [Release notes](https://github.com/kyokomi/emoji/releases)
- [Commits](https://github.com/kyokomi/emoji/compare/v2.2.1...v2.2.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-09 22:39:02 +02:00
dependabot[bot] 195bd1243b build(deps): bump github.com/markbates/inflect from 1.0.0 to 1.0.4
Bumps [github.com/markbates/inflect](https://github.com/markbates/inflect) from 1.0.0 to 1.0.4.
- [Release notes](https://github.com/markbates/inflect/releases)
- [Commits](https://github.com/markbates/inflect/compare/v1.0.0...v1.0.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-09 22:11:16 +02:00
dependabot[bot] 6a544ece24 build(deps): bump github.com/frankban/quicktest from 1.7.2 to 1.10.2
Bumps [github.com/frankban/quicktest](https://github.com/frankban/quicktest) from 1.7.2 to 1.10.2.
- [Release notes](https://github.com/frankban/quicktest/releases)
- [Commits](https://github.com/frankban/quicktest/compare/v1.7.2...v1.10.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-09 22:10:25 +02:00
Ralph Slooten 4b430d456a Encode & in livereload injected code 2020-09-09 22:09:40 +02:00
dependabot[bot] b9f10c75cb build(deps): bump github.com/niklasfasching/go-org from 1.3.1 to 1.3.2
Bumps [github.com/niklasfasching/go-org](https://github.com/niklasfasching/go-org) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/niklasfasching/go-org/releases)
- [Commits](https://github.com/niklasfasching/go-org/compare/v1.3.1...v1.3.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-08 19:53:15 +02:00
dependabot[bot] 537c598e9a build(deps): bump github.com/bep/golibsass from 0.6.0 to 0.7.0
Bumps [github.com/bep/golibsass](https://github.com/bep/golibsass) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/bep/golibsass/releases)
- [Commits](https://github.com/bep/golibsass/compare/v0.6.0...v0.7.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-08 19:52:29 +02:00
dependabot[bot] 67348676f7 build(deps): bump golang.org/x/text from 0.3.2 to 0.3.3
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.3.2 to 0.3.3.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.3.2...v0.3.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-08 19:52:10 +02:00
dependabot[bot] f9cc0ec76e build(deps): bump github.com/evanw/esbuild from 0.6.5 to 0.6.32
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.6.5 to 0.6.32.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.6.5...v0.6.32)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-08 19:51:50 +02:00
dependabot[bot] b5483eed6e build(deps): bump github.com/nicksnyder/go-i18n from 1.10.0 to 1.10.1
Bumps [github.com/nicksnyder/go-i18n](https://github.com/nicksnyder/go-i18n) from 1.10.0 to 1.10.1.
- [Release notes](https://github.com/nicksnyder/go-i18n/releases)
- [Changelog](https://github.com/nicksnyder/go-i18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nicksnyder/go-i18n/compare/v1.10.0...v1.10.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-08 19:48:51 +02:00
Bjørn Erik Pedersen 90285f4750 Revert "Update dependabot.yml"
This reverts commit c0655ba6ce.
2020-09-08 10:28:16 +02:00
Bjørn Erik Pedersen 4949bdc2ef markup/asciidocext: Fix broken test 2020-09-08 10:00:57 +02:00
Cameron Moore f7c1b5fe1c docs: Update replaceRE func
Updates for #7604
2020-09-07 22:45:14 +02:00
Cameron Moore 183e862607 docs: Update replace func
Updates for #7602
2020-09-07 22:45:14 +02:00
Cameron Moore f50ee6bbe5 docs: Update merge function
Updates for #7601
2020-09-07 22:45:14 +02:00
Bjørn Erik Pedersen c0655ba6ce Update dependabot.yml 2020-09-07 22:08:03 +02:00
Bjørn Erik Pedersen a2dda22c36 Create dependabot.yml 2020-09-07 21:51:49 +02:00
Bjørn Erik Pedersen 910d81a692 Remove Pygments from requirements.txt 2020-09-07 21:47:54 +02:00
Bjørn Erik Pedersen 8c490a73b3 docs: Regen CLI docs 2020-09-07 21:46:30 +02:00
Bjørn Erik Pedersen e6cd9da42d docs: Regen docs helper 2020-09-07 21:45:16 +02:00
Bjørn Erik Pedersen dcf25c0b49 markup/asciidocext: Revert trace=true 2020-09-07 21:44:11 +02:00
Bjørn Erik Pedersen 7d7771b673 Squashed 'docs/' changes from 7297c1172..d3eb97a33
d3eb97a33 Document .IsSection page variable
a068bcf5c Ace and Amber support was removed with #6609
5cd9ca4b2 Mention MacPorts also on the Installing page  (#1215)
0ae8f5c19 Add instructions for using Macports
d50aba8f0 Revise ref and relref function pages
a17e25d6f Update quick-start.md: move notice about drafts up
cf87a5da2 Update macOS tarball installation instructions (#1203)
2e701f8f3 Corrected the url for index function link
736bd59e0 Clarify treatment of zero weights (#1207)
42a19f479 Fix example of output from urlize function
34f8de26d Revise content-management/cross-references
252435a95 Rewrite Translation of Strings
f0882bc14 Remove note that has been outdated by v0.71.0
dfe28ceb5 Improve mounts module config
58029627d Fix erroneous example code piping to if

git-subtree-dir: docs
git-subtree-split: d3eb97a332
2020-09-07 21:37:51 +02:00
Bjørn Erik Pedersen b9e4f5898b Merge commit '7d7771b673e5949f554515a2c236b23192c765c8' 2020-09-07 21:37:51 +02:00
Bjørn Erik Pedersen e820b366b9 Update to Go 1.15.1 and 1.14.8
Fixes #7627
2020-09-07 21:37:34 +02:00
Bjørn Erik Pedersen 4055c12184 Fix some change detection issues on server reloads
* Fix change detection when .GetPage/site.GetPage is used from shortcode
* Fix stale content for GetPage results with short name lookups on server reloads

Fixes #7623
Fixes #7624
Fixes #7625
2020-09-07 21:06:44 +02:00
Nicolas Piganeau 3ba7c92530 markup/asciidoc: Add support for .TableOfContents
Fill the .TableOfContents template variable when writing Asciidoc content.
This is done by letting Asciidoc render its TOC as HTML, then extract this
HTML rendered TOC, parse it into a tableofcontents.Root and finally remove
it from the HTML content.
This aims to stay in the logic that the Asciidoc parsing is entirely done
by the external helper.

See #1687
2020-09-06 11:34:32 +02:00
Bjørn Erik Pedersen 19ef27b98e markup/goldmark: Add a test case
Updates #7619
2020-09-04 10:23:02 +02:00
Andreas Richter c6b661de82 js.Build: Add SourceMap flag with inline option
Added a flag to allow turning on sourcemap in ESBuild. The current support
can only support inline or true as value for sourcemap. This is because
the way ESBuild is invoked it doesn't have a separate output path
to write the mapfile external to the asset pipeline. Add disable for "" and "0".
Add test script and make sure mage check passes.

Fixes #7607
2020-09-01 16:19:08 +02:00
Cameron Moore cdfd1c99ba tpl: Add limit support to replaceRE
Go stdlib doesn't contain a limited replace in the regexp package, but
we can accomplish the same thing with ReplaceAllStringFunc.

Fixes #7586
2020-08-28 18:57:56 +02:00
Cameron Moore 047af7cfe5 tpl: Extend merge to accept multiple parameters
Fixes #7595
2020-08-28 09:54:51 +02:00
Cameron Moore f9ebaaed1b tpl: Add limit option to replace template function
Updates #7586
2020-08-28 08:55:58 +02:00
Jeff Warner d39636a5fc commands: Remove logic that hides 'Building Sites' message after build completes
Append newline to the message instead.

Fixes #7579
2020-08-22 09:56:43 +02:00
Aurken Bilbao ad01aea3f4 Fixed misspelled words 2020-08-20 22:34:35 +02:00
Bjørn Erik Pedersen ec37420468 Improve stderr logging for PostCSS and simlilar
Fixes #7584
2020-08-20 22:32:20 +02:00
Bjørn Erik Pedersen ae63c2b5c9 Fail on partials with return when given none or a zero argument
We need to make a proper fix for this, but it is better with an error than just silently continue.

Fixes #7572
Updates #7528
2020-08-19 10:01:16 +02:00
Bjørn Erik Pedersen e627449c0a Update to Go 1.15
Fixes #7554
2020-08-16 21:37:26 +02:00
Bjørn Erik Pedersen c2235c6a62 Revert "Update stale.yml"
This reverts commit 4f69ade711.
2020-08-16 18:25:14 +02:00
Bjørn Erik Pedersen 4f69ade711 Update stale.yml 2020-08-15 00:21:08 +02:00
Bjørn Erik Pedersen f8b8b091fc Merge commit 'cb39847dee488c373dd5bc2a3706385342a59355' 2020-08-14 18:31:40 +02:00
Bjørn Erik Pedersen cb39847dee Squashed 'docs/' changes from a26d0e610..7297c1172
7297c1172 Add note about caching for Hugo Pipes.
c91be3403 minor markdown, capitalization and spelling fixes (#1183)
fd4a103bf Fix several 404 errors (#1162)
69378bc20 Update related.md
28c24e95f Add note on setting baseURL
7b1502c99 minor typo fix (#1180)
33abeb4fe Update related.md
4887563f6 Update js.md
ee5f1de2e Hugo 0.74.3
986ea0c8e releaser: Add release notes to /docs for release of 0.74.3
3299b44bd Fix Asciidoctor args
bcb950347 resources/js: Add option for setting bundle format
3f8324918 resources/js: Add es5 build target

git-subtree-dir: docs
git-subtree-split: 7297c11727
2020-08-14 18:31:01 +02:00
Kyle Anderson 5f42590144 Remove trailing whitespace and tabs from RSS templates
The rss templates had some tab characters mixed in with the spaces.
Additionally there would end up being trailing whitespace in output
rss feeds, which looks red in git diff.
2020-08-12 09:25:16 +02:00
Fabian Tamp f3cb0be35a Fix a typo in CONTRIBUTING.md
The URL `git://github.com/USERNAME/hugo.git` is invalid; it should instead be either `https://github.com/USERNAME/hugo.git` or `git@github.com:USERNAME/hugo.git`. I chose the latter for this PR.
2020-08-07 19:35:48 +02:00
Joe Mooring bffc4e12fe Revert "Fix ellipsis display logic in pagination template"
This reverts commit 2fa851e650.
2020-08-06 13:42:08 +02:00
satotake 12f6a1cdc0 Respect mediatypes for deploy
Fixes #6861
2020-08-03 19:06:18 +02:00
Joe Mooring 2fa851e650 Fix ellipsis display logic in pagination template
Closes #7523
2020-07-31 16:08:23 +02:00
Ricardo N Feliciano 21dbfa1f11 mage: Add uninstall target 2020-07-30 08:44:51 +02:00
Joe Mooring e5591e89d3 deps: Update Chroma to 0.8.0
Closes #7517
2020-07-27 22:12:54 +02:00
Niklas Fasching 88929bc23f deps: Update go-org to v1.3.1
fixes a bug in list item parsing
2020-07-24 19:48:44 +02:00
hugoreleaser 850c18bfe4 releaser: Prepare repository for 0.75.0-DEV
[ci skip]
2020-07-23 16:33:19 +00:00
hugoreleaser da0437b481 releaser: Add release notes to /docs for release of 0.74.3
[ci skip]
2020-07-23 16:21:21 +00:00
hugoreleaser 90fe00df07 releaser: Bump versions for release of 0.74.3
[ci skip]
2020-07-23 16:21:21 +00:00
hugoreleaser 02efadc243 releaser: Add release notes for 0.74.3
[ci skip]
2020-07-23 16:21:21 +00:00
Bjørn Erik Pedersen 00e00da233 publisher: Collect transition attributes as classes
Fixes #7509
2020-07-23 16:21:58 +02:00
Helder Pereira 45c665d396 Fix Asciidoctor args
* Fix Asciidoctor args

* Fix Asciidoctor args documentation

* Update AsciiDoc documentation

Co-authored-by: Derk Muenchhausen <derk@muenchhausen.de>

Fixes #7493
2020-07-23 15:59:48 +02:00
Joe Mooring a06c06a5c2 Fix date format in internal schema template
Prior to this change, the offset indicator for dates with positive
offsets was rendered as &#43; instead of +.

Fixes #7495
2020-07-23 15:57:20 +02:00
Bjørn Erik Pedersen 0256959a35 resources/js: Add option for setting bundle format
Fixes #7503
2020-07-22 10:13:30 +02:00
Bjørn Erik Pedersen eded9ac2a0 resources/js: Simplify options handling
Mostly to minify cache hash breakage.

Updates #7499
2020-07-22 10:13:30 +02:00
Philipp Klose 8d72512825 make sure documentation intro text only appears once 2020-07-21 00:47:55 +02:00
Bjørn Erik Pedersen e81aef0a95 resources/js: Add es5 build target 2020-07-20 22:26:38 +02:00
Bjørn Erik Pedersen 673e622fa9 Merge commit '28bd06265e88454b061810578919d891909a83ad' 2020-07-20 22:20:33 +02:00
Bjørn Erik Pedersen 28bd06265e Squashed 'docs/' changes from c3b4f8410..a26d0e610
a26d0e610 Add documentation to js.Build (#1175)
439a22c3e Update index.md
7a779b39a Hugo 0.74.2
07cb5740c Merge branch 'temp742'
abcea676c releaser: Add release notes to /docs for release of 0.74.2
e0dcdbfea Revert "Adding an issue link to the issue creation workflow (#1023)"
21c7131f1 Adding an issue link to the issue creation workflow (#1023)
922afb18b Update index.md
b9512b192 Update index.md
b7af5993c Update index.md
816f864b6 Release 0.74.1
1732f3461 Merge branch 'temp741'
d473f21c1 releaser: Add release notes to /docs for release of 0.74.1
bb234e9cd Add release notes 0.74.0
5cb3166d4 releaser: Add release notes to /docs for release of 0.74.0
7f35a3800 Merge commit '823ce055ed3356da37e9ec4ac70446bdbbaa8de8'
4b7054be5 docs: Regenerate docs helper
1d86f0aed Merge commit '6aa5c9117fd34644459ea9bcfb1b3f5010658d5d'
068b2ab28 Update formats.md doc for new allowed extensions.
d71ed99d3 Add support for inline partials
efe0e549c Rework external asciidoctor integration

git-subtree-dir: docs
git-subtree-split: a26d0e6104
2020-07-20 22:19:42 +02:00
Bjørn Erik Pedersen 9f9191471e deps: esbuild v0.6.5 2020-07-20 22:19:08 +02:00
hugoreleaser 3727a9d111 releaser: Prepare repository for 0.75.0-DEV
[ci skip]
2020-07-17 17:35:17 +00:00
hugoreleaser 48565de62f releaser: Add release notes to /docs for release of 0.74.2
[ci skip]
2020-07-17 17:22:42 +00:00
hugoreleaser 808e126216 releaser: Bump versions for release of 0.74.2
[ci skip]
2020-07-17 17:22:42 +00:00
hugoreleaser aa85a46dc6 releaser: Add release notes for 0.74.2
[ci skip]
2020-07-17 17:22:42 +00:00
Bjørn Erik Pedersen 35011bcb26 Add .Defines to js.Build options
This is needed to import `react` as a library, e.g.:

```
{{ $jsx := resources.Get "index.jsx" }}
{{ $options := dict "defines" (dict "process.env.NODE_ENV" "\"development\"") }}
{{ $js := $jsx | js.Build $options }}
```

Fixes #7489
2020-07-17 19:09:09 +02:00
hugoreleaser 084624baac releaser: Prepare repository for 0.75.0-DEV
[ci skip]
2020-07-13 19:06:13 +00:00
hugoreleaser 15163266c1 releaser: Add release notes to /docs for release of 0.74.1
[ci skip]
2020-07-13 18:52:36 +00:00
hugoreleaser a74f7d3cc0 releaser: Bump versions for release of 0.74.1
[ci skip]
2020-07-13 18:52:36 +00:00
hugoreleaser cb84d98169 releaser: Add release notes for 0.74.1
[ci skip]
2020-07-13 18:52:36 +00:00
Bjørn Erik Pedersen c91dbe4ce9 Fix baseof block regression
From Hugo 0.74.0.

Fixes #7478
2020-07-13 20:45:09 +02:00
hugoreleaser 6e0452e189 releaser: Prepare repository for 0.75.0-DEV
[ci skip]
2020-07-13 10:42:11 +00:00
hugoreleaser d2b1162680 releaser: Add release notes to /docs for release of 0.74.0
[ci skip]
2020-07-13 10:30:11 +00:00
hugoreleaser 6265184309 releaser: Bump versions for release of 0.74.0
[ci skip]
2020-07-13 10:30:11 +00:00
Bjørn Erik Pedersen 797127010d Release 0.74.0 2020-07-13 12:20:41 +02:00
hugoreleaser 1672a332da releaser: Add release notes for 0.74.0
Rename to *-ready.md to continue.
[ci skip]
2020-07-13 09:47:04 +00:00
Bjørn Erik Pedersen 823ce055ed Squashed 'docs/' changes from cfd74b57d..c3b4f8410
c3b4f8410 Update theme
0aaecc16c Remove unnecessary period. (#1168)

git-subtree-dir: docs
git-subtree-split: c3b4f84106
2020-07-13 11:01:55 +02:00
Bjørn Erik Pedersen 5f7a65a080 Merge commit '823ce055ed3356da37e9ec4ac70446bdbbaa8de8' 2020-07-13 11:01:55 +02:00
Bjørn Erik Pedersen 25e3da3343 docs: Regenerate docs helper 2020-07-13 11:01:38 +02:00
Bjørn Erik Pedersen 9df98ec49c Add proper Media Type handling in js.Build
See #732
2020-07-13 10:56:23 +02:00
Remko Tronçon 2fc3380707 Add js.Build asset bundling
Fixes #7321
2020-07-13 10:56:23 +02:00
Bjørn Erik Pedersen f1916f114b Merge commit '6aa5c9117fd34644459ea9bcfb1b3f5010658d5d' 2020-07-07 07:00:01 +02:00
Bjørn Erik Pedersen 6aa5c9117f Squashed 'docs/' changes from ac2c4a487..cfd74b57d
cfd74b57d Add a config file update step.
5957d8815 Wrap cache configuration in code-toggle
914405c0e capitalization and indentation fix for taxonomies page (#1159)
223b80f42 Fix page kinds shortcode not rendering on Taxonomies page (#1158)
a9b6fa984 Clarify weight description.
29e121681 Warn about zero weights in front matter.
27ce7ba8c Release 0.73.0
e9596b2ee Merge branch 'temp73'
074a270cd releaser: Add release notes to /docs for release of 0.73.0
4f56a9fc0 width fix of expanding code box in documentation (#1156)
f27254d60 css fix of expanding code box in documentation (#1155)
43b576178 Fix incorrect directory name in quick-start (#1154)
16726eacf Add GroupByLastmod
73c31758e Fix for broken link again (#1151)
d07067295 Fix broken link (#1144)
bc0b484d1 Rename taxonomy kinds from taxonomy to term, taxonomyTerm to taxonomy
674d71842 Fix Typo on Docker section of installation page
b87778165 Merge commit 'efa74c5c6e6ff1daddeb5834ea7c69bed2acf171'
c7cdebed3 tpl/crypto: Add hmac
260130cc0 Allow hook template per section/type
1f70519d8 releaser: Add release notes to /docs for release of 0.72.0
8516d540c Merge commit '9e1dcefc5f559944b70d2fa520f6acd5c56a69f2'
c49195c69 common/maps: Add Scratch.Values
78072df81 Add redirect support to the server
90ca0af6b Fix typo in install instructions

git-subtree-dir: docs
git-subtree-split: cfd74b57d9
2020-07-07 06:58:43 +02:00
Bjørn Erik Pedersen 12a65e76df Add openapi3.Unmarshal
Fixes #7442
Fixes #7443
2020-07-06 20:03:36 +02:00
Joe Mooring 58c0f5e617 Remove trailing hyphen from auto heading ID
Applicable when autoHeadingIDType is either `github` or `github-ascii`.

When autoHeadingIDType is `blackfriday`, the existing code removes
trailing whitespace while iterating through the characters, using
a boolean "futureDash" mechanism.

Fixes #6798
2020-07-05 14:13:02 +02:00
Robert van Gent a1c3e3c1f3 deploy: Ensure that non-trivial default flag values are passed through. 2020-07-04 21:19:25 +02:00
Bjørn Erik Pedersen 42e150fbfa Fix server reload when non-HTML shortcode changes
Fixes #7448
2020-07-03 23:31:51 +02:00
Bjørn Erik Pedersen 028b356787 tpl/strings: Add strings.Count
Fixes #7453
2020-07-03 10:35:46 +02:00
Bryan Klein e9f87c4e3f Update formats.md doc for new allowed extensions.
This PR documents the changes made in https://github.com/gohugoio/hugo/pull/7447/files adding two other extensions to the Allowed list.
2020-07-03 01:27:51 +02:00
Bjørn Erik Pedersen defd7106bf tpl: Add debug.Dump
Fixes #3957
2020-07-02 09:04:46 +02:00
Bryan Klein beb6c03bc8 Update config.go to add two Asciidoctor extensions
Added two common extensions to allow my Hugo+Asciidoctor site to build with the new configuration.
2020-07-02 07:57:43 +02:00
Bjørn Erik Pedersen 4a3efea7ef Add support for inline partials
Fixes #7444
2020-07-01 23:10:21 +02:00
Sebastian Boehm c66dc6c74f Add support for native Org dates in frontmatter 2020-06-30 10:30:55 +02:00
Niklas Fasching 127d5feb32 deps: Update go-org to v1.3.0
- Add support for image links (i.e. link with image as description)
- Kinda breaking: Wrap headlines and headline+content in containers as emacs
  Org mode does. Could break people's styles - I don't expect it, but who knows
  what counts as sane when it comes to css.

  Before:

  ```
  <h2 id="headline-1">FOO</h2>
  foo bar
  ```

  After:

  ```
  <div id="outline-container-headline-1" class="outline-2">
  <h2 id="headline-1">FOO</h2>
  <div id="outline-text-headline-1" class="outline-text-2">
  foo bar
  </div>
  </div>
  ```
2020-06-29 18:08:06 +02:00
Niklas Fasching 2d42ba912b deps: Update go-org to v1.2.0
- Add support for #+MACRO
- fix a bug with #+LINK (edge case, should never happen anyways :TM:)
- Make title export optional (add export option)
- Remove cosmetic whitespace added by go-org (for easier visual
  diffing) inside p tags (<p>\nfoo\n</p> => <p>foo</p>)
  (should make `white-space: pre` on p look more in line with expectations)
- implement table separators via multiple tbodies (the html spec is ok with
  that)
2020-06-27 13:28:01 +02:00
Bjørn Erik Pedersen 5b7b5dea1f Update bug_report.md 2020-06-26 21:03:09 +02:00
Bjørn Erik Pedersen ccfaeb678b hugolib: Add missing zero check on file 2020-06-26 13:27:01 +02:00
Bjørn Erik Pedersen 057b1377c5 cache: Remove some unused code 2020-06-25 17:34:58 +02:00
Bjørn Erik Pedersen 48dbb593f7 commands: Add an option to print memory usage at intervals
Use it with `hugo --print-mem
2020-06-25 12:19:21 +02:00
Derk Muenchhausen f0266e2ef3 Rework external asciidoctor integration
This commit solves the relative path problem with asciidoctor tooling. An include will resolve relatively, so you can refer easily to files in the same folder.

Also `asciidoctor-diagram` and PlantUML rendering works now, because the created temporary files will be placed in the correct folder.

This patch covers just the Ruby version of asciidoctor. The old AsciiDoc CLI EOLs in Jan 2020, so this variant is removed from code.

The configuration is completely rewritten and now available in `config.toml` under the key `[markup.asciidocext]`:

```toml
[markup.asciidocext]
    extensions = ["asciidoctor-html5s", "asciidoctor-diagram"]
    workingFolderCurrent = true
    trace = true
    [markup.asciidocext.attributes]
        my-base-url = "https://example.com/"
        my-attribute-name = "my value"
```

- backends, safe-modes, and extensions are now whitelisted to the popular (ruby) extensions and valid values.
- the default for extensions is to not enable any, because they're all external dependencies so the build would break if the user didn't install them beforehand.
- the default backend is html5 because html5s is an external gem dependency.
- the default safe-mode is safe, explanations of the modes: https://asciidoctor.org/man/asciidoctor/
- the config is namespaced under asciidocext_config and the parser looks at asciidocext to allow a future native Go asciidoc.
- `uglyUrls=true` option and `--source` flag are supported
- `--destination` flag is required

Follow the updated documentation under `docs/content/en/content-management/formats.md`. 
  
This patch would be a breaking change, because you need to correct all your absolute include pathes to relative paths, so using relative paths must be configured explicitly by setting `workingFolderCurrent = true`.
2020-06-25 09:51:33 +02:00
Bjørn Erik Pedersen 77aa385b84 Enable the embedded template test when race detector is off
See #5926
2020-06-25 09:16:28 +02:00
Bjørn Erik Pedersen 545a1c1ced Merge branch 'release-0.73.0' 2020-06-23 18:45:33 +02:00
hugoreleaser 47aaa52e39 releaser: Prepare repository for 0.74.0-DEV
[ci skip]
2020-06-23 16:42:50 +00:00
hugoreleaser 428907cc34 releaser: Add release notes to /docs for release of 0.73.0
[ci skip]
2020-06-23 16:29:21 +00:00
hugoreleaser a78b3e3415 releaser: Bump versions for release of 0.73.0
[ci skip]
2020-06-23 16:29:21 +00:00
Bjørn Erik Pedersen cfcb014515 Release 0.73.0 2020-06-23 18:21:12 +02:00
Mateusz Szczyrzyca 0b579db80f Updated installation instruction about Sass/SCSS support 2020-06-23 17:08:29 +02:00
hugoreleaser ee5d027cd5 releaser: Add release notes for 0.73.0
Rename to *-ready.md to continue.
[ci skip]
2020-06-23 08:57:01 +00:00
Bjørn Erik Pedersen 4a340ba254 Remove some old release notes 2020-06-23 09:37:25 +02:00
Nico 3466884e36 Create robots.txt in the domain root directory
Before a robots.txt is created in every Site. So in public/robots.txt if there are no languages (was correct). But if there are multiple languages in every language directory, too (was wrong). If defaultContentLanguageInSubdir is true, no language is created into the root directory, so no robots.txt is in the root directory (was wrong). If multihosts are configured for each language, that is the only case where one robots.txt must be created in each language directory (was correct).

I've changed the behaviour, that only in the multihost case the robots.txt is created in the language directories. In any other case it is created in public/robots.txt. I've also added tests that files are not created in the wrong directories.

Fixes #5160
See also #4193
2020-06-20 17:13:26 +02:00
Bjørn Erik Pedersen 6ff435aa3f Make GroupByParamDate work with string params
Fixes #3983
2020-06-19 11:58:58 +02:00
Bjørn Erik Pedersen 82abca32fa Add GroupByLastmod
Fixes #7408
2020-06-19 11:58:58 +02:00
Bjørn Erik Pedersen fc045e12a9 Rename taxonomy kinds from taxonomy to term, taxonomyTerm to taxonomy
And we have taken great measures to limit potential site breakage:

* For `disableKinds` and `outputs` we try to map from old to new values if possible, if not we print an ERROR that can be toggled off if not relevant.
* The layout lookup is mostly compatible with more options for the new `term` kind.

That leaves:

* Where queries in site.Pages using taxonomy/taxonomyTerm Kind values as filter.
* Other places where these kind value are used in the templates (classes etc.)

Fixes #6911
Fixes #7395
2020-06-18 09:09:56 +02:00
Helder Pereira 9679023f2b Fix aliases with path in baseURL 2020-06-17 10:52:35 +02:00
Bjørn Erik Pedersen 0a9172672a Merge commit 'efa74c5c6e6ff1daddeb5834ea7c69bed2acf171' 2020-06-16 14:19:31 +02:00
Bjørn Erik Pedersen efa74c5c6e Squashed 'docs/' changes from 9be494de3..ac2c4a487
ac2c4a487 Update documentation for Ugly URLs (#1082)
88bdec17a Change 072.0 to 0.72.0 in release post's description
2aa7d7818 Update rss.md (#1104)
c80677aeb Update quick-start.md (#1076)
d04196bbd Minor spelling and capitalization fixes
837d2feba Fixed spelling mistake
67dc78e12 Update installing.md
ce280c5d6 Update relurl.md
bb4d0e703 Capitalization and Redirecting URL fixes
e1fecada0 Update partials.md
1d99bb182 Typos and whitespacing issues fixed
b20dba125 actually fix index function link this time
f47d6f1e3 Fixing typos, whitespace issues and links
dc82309b9 fix link to the index function
1eab0cbea add missing word (#1130)
9c3ee62ae more fixes
e9bc5880a whitespace, typos and HTTPS fixes
93b806493 Add missing word to Module section
80ced9062 Display image on page bundles page.
727029b0a Update index.md
51fc48e4d Release 0.72.0
1ff68ac3b releaser: Add release notes to /docs for release of 0.72.0
f74a25b92 common/maps: Add Scratch.Values
2fd83db96 Add redirect support to the server
bdfccf9f4 Fix typo in install instructions
e12737ea6 Create SUPPORT.md

git-subtree-dir: docs
git-subtree-split: ac2c4a4871
2020-06-16 14:18:51 +02:00
Bjørn Erik Pedersen 6408c1cbc8 Fix server data race/nil pointer in withMaps
Fixes #7392
2020-06-16 11:48:10 +02:00
Bjørn Erik Pedersen 522ba1cd98 Fix order of GetTerms
Preserve the order from front matter, which would be behaviour when doing this manually (before GetTerms).

Fixes #7213
2020-06-15 22:23:02 +02:00
Cameron Moore 889dc47ceb Add genDocsHelper mage target
Expose the functionality of the hidden `hugo gen docshelper` command as
a mage target.
2020-06-15 20:07:28 +02:00
Helder Pereira f720fe56db Fix aliases with uglyURLs 2020-06-15 12:19:59 +02:00
Bjørn Erik Pedersen d6ed17c60f Fix crash for closing shortcode with no .Inner set
Fixes #6857
Closes #7330
2020-06-14 20:19:08 +02:00
Helder Pereira 145b3fcce3 Fix aliases with relativeURLs 2020-06-14 14:08:41 +02:00
Bjørn Erik Pedersen 01e249e97c Regenerate templates 2020-06-12 11:29:04 +02:00
Joe Mooring 4b560cc119 Beautify HTML generated by pagination template
Fixes #7199.
2020-06-12 11:27:20 +02:00
Bjørn Erik Pedersen e3e627e6b7 Add a nested data dir test
Ref. a discussion.
2020-06-12 09:14:20 +02:00
Raphael Krupinski 83d03a5201 hugofs: Use os.PathError in RootMappingFs.doLstat 2020-06-11 14:59:01 +02:00
Bjørn Erik Pedersen fc0f13b684 commands: Fix URL rewrites vs fast render server mode
Fixes #7357
2020-06-06 12:37:42 +02:00
Edouard 7eeebe1e5a tpl/crypto: Add hmac 2020-06-05 20:04:11 +02:00
Alexandros 740fa4a91d Remove credit (#7347) 2020-06-02 19:31:15 +02:00
Bjørn Erik Pedersen f8c67f93e1 Allow hook template per section/type
Fixes #7349
2020-06-02 19:02:10 +02:00
Sam Smith 3d9235e8fc tpl: Fix bad rounding in NumFmt
strconv.FormatFloat doesn't round properly sometimes, this adds a
different method of rounding, fixes #7116
2020-06-02 17:20:36 +02:00
hugoreleaser f7d909f394 releaser: Prepare repository for 0.73.0-DEV
[ci skip]
2020-05-31 12:16:50 +00:00
hugoreleaser 8a7ef3cf4e releaser: Add release notes to /docs for release of 0.72.0
[ci skip]
2020-05-31 12:05:36 +00:00
hugoreleaser 2dfe242ea6 releaser: Bump versions for release of 0.72.0
[ci skip]
2020-05-31 12:05:36 +00:00
Bjørn Erik Pedersen 7a1464e547 Release 0.72.0 2020-05-31 13:48:27 +02:00
hugoreleaser 41d50b4dd3 releaser: Add release notes for 0.72.0
Rename to *-ready.md to continue.
[ci skip]
2020-05-31 11:03:50 +00:00
Bjørn Erik Pedersen 4d53ae697e releaser: Adjust the "thanks" section 2020-05-31 12:46:18 +02:00
Bjørn Erik Pedersen 626b16e024 Merge commit '9e1dcefc5f559944b70d2fa520f6acd5c56a69f2' 2020-05-31 12:43:33 +02:00
Bjørn Erik Pedersen 9e1dcefc5f Squashed 'docs/' changes from 6c2195936..9be494de3
9be494de3 Clean up the markup config
c3e123133 Remove JustComment
bc1b02bc5 Add Smart to Anchor section
49e796409 Added where .RegularPagesRecursive was added
a92296e31 Fixed the new-in shortcode in pages-vs-site-pages
051e1267c Documented .RegularPagesRecursive
5bcec88a3 Fix broken link in RSS templates page
3db79d433 Correct pull request link on migrations.md
55c347168 Release 0.71.1
11a4e36c3 Merge branch 'temp711'
481fc8ed6 releaser: Add release notes to /docs for release of 0.71.1
40ba83c26 Update site.md
382632b58 Use-modules: More help how to get started importing a theme (#1107)
06751d465 Addition of hugefastsearch to search options (#1118)
8346d3b18 Add example of how to set the permalinks option for pages in "root"
ebb3b4f3a Refine highlight shortcode options
1075a172a Update index.md
7cc927ea6 Fix typo in v0.71.0 release notes
4121da273 Pull in latest theme version to get link hooks
4809be651 Document render-heading feature
2078a3bd1 Release 0.71.0
c09f6899e releaser: Add release notes to /docs for release of 0.71.0
90ffe2b50 Merge commit 'c9403cbceaaeff53ff4833561f4eefe1dc1a405e'
bf3dd0837 Add math.Pow

git-subtree-dir: docs
git-subtree-split: 9be494de3a
2020-05-31 12:43:23 +02:00
Bjørn Erik Pedersen 2919a6a503 common/maps: Add Scratch.Values
Fixes #7335
2020-05-29 19:51:49 +02:00
Bjørn Erik Pedersen 432885c499 deps: Update Goldmark to improve Typographer
See https://github.com/yuin/goldmark/releases/tag/v1.1.31
See #7289
2020-05-29 19:02:30 +02:00
Bjørn Erik Pedersen 6a3e89743c Add redirect support to the server
Fixes #7323
2020-05-28 16:25:34 +02:00
Yash Murty 9613e3e8a8 Fix typo in install instructions 2020-05-27 13:54:11 +02:00
Bjørn Erik Pedersen c950c86b4e publisher: Fix tag collector for nested table elements
Fixes #7318
2020-05-27 11:10:48 +02:00
Anthony Fok 915202494b snap: Fix build error: my previous commits did not fix it
- Revert to legacy snap and my custom plugin x-nodejs for now
- Quote "@babel/cli" and add "@babel/core"
- Change bin/babel.js to bin/babel
2020-05-25 11:26:26 -06:00
hugoreleaser b3e4f911f4 releaser: Prepare repository for 0.72.0-DEV
[ci skip]
2020-05-25 09:21:10 +00:00
hugoreleaser a301f6b2ae releaser: Add release notes to /docs for release of 0.71.1
[ci skip]
2020-05-25 09:08:55 +00:00
hugoreleaser 646bc85088 releaser: Bump versions for release of 0.71.1
[ci skip]
2020-05-25 09:08:55 +00:00
hugoreleaser 5c0d10045d releaser: Add release notes for 0.71.1
[ci skip]
2020-05-25 09:08:55 +00:00
Bjørn Erik Pedersen 81f5633245 Add some more date test cases
See #7310
2020-05-24 14:35:49 +02:00
Bjørn Erik Pedersen 9698b0dab1 Fix RenderString vs render hooks
Fixes #7265
2020-05-24 13:20:57 +02:00
Bjørn Erik Pedersen 32344fe3db Prevent WARNINGs in RenderString 2020-05-24 12:49:45 +02:00
Bjørn Erik Pedersen 4d7fa9f114 Fix IsAncestor/IsDescendant for taxonomies
Fixes #7305
2020-05-24 12:35:45 +02:00
Bjørn Erik Pedersen a985efcecf Fix GetPage on section/bundle name overlaps
In the internal Radix we stored the directory based nodes without a traling slash, e.g. `/blog`.

The original motivation was probably to make it easy to do prefix searching: Give me all ancestors.

This, however have lead to some ambigouty with overlapping directory names.

This particular problem was, however, not possible to work around in an easy way, so from now we store these as `/blog/`.

Fixes #7301
2020-05-24 12:35:45 +02:00
Bjørn Erik Pedersen 6c3c6686f5 Fix Go template script escaping
Fixes #6695
2020-05-23 22:00:34 +02:00
Bjørn Erik Pedersen c34bf48560 Add a test helper 2020-05-22 10:57:25 +02:00
hugoreleaser 833d16d467 releaser: Prepare repository for 0.72.0-DEV
[ci skip]
2020-05-18 16:18:12 +00:00
hugoreleaser 06150c87be releaser: Add release notes to /docs for release of 0.71.0
[ci skip]
2020-05-18 16:05:47 +00:00
hugoreleaser 330e52ebe6 releaser: Bump versions for release of 0.71.0
[ci skip]
2020-05-18 16:05:47 +00:00
Bjørn Erik Pedersen 9e78235374 Release 0.71 2020-05-18 17:57:12 +02:00
hugoreleaser 7cd66c53b9 releaser: Add release notes for 0.71.0
Rename to *-ready.md to continue.
[ci skip]
2020-05-18 15:47:00 +00:00
Bjørn Erik Pedersen 723ec555e7 Fix Babel on Windows
Fixes #7251
2020-05-18 16:57:13 +02:00
Bjørn Erik Pedersen 518d149646 commands: Use WARN log level also for the early initialization
Fixes #7285
2020-05-18 16:52:45 +02:00
Bjørn Erik Pedersen e0e81b280f Merge commit 'c9403cbceaaeff53ff4833561f4eefe1dc1a405e' 2020-05-18 15:25:26 +02:00
Bjørn Erik Pedersen c9403cbcea Squashed 'docs/' changes from ec0abe052..6c2195936
6c2195936 Update featured.png
109a0fcca add len function to navigation side menu
39a356bc5 Revert "Add some rickrolls redirects"
b8393b1b5 Add some rickrolls redirects
2ce21c34b Update configuration-markup.md (add rel="noopener")
95bd7974e Disambiguate global and page resources
5e233dc4b Update base.md
959b9dc3a Fix typo on "where" page
aff8059a1 Release 0.70.0
44a172ac0 releaser: Add release notes to /docs for release of 0.70.0
1b01c8988 Release 0.70.0
5ece21c6c Merge commit '89044b8f8795f17c36396c67823183a20fc88139'
0894aec5b Rename transpileJS to babel
5da27c7a6 resources: Add JavaScript transpiling solution

git-subtree-dir: docs
git-subtree-split: 6c21959360
2020-05-18 15:24:58 +02:00
Bjørn Erik Pedersen 3cc41523be Update to Go 1.14.3 and Go 1.13.11 2020-05-16 23:25:45 +02:00
Bjørn Erik Pedersen 2fd0a5a678 Improve error message when no Babel installed 2020-05-16 12:51:35 +02:00
Cameron Little 6e051c053e Add test for headings render hook 2020-05-15 21:12:43 +02:00
Eli W. Hunter 423b8f2fb8 Add render template hooks for headings
This commit also

* Renames previous types to be non-specific. (e.g. hookedRenderer rather
  than linkRenderer)

Resolves #6713
2020-05-15 21:12:43 +02:00
Joe Mooring 991934497e Add math.Pow
Closes #7266
2020-05-14 10:00:31 +02:00
John Weldon 558c09305e deploy: Do not suppress .well-known/ directory
Deployments ignore directories with a leading `.`, but should not ignore
certain well known 'hidden' directories like `.well-known/`

Fixes #6691
2020-05-14 09:56:53 +02:00
Anthony Fok b69a36140f snap: Quote "@babel/cli" to solve build error
Cannot parse snapcraft.yaml from ~gohugoio/hugo/+git/hugo:master:
  while scanning for the next token found character ‘@’ that cannot
  start any token in “”, line 70, column 34: node-packages:
  [postcss-cli, @babel/cli] ^

Also:

- Upgrade to snapcraft 3.x by adding "base: core"
- Add "license: Apache-2.0"
2020-05-12 14:29:57 -06:00
Anthony Fok a0103864ab snap: Remove custom x-nodejs plugin
My changes have been merged into snapcraft upstream.

https://bugs.launchpad.net/snapcraft/+bug/1795531
https://bugs.launchpad.net/snapcraft/+bug/1797374

Revert "snap: Add custom x-nodejs plugin to support ppc64el and s390x"

This reverts commit 91f49c0700.
2020-05-12 14:27:57 -06:00
Cameron Little b342e8fbdb Upgrade chroma to 0.7.3 to fix invalid css
The new version of chroma includes a fix to not emit styles for tokens
without a class (which is invalid).

Fixes #7207
2020-05-09 17:05:14 +02:00
Daniel Tipping 6205d56b85 Use .Lastmod for og:updated_time
.Lastmod is the time at which the website was most recently updated,
rather than .Date which is the time at which the website content file
was created.
2020-05-07 18:42:20 +02:00
hugoreleaser a5039dddaf releaser: Prepare repository for 0.71.0-DEV
[ci skip]
2020-05-06 11:29:18 +00:00
hugoreleaser 7f47b99ea9 releaser: Add release notes to /docs for release of 0.70.0
[ci skip]
2020-05-06 11:16:40 +00:00
hugoreleaser b98e2f66b0 releaser: Bump versions for release of 0.70.0
[ci skip]
2020-05-06 11:16:40 +00:00
Bjørn Erik Pedersen 57ebab7c23 Release 0.70.0 2020-05-06 13:06:10 +02:00
hugoreleaser 0e314925fb releaser: Add release notes for 0.70.0
Rename to *-ready.md to continue.
[ci skip]
2020-05-06 10:24:22 +00:00
Bjørn Erik Pedersen e4621446ce Merge commit '89044b8f8795f17c36396c67823183a20fc88139' 2020-05-06 12:12:57 +02:00
Bjørn Erik Pedersen 89044b8f87 Squashed 'docs/' changes from 19f44e150..ec0abe052
ec0abe052 Update index.md
ed44339cd Update bio.md
cef04eb95 Minor edits
4d45dcc8d Submitting Digital.gov to the Hugo Showcase
d35126af7 Azure uses storage containers, not buckets; edited accordingly. (#1078)
9c249cc89 fix grammatical error
9728699a3 Release Hugo 0.69.2
cccabed0c Merge branch 'temp692'
3d0a740c4 releaser: Add release notes to /docs for release of 0.69.2
b760aceb1 HTTPS external links in docs
49e4631b0 Release 0.69.1
01f3da870 Merge branch 'temp691'
8280d85aa releaser: Add release notes to /docs for release of 0.69.1
40ea44d24 fix typo (#1088)
725f53643 Rebuild cache
80ee1efd9 Add KeyCDN Showcase
f253e906e docs: Fix typo in Hugo's Security Model
b3ffd1ad3 Mentioning a range is equivalent to foreach (#1086)
0c396911f Update jsonify function docs
376befc9a Fix typo (#1084)
4bdc9bc72 Mark .Page.UniqueID as deprecated and add .File.UniqueID
30a7b7bf2 Update hosting-on-github.md
c5db4ba2b Update postprocess.md
1121f74a5 Update install guide with Scoop extended
8988aa6fa Merge branch 'postprocess'
225d3f9c7 Release Hugo 0.69.0
4caf7a89a releaser: Add release notes to /docs for release of 0.69.0
664b2a0fa Document resources.PostProcess and buildStats
9737b34e9 docs: Regen docs helper
0fab3ba24 Merge commit 'da3c3e5fbd0de65f956618cd2e35401460a3cd02'
96dad83b1 Update hosting-on-aws-amplify.md
57eb27897 Merge commit 'c494c37a4523fbf2db6274dc87e0877fd5bec24b'
dcc7afef7 fix typo in getting started

git-subtree-dir: docs
git-subtree-split: ec0abe052b
2020-05-06 12:12:21 +02:00
Piotr Perzyna 01befcce35 deps: Update minify to v2.6.2
Fixes #6699
2020-05-03 17:29:26 +02:00
Tom 04b1a6d997 Add support for sort by boolean 2020-05-02 11:57:34 +02:00
Bjørn Erik Pedersen dd31e80007 deps: Update to Libsass 3.6.4
Fixes #7231
2020-05-01 19:14:04 +02:00
Bjørn Erik Pedersen 6add6d77b4 Rename transpileJS to babel
And add a test.

Updates #5764
2020-04-29 10:51:33 +02:00
Niek de Wit 2a171ff1c5 resources: Add JavaScript transpiling solution
Add a new pipe called TranspileJS which uses the Babel cli. This makes it possible for users to write ES6 JavaScript code and transpile it to ES5 during website generation so that the code still works with older browser versions.

Fixes #5764
2020-04-29 10:51:33 +02:00
Bjørn Erik Pedersen 67f920419a Disable a test locally
It has started to fail in LiteIDE for some reason (works from the shell and on CI).
2020-04-28 12:24:02 +02:00
Bjørn Erik Pedersen c03ea2b660 Fix some missing JS class collector cases
Fixes #7216
2020-04-27 19:06:29 +02:00
Michael Lynch fe60b7d9e4 Add diagnostic hints to init timeout message
Expand the text in the init timeout message to give the reader more hints as to what may be causing the issue.

The current error sent me on a wild goose chase trying to debug my shortcodes, but it turned out that the issue was just that I wasn't caching my resources/ directory on my build server. Once I found this blog post, I solved the issue in minutes:

https://www.henriksommerfeld.se/hugo-timeout-not-a-circular-loop-in-shortcode/

Googling the error message yields several additional posts from users who focus on loops in their shortcode when the problem seems to be overly-expensive builds.
2020-04-27 13:23:35 +02:00
hugoreleaser c2d9fd1ebe releaser: Prepare repository for 0.70.0-DEV
[ci skip]
2020-04-24 08:00:48 +00:00
hugoreleaser ec9dcf3048 releaser: Add release notes to /docs for release of 0.69.2
[ci skip]
2020-04-24 07:48:07 +00:00
hugoreleaser 03802ff3cb releaser: Bump versions for release of 0.69.2
[ci skip]
2020-04-24 07:48:07 +00:00
hugoreleaser 5e31198c98 releaser: Add release notes for 0.69.2
[ci skip]
2020-04-24 07:48:07 +00:00
Takayama Fumihiko 8d5766d417 Fix IsAncestor and IsDescendant when the same page is passed 2020-04-23 20:23:42 +02:00
SatowTakeshi 5c41f41ad4 deps: Update goldmark-highlighting
Recreate #7027
Fixes #6596
2020-04-23 18:48:52 +02:00
Takayama Fumihiko 27a4c4410c Fix IsAncestor and IsDescendant under subsection 2020-04-23 18:12:13 +02:00
hugoreleaser ade27699e5 releaser: Prepare repository for 0.70.0-DEV
[ci skip]
2020-04-22 08:07:03 +00:00
hugoreleaser 17661debb6 releaser: Add release notes to /docs for release of 0.69.1
[ci skip]
2020-04-22 07:55:01 +00:00
hugoreleaser 8549189e8e releaser: Bump versions for release of 0.69.1
[ci skip]
2020-04-22 07:55:01 +00:00
hugoreleaser c2c7a4ce5b releaser: Add release notes for 0.69.1
[ci skip]
2020-04-22 07:55:01 +00:00
Panagiotis Koursaris 49e6c8cb4e hugolib/filesystems: Fix typo in test suite 2020-04-21 23:16:36 +02:00
Bjørn Erik Pedersen f37e77f2d3 Fix class collector when running with --minify
Also add a related stresstest.

Fixes #7161
2020-04-21 21:00:52 +02:00
Bjørn Erik Pedersen 27af5a339a related: Fix toLower
Don't change the slice.

Fixes #7198
2020-04-21 17:46:26 +02:00
Bjørn Erik Pedersen b3c825756f Fix broken test 2020-04-21 16:44:35 +02:00
BurtonQin 5146dc614f tpl/tmplimpl/template: Change defer RLock to RUnlock 2020-04-21 13:23:31 +02:00
Boqin Qin 736f84b2d5 hugolib: Add Unlock before panic 2020-04-20 17:47:34 +02:00
Onur Yaman cd4d820201 docs: Fix typo in Hugo's Security Model 2020-04-18 14:16:42 +02:00
Niklas Fasching 2b28e5a9cb deps: Update go-org to v1.1.0
- inline source blocks and exports
- result blocks and source block :exports parameter
- fix: html escaping in example blocks
- #+LINK based links
2020-04-17 22:07:52 +02:00
Steve 102ec2da7a commands: Modify gen chromastyles to output all CSS classes
Chroma was updated to include a new function to output all CSS
classes without skipping any considered redundant with the current
style.

This will modify the `hugo gen chromastyles` command to use this new
function by default, which avoids potential problems if the style is
later modified.

Also includes requires the updated Chroma (v0.7.2).

Resolves #7167
2020-04-13 18:31:33 +02:00
Bjørn Erik Pedersen feaa582cbe deps: Update to goldmark v1.1.28
Fixes #7113
2020-04-13 16:55:23 +02:00
Bjørn Erik Pedersen ee67dbeff5 Fix query parameter handling in server fast render mode
There may be a simpler way to get to the raw path, but this will have to do for now.

Fixes #7163
2020-04-12 19:18:54 +02:00
hugoreleaser 4a3f2427ed releaser: Prepare repository for 0.70.0-DEV
[ci skip]
2020-04-10 09:19:20 +00:00
hugoreleaser 4205844bce releaser: Add release notes to /docs for release of 0.69.0
[ci skip]
2020-04-10 09:08:37 +00:00
hugoreleaser 9b55d13589 releaser: Bump versions for release of 0.69.0
[ci skip]
2020-04-10 09:08:37 +00:00
Bjørn Erik Pedersen 6f56a636f6 Update 0.69.0-relnotes.md 2020-04-10 10:58:36 +02:00
hugoreleaser 5ec7fa343a releaser: Add release notes for 0.69.0
Rename to *-ready.md to continue.
[ci skip]
2020-04-10 08:25:47 +00:00
Bjørn Erik Pedersen b7ff4dc23e docs: Regen docs helper 2020-04-10 09:07:41 +02:00
Bjørn Erik Pedersen da3c3e5fbd Squashed 'docs/' changes from 20d77860b..19f44e150
19f44e150 fix typo (#1077)
b66478084 Fix build listing improvements version

git-subtree-dir: docs
git-subtree-split: 19f44e150f
2020-04-10 09:06:04 +02:00
Bjørn Erik Pedersen 30748decf1 Merge commit 'da3c3e5fbd0de65f956618cd2e35401460a3cd02' 2020-04-10 09:06:04 +02:00
Bjørn Erik Pedersen 095bf64c99 Collect HTML elements during the build to use in PurgeCSS etc.
The main use case for this is to use with resources.PostProcess and resources.PostCSS with purgecss.

You would normally set it up to extract keywords from your templates, doing it from the full /public takes forever for bigger sites.

Doing the template thing misses dynamically created class names etc., and it's hard/impossible to set up in when using themes.

You can enable this in your site config:

```toml
[build]
  writeStats = true
```

It will then write a `hugo_stats.json` file to the project root as part of the build.

If you're only using this for the production build, you should consider putting it below `config/production`.

You can then set it up with PostCSS like this:

```js
const purgecss = require('@fullhuman/postcss-purgecss')({
    content: [ './hugo_stats.json' ],
    defaultExtractor: (content) => {
        let els = JSON.parse(content).htmlElements;
        return els.tags.concat(els.classes, els.ids);
    }
});

module.exports = {
    plugins: [
        require('tailwindcss'),
        require('autoprefixer'),
        ...(process.env.HUGO_ENVIRONMENT === 'production' ? [ purgecss ] : [])
    ]
};
```

Fixes #6999
2020-04-09 22:57:26 +02:00
Elliott Sales de Andrade 7791a804e2 deps: Update to latest emoji package 2020-04-08 12:56:14 +02:00
Helicer c774b230e9 Update hosting-on-aws-amplify.md
AWS Amplify now supports a GUI method for using the latest `hugo` version. Please feel free to modify my wording here, etc.
2020-04-07 22:48:55 +02:00
Bjørn Erik Pedersen 2f721f8ec6 Add basic "post resource publish support"
Fixes #7146
2020-04-07 21:59:20 +02:00
Cameron Moore 8568928aa8 tpl: Extend Jsonify to support options map
Add support for prefix and indent options used by json.MarshalIndent
from the Go stdlib.
2020-04-07 20:01:57 +02:00
Cameron Moore 1bc93021e3 tpl: Extend Jsonify to support optional indent parameter
Fixes #5040
2020-04-07 20:01:57 +02:00
Robert Fekete 7eba37ae9b Typo correction 2020-04-07 19:47:44 +02:00
Jay Williams efc61d6f3b commands: Use semver for min_version per recommendations
See https://github.com/gohugoio/hugoThemes#themetoml
2020-04-07 19:42:45 +02:00
Bjørn Erik Pedersen d8d6a25b57 modules: Fix hugo mod vendor for regular file mounts
Fixes #7140
2020-04-07 10:13:55 +02:00
Bjørn Erik Pedersen 9f12be54ee Revert "Revert "common/herrors: Fix typos in comments""
OK, I'm getting tired. Sorry for the noise.

This reverts commit 4437e918cd.
2020-04-06 01:07:57 +02:00
Bjørn Erik Pedersen 4437e918cd Revert "common/herrors: Fix typos in comments"
This reverts commit 1123711b09.
2020-04-06 01:06:27 +02:00
Shubham Shahare 4de3ecdc26 deps: Updateto gitmap v1.1.2
Fixes #6985
2020-04-04 23:24:33 +02:00
rnazmo 1123711b09 common/herrors: Fix typos in comments 2020-04-02 22:06:22 +02:00
Bjørn Erik Pedersen 3d84ef9720 Merge commit 'c494c37a4523fbf2db6274dc87e0877fd5bec24b' 2020-03-31 22:11:54 +02:00
Bjørn Erik Pedersen c494c37a45 Squashed 'docs/' changes from 2a0ea423d..20d77860b
20d77860b Remove the calibre image action
58f53654d Improve image metadata formatting (#1067)
c569f3657 Update theme
80e6d362e Update theme
d5806cca5 Update theme
efc5cb227 Remove broken link on "where" page (#1058)
443266076 Comments Alternatives (#1036)
9b480ebb7 Fix typo
1402365ee Fix included typo in build-options.md
3b5a76de1 Update index.md
1196c7695 Update index.md
1887ea1ed Update index.md
d0666e74e Hugo 0.68.3
d514cfac9 Merge branch 'temp683'
49e57362b releaser: Add release notes to /docs for release of 0.68.3
fa0ac3bf1 Merge branch 'temp682'
46993c209 Release 0.68.2
4c8d6d242 releaser: Add release notes to /docs for release of 0.68.2
9694f4d36 Update index.md
368a03754 Update index.md
0d997010c Merge branch 'temp681'
24138a9cd releaser: Add release notes to /docs for release of 0.68.1
7dd6cc788 Update index.md
b6125b4a8 Update build-options.md
a2dead37a Release 0.68.0
7cff41348 Merge branch 'temp680'
b3b37959c releaser: Add release notes to /docs for release of 0.68.0
0f98184b0 Some minify configuration adjustments
02219f787 Add minify config
efeea7be0 Allow headless bundles to list pages via $page.Pages and $page.RegularPages
7950d0ad1 Mention `resources` folder in the "Directory structure"  docs.

git-subtree-dir: docs
git-subtree-split: 20d77860b2
2020-03-31 22:10:45 +02:00
SatowTakeshi 9c9987535f helpers: Fix TrimShortHTML
Where some tags are siblings of p tag.

Fixes #7081
2020-03-28 11:10:25 +01:00
Bjørn Erik Pedersen 4a39564efe Fix IsDescendant/IsAncestor for overlapping section names
Fixes #7096
2020-03-26 16:11:36 +01:00
Stéphane Wirtel b6e097cfe6 fix typo in getting started 2020-03-24 17:31:37 +01:00
hugoreleaser 19a8accc9f releaser: Prepare repository for 0.69.0-DEV
[ci skip]
2020-03-24 12:16:13 +00:00
hugoreleaser 157669a0e6 releaser: Add release notes to /docs for release of 0.68.3
[ci skip]
2020-03-24 12:04:27 +00:00
hugoreleaser 8f49df946a releaser: Bump versions for release of 0.68.3
[ci skip]
2020-03-24 12:04:27 +00:00
hugoreleaser 1a68ad4e31 releaser: Add release notes for 0.68.3
[ci skip]
2020-03-24 12:04:27 +00:00
Bjørn Erik Pedersen 523d51948f Fix _build.list.local logic
Fixes #7089
2020-03-24 12:47:42 +01:00
hugoreleaser 971b28904b releaser: Prepare repository for 0.69.0-DEV
[ci skip]
2020-03-24 08:33:02 +00:00
hugoreleaser 63bbb40dfb releaser: Add release notes to /docs for release of 0.68.2
[ci skip]
2020-03-24 08:21:09 +00:00
hugoreleaser 73ae6d581d releaser: Bump versions for release of 0.68.2
[ci skip]
2020-03-24 08:21:09 +00:00
hugoreleaser e18a2ad3f4 releaser: Add release notes for 0.68.2
[ci skip]
2020-03-24 08:21:09 +00:00
Bjørn Erik Pedersen cfa73050a4 Fix cache reset for a page's collections on server live reload
Fixes #7085
2020-03-23 23:14:39 +01:00
hugoreleaser 244e49c0ea releaser: Prepare repository for 0.69.0-DEV
[ci skip]
2020-03-22 10:47:54 +00:00
hugoreleaser 98dc46e1a9 releaser: Add release notes to /docs for release of 0.68.1
[ci skip]
2020-03-22 10:36:42 +00:00
hugoreleaser 87dd5725de releaser: Bump versions for release of 0.68.1
[ci skip]
2020-03-22 10:36:42 +00:00
hugoreleaser 8c6a03a92b releaser: Add release notes for 0.68.1
[ci skip]
2020-03-22 10:36:42 +00:00
Bjørn Erik Pedersen 1ce3e7d521 releaser: Include "Revert" commits in change log 2020-03-21 18:51:29 +01:00
Bjørn Erik Pedersen c9dc316ad1 Revert "resources: Add data context to the key in ExecuteAsTemplate"
This reverts commit 18cb21ff2e.

Fixes #7064
2020-03-21 18:38:19 +01:00
hugoreleaser 1664a0e893 releaser: Prepare repository for 0.69.0-DEV
[ci skip]
2020-03-21 11:59:39 +00:00
hugoreleaser 1e67854b1a releaser: Add release notes to /docs for release of 0.68.0
[ci skip]
2020-03-21 11:47:37 +00:00
hugoreleaser e1b609af9b releaser: Bump versions for release of 0.68.0
[ci skip]
2020-03-21 11:47:37 +00:00
Bjørn Erik Pedersen 8e5566af6e Release 0.68.0 2020-03-21 12:41:25 +01:00
Bjørn Erik Pedersen 1005f754e0 Update 0.68.0-relnotes.md
[ci skip]
2020-03-21 12:40:46 +01:00
hugoreleaser efde7078ed releaser: Add release notes for 0.68.0
Rename to *-ready.md to continue.
[ci skip]
2020-03-21 11:33:28 +00:00
Bjørn Erik Pedersen 2ebb9f5484 Fix Go build version 2020-03-21 12:25:03 +01:00
Bjørn Erik Pedersen 7204b354a9 Some minify configuration adjustments 2020-03-20 20:35:57 +01:00
SatowTakeshi 574c2959b8 Add minify config
Fixes #6750
Updates #6892
2020-03-20 20:35:57 +01:00
Bjørn Erik Pedersen 99958f90fe Allow headless bundles to list pages via $page.Pages and $page.RegularPages
Fixes #7075
2020-03-20 18:28:55 +01:00
Bjørn Erik Pedersen 1d91d8e14b Update to Go 1.14.1 and 1.13.9
Fixes #7078
2020-03-20 18:25:54 +01:00
Carl Johnson 95f492114e Fix GetTerms nil pointer
Fixes #7061
2020-03-20 14:35:41 +01:00
Bjørn Erik Pedersen c947351d7c Merge commit 'aa54803a84208816e9c678359bd3f86760484ce0' 2020-03-20 09:19:29 +01:00
Bjørn Erik Pedersen aa54803a84 Squashed 'docs/' changes from 988f7d5c2..2a0ea423d
2a0ea423d Wrap cascade ex in code toggle
841573e3e Correcting reference for YouTube shortcode (#1055)
8f9378f93 Release 0.67.1
178759468 Merge branch 'temp671'
1b5ae9cb1 releaser: Add release notes to /docs for release of 0.67.1
a87aa44ec Don't set GOPATH when building from source
bd35dfbd8 Update hugo-deploy.md
527cf3b2b Adding a commercial search service
709844459 Add languageDirection to language configuration
523be23eb Fix include typo on v67 Release Notes
fdd7cc66c Adjust relase notes
613ba75e8 releaser: Add release notes to /docs for release of 0.67.0
3fb1376d1 docs: Doument the server config
6408a9b4e Merge commit '14e369b961943a0b977776899e24e8bea63834df'
10457ca46 deploy: Add include and exclude support for remote

git-subtree-dir: docs
git-subtree-split: 2a0ea423d7
2020-03-20 09:18:47 +01:00
Evan Anderson cc2a5d52a4 Pass directory name to filters in LstatIfPossible in the same way as Readdir 2020-03-19 20:09:34 +01:00
Elliott Sales de Andrade 52c159c452 Update to goldmark 1.1.25.
This fixes a bug, so there's a small change to tests.
2020-03-19 12:26:19 +01:00
Bjørn Erik Pedersen c7b6d74e89 resources: Fix scss vs css import regexp
Fixes #7063
2020-03-17 08:03:25 +01:00
Bjørn Erik Pedersen 1a8af7d4f0 Add workaround for regular CSS imports in SCSS
Fixes #7059
2020-03-16 23:21:44 +01:00
Bjørn Erik Pedersen 03b93bb988 Add .RegularPagesRecursive
Fixes #6411
2020-03-16 17:37:36 +01:00
hugoreleaser 94fb4dc3dd releaser: Prepare repository for 0.68.0-DEV
[ci skip]
2020-03-15 19:41:55 +00:00
hugoreleaser 4f44227bd8 releaser: Add release notes to /docs for release of 0.67.1
[ci skip]
2020-03-15 19:30:34 +00:00
hugoreleaser 99d36237c0 releaser: Bump versions for release of 0.67.1
[ci skip]
2020-03-15 19:30:33 +00:00
hugoreleaser e371162c3f releaser: Add release notes for 0.67.1
[ci skip]
2020-03-15 19:30:33 +00:00
Bjørn Erik Pedersen 5eadc4c0a8 metrics: Fix --templateMetricsHints
Also improve non-string comparisons.

Fixes #7048
2020-03-12 19:26:19 +01:00
Bjørn Erik Pedersen 18cb21ff2e resources: Add data context to the key in ExecuteAsTemplate
Fixes #7046
2020-03-11 22:21:16 +01:00
Bjørn Erik Pedersen df298558a5 Improve Tailwind/PostCSS error messages
Fixes #7041
Fixes #7042
2020-03-11 14:13:03 +01:00
Bjørn Erik Pedersen b1106f8715 deps: Update Blackfriday
Fixes #7039
2020-03-10 13:06:23 +01:00
Bjørn Erik Pedersen c0177fe2b2 resources: Try to fix a Go 1.15 go vet error 2020-03-10 12:29:09 +01:00
Tan Yuanhong 5914f91b6c Add languageDirection to language configuration
Fixes #6550
2020-03-10 10:10:58 +01:00
hugoreleaser 5b4659fa0b releaser: Prepare repository for 0.68.0-DEV
[ci skip]
2020-03-09 20:47:30 +00:00
hugoreleaser 7f1da3efcd releaser: Add release notes to /docs for release of 0.67.0
[ci skip]
2020-03-09 20:35:43 +00:00
hugoreleaser f7d4b01c6d releaser: Bump versions for release of 0.67.0
[ci skip]
2020-03-09 20:35:43 +00:00
Bjørn Erik Pedersen b809b9680d Update 0.67.0-relnotes.md 2020-03-09 21:26:43 +01:00
hugoreleaser a9c91361c2 releaser: Add release notes for 0.67.0
Rename to *-ready.md to continue.
[ci skip]
2020-03-09 20:11:33 +00:00
Bjørn Erik Pedersen 63393230c9 docs: Doument the server config 2020-03-09 20:36:00 +01:00
Bjørn Erik Pedersen 6b61f2a5bb Merge commit '14e369b961943a0b977776899e24e8bea63834df' 2020-03-09 20:21:17 +01:00
Bjørn Erik Pedersen 14e369b961 Squashed 'docs/' changes from 341ecabb2..988f7d5c2
988f7d5c2 Document default `enableInlineShortcodes` value
0f604a345 Fix typo in 0.66.0 release note
26fc74fe3 How to access individual EXIF data tags
d5d3bad9a Fix localhost links
fa6921213 Update index.md
5bf558f78 Release 0.66.0
74ccdaaf5 Merge branch 'temp660'
75faa478b releaser: Add release notes to /docs for release of 0.66.0
c4a4a9922 docs: Regen CLI docs
0624ac198 Add build.UseResourceCacheWhen
58a8d7cd1 Add build options documentation
d926c595e fix typo
99713d44b resources: Add basic @import support to resources.PostCSS
224b96cf7 deploy: Implement include/exclude filters for deploy
eb1a00050 Adjusting description; WordPress with capitalized P
91d8efa22 Add another tool for migration from the Wordpress
a6938a4ac Adjust showcase description
a9c0a0a69 Adjust showcase
e5af08aa6 Adding Aether as a proposed showcase item.
0013daa34 Add hugo.IsProduction function
34c419ef3 tpl: Add math.Sqrt
5bdab0ebd Update minification.md
9039332e2 Hugo 0.65.3
1400caf3a Merge branch 'temp653'
9796bb337 releaser: Add release notes to /docs for release of 0.65.3
65b26598f Fix typo
23aa57d80 Fix crashes for 404 in IsAncestor etc.
42c54bc6c 0.65.2
67fd5c1f6 Merge branch 'temp652'
d820ac017 releaser: Add release notes to /docs for release of 0.65.2
51f0888ff Release 0.65.1
91e95260c releaser: Add release notes to /docs for release of 0.65.1
1880ebf05 fix broken link on internal.md
ffaa33889 Update migrations.md
de4d64675 Another tool for migration from Medium platform
90b178d77 releaser: Add release notes to /docs for release of 0.65.1
6925cda30 Handle corner case with rendering text as code in URL
3cb4b19dd Release 0.65.0
7a600cb99 Merge branch 'temp650'
ef9531ff6 releaser: Add release notes to /docs for release of 0.65.0
9bc19606f docs: Regenerate CLI docs
d4a886ed2 Add Page.GetTerms
a3bf273a5 fix broken link on use-modules.md
001f52f4e Fix mage URL in development.md
eef72e887 Merge commit '4b670bc8cc38103c2c60e5090c2f56bf30832b8d'
b18a76631 commands: Support "hugo mod get -u ./..."

git-subtree-dir: docs
git-subtree-split: 988f7d5c2d
2020-03-09 20:19:32 +01:00
Bjørn Erik Pedersen 6cceef65c2 Fix ambigous error on site.GetPage
Fixes #7016
2020-03-09 16:11:50 +01:00
Bjørn Erik Pedersen ffcb4aeb8e Fix handling of HTML files without front matter
This means that any HTML file inside /content will be treated as a regular file.

If you want it processes with shortcodes and a layout, add front matter.

The defintion of an HTML file here is:

* File with extension .htm or .html
* With first non-whitespace character "<" that isn't a HTML comment.

This is in line with the documentation.

Fixes #7030
Fixes #7028
See #6789
2020-03-09 15:01:55 +01:00
satotake 8279d2e227 Support unComparable args of uniq/complement/in
Fixes #6105
2020-03-09 13:32:38 +01:00
Sam Smith c4fa2f0799 tpl: Fix error with unicode in file paths
Add url.QueryUnescape before reading file which allows files with
unicode in their paths to be read.

Fixes #6996
2020-03-09 13:31:04 +01:00
Bjørn Erik Pedersen 108314444b Add HTTP header support for the dev server
Fixes #7031
2020-03-08 19:57:30 +01:00
David Jones 51e178a6a2 deploy: Add include and exclude support for remote 2020-03-08 17:35:32 +01:00
hugoreleaser cb12f41a96 releaser: Prepare repository for 0.67.0-DEV
[ci skip]
2020-03-03 15:31:19 +00:00
hugoreleaser 78c3c78fca releaser: Add release notes to /docs for release of 0.66.0
[ci skip]
2020-03-03 15:19:36 +00:00
hugoreleaser 713132cd4b releaser: Bump versions for release of 0.66.0
[ci skip]
2020-03-03 15:19:36 +00:00
Bjørn Erik Pedersen bbaefd7e3e Update 0.66.0-relnotes.md 2020-03-03 16:10:42 +01:00
hugoreleaser cc1a718860 releaser: Add release notes for 0.66.0
Rename to *-ready.md to continue.
[ci skip]
2020-03-03 14:55:26 +00:00
Bjørn Erik Pedersen 6a34f88dcc Skip some tests on CircleCI 2020-03-03 15:45:13 +01:00
Carl Johnson ae383f04c8 {{ in }} should work with html.Template type
Fixes #7002
2020-03-03 13:37:42 +01:00
Bjørn Erik Pedersen ee31e61fb0 docs: Regen CLI docs 2020-03-03 13:36:35 +01:00
Bjørn Erik Pedersen 760a87a45a commands: Add --all flag to hugo mod clean 2020-03-03 13:29:58 +01:00
Bjørn Erik Pedersen 3d3fa5c3fe Add build.UseResourceCacheWhen
Fixes #6993
2020-03-03 13:29:58 +01:00
Anthony Fok ee3d02134d Update dependency list in README.md
to include only runtime dependencies,
i.e. what is in the released binary.
2020-03-02 22:51:20 -07:00
Bjørn Erik Pedersen 8947c3fa0b Fix ref/relref short lookup for pages in sub-folder
Fixes #6952
2020-03-02 21:08:28 +01:00
Sam Smith d7798906d8 tpl: Change error message on missing resource
Fixes #6942
2020-03-02 18:46:14 +01:00
Bjørn Erik Pedersen 305ce1c9ec resources: Add full filename to image when processing fails
Fixes #7000
2020-03-02 12:39:26 +01:00
Bjørn Erik Pedersen 3e9db2ad95 hugolib: Fix error handling in page collector
Fixes #6988
2020-03-02 11:07:09 +01:00
Anthony Fok 449deb7f9c Update dependency list in README 2020-03-02 01:10:42 -07:00
Bjørn Erik Pedersen 1746e8a9b2 Fix ref/relRef regression for relative refs from bundles
Fixes #6952
2020-02-29 18:32:06 +01:00
Bjørn Erik Pedersen 6f48146e75 identity: Fix potential infinite recursion in server change detection
Fixes #6986
2020-02-29 15:12:56 +01:00
Bjørn Erik Pedersen b0d850321e Fix rebuild logic when editing template using a base template
We have been doing too much work in that case.

Fixes #6968
2020-02-28 14:14:55 +01:00
Bjørn Erik Pedersen b66d38c419 resources: Add basic @import support to resources.PostCSS
This commit also makes the HUGO_ENVIRONMENT environment variable available to Node.

Fixes #6957
Fixes #6961
2020-02-27 11:47:24 +01:00
Robert van Gent 05a74eaec0 deploy: Implement include/exclude filters for deploy
Fixes #6922
2020-02-27 07:26:05 +01:00
Bjørn Erik Pedersen 33ae621083 Update to Go 1.14 and 1.13.8
Fixes #6958
2020-02-26 17:33:11 +01:00
Joshua Wong 1352bc880d Add hugo.IsProduction function
Fixes #6873
2020-02-25 17:58:07 +01:00
Chris Dennis d184e5059c tpl: Add math.Sqrt
Fixes #6941
2020-02-24 23:45:04 +01:00
hugoreleaser 322c285ba2 releaser: Prepare repository for 0.66.0-DEV
[ci skip]
2020-02-23 10:09:29 +00:00
hugoreleaser 211ba42a95 releaser: Add release notes to /docs for release of 0.65.3
[ci skip]
2020-02-23 09:58:31 +00:00
hugoreleaser 0ac528d746 releaser: Bump versions for release of 0.65.3
[ci skip]
2020-02-23 09:58:31 +00:00
hugoreleaser d8bde266c1 releaser: Add release notes for 0.65.3
[ci skip]
2020-02-23 09:58:31 +00:00
Bjørn Erik Pedersen 0bd6356c6d Fix panic when home page is drafted
Fixes #6927
2020-02-23 00:11:10 +01:00
satotake ca68abf0bc Fix goldmark toc rendering
Previously gordmark-based TOC renderes only `KindText` and `KindString`

This commit expands target node with Goldmark's renderer

I am not sure of what are expected results as TOC contents in some (rare) cases
but Blackfriday's behaviours are fundamentally respected.

For example,
- image `[image text](link)` is rendered as `<img>` tag
- GFM AutoLink `gohugo.io` is rendered as text

* Render AutoLink as <a> tag as Blackfriday does

Fixes #6736
Fixes #6809
2020-02-22 18:06:30 +01:00
Bjørn Erik Pedersen a524124beb Fix crashes for 404 in IsAncestor etc.
Fixes #6931
2020-02-22 13:36:04 +01:00
hugoreleaser c1eb625124 releaser: Add release notes to /docs for release of 0.65.2
[ci skip]
2020-02-21 10:10:11 +00:00
hugoreleaser 1510f07780 releaser: Bump versions for release of 0.65.2
[ci skip]
2020-02-21 10:10:11 +00:00
hugoreleaser aa2ef45421 releaser: Add release notes for 0.65.2
[ci skip]
2020-02-21 10:10:11 +00:00
Bjørn Erik Pedersen 76b2afe642 Apply missing go fmt 2020-02-21 10:12:33 +01:00
Bjørn Erik Pedersen f460530347 Fix panic on no output formats
A page needs its output formats even if it should not be rendered or its resources should not be published.

Fixes #6924
2020-02-21 09:41:39 +01:00
Bjørn Erik Pedersen 4c2a0de412 Fix panic in 404.Parent
Fixes #6924
2020-02-21 08:14:08 +01:00
hugoreleaser 6be6684cc5 releaser: Add release notes to /docs for release of 0.65.1
[ci skip]
2020-02-20 13:42:26 +00:00
hugoreleaser dbaa15d40f releaser: Bump versions for release of 0.65.1
[ci skip]
2020-02-20 13:42:26 +00:00
hugoreleaser a449e87da7 releaser: Add release notes for 0.65.1
[ci skip]
2020-02-20 13:42:26 +00:00
Bjørn Erik Pedersen 7ef5a4c83e hugolib: Fix 2 Paginator.Pages taxonomy regressions
Fixes #6921
Fixes #6918
2020-02-20 14:13:04 +01:00
Bjørn Erik Pedersen a70bbd0696 hugolib: Fix deletion of orphaned sections
Avoid deleting inside the recursive walk.

Fixes #6920
2020-02-20 13:40:16 +01:00
hugoreleaser 24afe2b822 releaser: Add release notes to /docs for release of 0.65.0
[ci skip]
2020-02-20 08:11:06 +00:00
hugoreleaser 9fd7d3957e releaser: Bump versions for release of 0.65.0
[ci skip]
2020-02-20 08:11:06 +00:00
hugoreleaser c45025cb90 releaser: Add release notes for 0.65.0 2020-02-20 09:01:06 +01:00
Bjørn Erik Pedersen a5ebdf7d17 docs: Regenerate CLI docs 2020-02-19 22:28:06 +01:00
Bjørn Erik Pedersen 9bdedb251c Fix lazy publishing with publishResources=false
Fixes #6914
2020-02-19 18:22:41 +01:00
Bjørn Erik Pedersen dce210ab56 modules: Improve "hugo mod clean"
* Only clean project modules
* Optional glob pattern of module paths to clean

Closes #6907
2020-02-19 17:14:35 +01:00
Bjørn Erik Pedersen 0b96aba022 commands: Add "hugo mod verify"
See #6907
2020-02-19 17:14:35 +01:00
Bjørn Erik Pedersen fa520a2d98 Add Page.GetTerms
Fixes #6905
2020-02-19 14:52:23 +01:00
Bjørn Erik Pedersen 4b670bc8cc Squashed 'docs/' changes from 16753a78d..341ecabb2
341ecabb2 Update lookup-order.md
bfabd8ce8 Update homepage.md
7a1e0b742 Update shortcodes.md
e8bf22497 HTTPS links to Vimeo embeds
a9d0e7c68 Revise the wildly inaccurate types doc
af33bb724 netlify: Bump version
f4251583e Merge branch 'temp641'
4dcda861d releaser: Add release notes to /docs for release of 0.64.1
92bd0b1f5 Update errorf.md

git-subtree-dir: docs
git-subtree-split: 341ecabb29
2020-02-19 09:16:56 +01:00
Bjørn Erik Pedersen 82029c1ec9 Merge commit '4b670bc8cc38103c2c60e5090c2f56bf30832b8d' 2020-02-19 09:16:56 +01:00
Bjørn Erik Pedersen 7489a86459 Add a list terms benchmark
See #6905
2020-02-19 09:08:32 +01:00
Bjørn Erik Pedersen da54787cfa Handle disabled RSS even if it's defined in outputs
See https://github.com/gohugoio/hugo/issues/6897#issuecomment-587947078
2020-02-19 09:08:31 +01:00
Elliott Sales de Andrade c7975b48b6 Fix goMinorVersion on non-final Go releases
This should work for alpha/beta/rc releases.
2020-02-19 08:46:21 +01:00
Bjørn Erik Pedersen b2dcd53e3c Use the tree for taxonomy.Pages() 2020-02-18 19:47:45 +01:00
Bjørn Erik Pedersen 36983e6189 Add some cagegories to the site collections benchmarks 2020-02-18 18:52:35 +01:00
Bjørn Erik Pedersen d73e37387c tpl: Adjust the RSS taxonomy logic
See #6909
2020-02-18 17:29:46 +01:00
Bjørn Erik Pedersen aa3e183056 tpl: Fix RSS template for the terms listing
Fixes #6909
2020-02-18 16:55:30 +01:00
Bjørn Erik Pedersen 1b7acfe763 Fix taxonomy
Recently introduced in master.

See https://github.com/gohugoio/hugo/issues/6897#issuecomment-587499907
2020-02-18 16:43:36 +01:00
Bjørn Erik Pedersen 19e12caf8c Fix RenderString for pages without content
Fixes #6882
2020-02-18 14:08:59 +01:00
Bjørn Erik Pedersen 20f2211fce modules: Do not try to get local themes in "hugo mod get"
Fixes #6893
2020-02-18 14:08:58 +01:00
satotake a21a9373e0 deps: Update goldmark-highlighting
See  #6901
2020-02-18 14:08:46 +01:00
Bjørn Erik Pedersen 775c7c2474 commands: Support "hugo mod get -u ./..."
Fixes #6828
2020-02-18 12:17:16 +01:00
Bjørn Erik Pedersen eada236f87 Introduce a tree map for all content
This commit introduces a new data structure to store pages and their resources.

This data structure is backed by radix trees.

This simplies tree operations, makes all pages a bundle,  and paves the way for #6310.

It also solves a set of annoying issues (see list below).

Not a motivation behind this, but this commit also makes Hugo in general a little bit faster and more memory effective (see benchmarks). Especially for partial rebuilds on content edits, but also when taxonomies is in use.

```
name                                   old time/op    new time/op    delta
SiteNew/Bundle_with_image/Edit-16        1.32ms ± 8%    1.00ms ± 9%  -24.42%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file/Edit-16    1.28ms ± 0%    0.94ms ± 0%  -26.26%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories/Edit-16      33.9ms ± 2%    21.8ms ± 1%  -35.67%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs/Edit-16            40.6ms ± 1%    37.7ms ± 3%   -7.20%  (p=0.029 n=4+4)
SiteNew/Deep_content_tree/Edit-16        56.7ms ± 0%    51.7ms ± 1%   -8.82%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates/Edit-16      19.9ms ± 2%    18.3ms ± 3%   -7.64%  (p=0.029 n=4+4)
SiteNew/Page_collections/Edit-16         37.9ms ± 4%    34.0ms ± 2%  -10.28%  (p=0.029 n=4+4)
SiteNew/Bundle_with_image-16             10.7ms ± 0%    10.6ms ± 0%   -1.15%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file-16         10.8ms ± 0%    10.7ms ± 0%   -1.05%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories-16           43.2ms ± 1%    39.6ms ± 1%   -8.35%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs-16                 47.6ms ± 1%    47.3ms ± 0%     ~     (p=0.057 n=4+4)
SiteNew/Deep_content_tree-16             73.0ms ± 1%    74.2ms ± 1%     ~     (p=0.114 n=4+4)
SiteNew/Many_HTML_templates-16           37.9ms ± 0%    38.1ms ± 1%     ~     (p=0.114 n=4+4)
SiteNew/Page_collections-16              53.6ms ± 1%    54.7ms ± 1%   +2.09%  (p=0.029 n=4+4)

name                                   old alloc/op   new alloc/op   delta
SiteNew/Bundle_with_image/Edit-16         486kB ± 0%     430kB ± 0%  -11.47%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file/Edit-16     265kB ± 0%     209kB ± 0%  -21.06%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories/Edit-16      13.6MB ± 0%     8.8MB ± 0%  -34.93%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs/Edit-16            66.5MB ± 0%    63.9MB ± 0%   -3.95%  (p=0.029 n=4+4)
SiteNew/Deep_content_tree/Edit-16        28.8MB ± 0%    25.8MB ± 0%  -10.55%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates/Edit-16      6.16MB ± 0%    5.56MB ± 0%   -9.86%  (p=0.029 n=4+4)
SiteNew/Page_collections/Edit-16         16.9MB ± 0%    16.0MB ± 0%   -5.19%  (p=0.029 n=4+4)
SiteNew/Bundle_with_image-16             2.28MB ± 0%    2.29MB ± 0%   +0.35%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file-16         2.07MB ± 0%    2.07MB ± 0%     ~     (p=0.114 n=4+4)
SiteNew/Tags_and_categories-16           14.3MB ± 0%    13.2MB ± 0%   -7.30%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs-16                 69.1MB ± 0%    69.0MB ± 0%     ~     (p=0.343 n=4+4)
SiteNew/Deep_content_tree-16             31.3MB ± 0%    31.8MB ± 0%   +1.49%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates-16           10.8MB ± 0%    10.9MB ± 0%   +1.11%  (p=0.029 n=4+4)
SiteNew/Page_collections-16              21.4MB ± 0%    21.6MB ± 0%   +1.15%  (p=0.029 n=4+4)

name                                   old allocs/op  new allocs/op  delta
SiteNew/Bundle_with_image/Edit-16         4.74k ± 0%     3.86k ± 0%  -18.57%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file/Edit-16     4.73k ± 0%     3.85k ± 0%  -18.58%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories/Edit-16        301k ± 0%      198k ± 0%  -34.14%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs/Edit-16              389k ± 0%      373k ± 0%   -4.07%  (p=0.029 n=4+4)
SiteNew/Deep_content_tree/Edit-16          338k ± 0%      262k ± 0%  -22.63%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates/Edit-16        102k ± 0%       88k ± 0%  -13.81%  (p=0.029 n=4+4)
SiteNew/Page_collections/Edit-16           176k ± 0%      152k ± 0%  -13.32%  (p=0.029 n=4+4)
SiteNew/Bundle_with_image-16              26.8k ± 0%     26.8k ± 0%   +0.05%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file-16          26.8k ± 0%     26.8k ± 0%   +0.05%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories-16             273k ± 0%      245k ± 0%  -10.36%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs-16                   396k ± 0%      398k ± 0%   +0.39%  (p=0.029 n=4+4)
SiteNew/Deep_content_tree-16               317k ± 0%      325k ± 0%   +2.53%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates-16             146k ± 0%      147k ± 0%   +0.98%  (p=0.029 n=4+4)
SiteNew/Page_collections-16                210k ± 0%      215k ± 0%   +2.44%  (p=0.029 n=4+4)
```

Fixes #6312
Fixes #6087
Fixes #6738
Fixes #6412
Fixes #6743
Fixes #6875
Fixes #6034
Fixes #6902
Fixes #6173
Fixes #6590
2020-02-18 09:49:42 +01:00
Bjørn Erik Pedersen e5329f13c0 Another benchmark rename 2020-02-18 09:48:36 +01:00
Bjørn Erik Pedersen 5b145ddc4c Rename the Edit benchmarks
To make them easier to filter out.
2020-02-18 09:45:21 +01:00
satotake 3c568ad013 markup/highlight: Fix chroma highlight
* Use chroma.Coalesce
* Escape code strings if lexer is nil

Fixes #6877
Fixes #6856
2020-02-17 14:59:26 +01:00
Bjørn Erik Pedersen 54bdcaacae Refactor a benchmark to make it runnable as test 2020-02-17 09:24:15 +01:00
Bjørn Erik Pedersen 1622510a5c Add benchmark for content edits 2020-02-17 09:05:37 +01:00
Bjørn Erik Pedersen 56d0b65887 Add "go mod verify" to build scripts 2020-02-16 00:15:58 +01:00
Jaymo Kang 75c3787fc2 Add git to Dockerfile
Needed for GitInfo.
2020-02-14 16:49:20 +01:00
Bjørn Erik Pedersen 9babb1f0c4 deps: Update go.sum 2020-02-14 10:18:56 +01:00
Mark Rosemaker 8a5124d6b3 commands: Rename doWithCommandeer to cfgInit/cfgSetAndInit
This will make it clearer what it does and make the code more consistent.
2020-02-13 00:37:49 +01:00
Bjørn Erik Pedersen 898a0a96af deps: Update golibsass
Fixes #6885
2020-02-12 18:56:47 +01:00
Bjørn Erik Pedersen 3b721110d5 Shuffle test files before insertion 2020-02-10 12:03:41 +01:00
Bjørn Erik Pedersen 40ba7e6d63 Update to LibSass v3.6.3
Fixes #6862
2020-02-10 10:42:05 +01:00
hugoreleaser 4f43c9022a releaser: Prepare repository for 0.65.0-DEV
[ci skip]
2020-02-09 20:53:18 +00:00
hugoreleaser c327e75d05 releaser: Add release notes to /docs for release of 0.64.1
[ci skip]
2020-02-09 20:44:34 +00:00
hugoreleaser 8bd8d4fe9a releaser: Bump versions for release of 0.64.1
[ci skip]
2020-02-09 20:44:34 +00:00
hugoreleaser ad7c38cd66 releaser: Add release notes for 0.64.1
[ci skip]
2020-02-09 20:44:34 +00:00
Bjørn Erik Pedersen b78576fd38 hugofs: Fix mount with hole regression
Fixes #6854
2020-02-09 21:35:39 +01:00
Bjørn Erik Pedersen 18888e09bb Fix bundle resource ordering regression
Introduced in Hugo 0.64.0

Fixes #6851
2020-02-09 21:35:39 +01:00
Bjørn Erik Pedersen 1e5eb8679e Merge commit '3c0036805d64fdd8290f1c4a31371780ff3ea365' 2020-02-06 13:03:30 +01:00
Bjørn Erik Pedersen 3c0036805d Squashed 'docs/' changes from bd0e15bb6..16753a78d
16753a78d remove kaiju from comments.md
25906f6ad Hugo 0.64.0
aacc7a130 releaser: Add release notes to /docs for release of 0.64.0
2243afe90 Explain Ace/Amber support has been removed
293c9496a Document the hugo function
479890f9b Update comments.md
ceab41097 Update theme
9a95876c7 Remove note
696543e13 Update usage.md
a04bab2b9 Release 0.63.2
ccaed74b5 Merge branch 'temp632'
623b363c5 releaser: Add release notes to /docs for release of 0.63.2
39ce6f50e releaser: Add release notes to /docs for release of 0.63.2
9175ac2ca Another theme fix
88c264251 Rebuild _vendor
e739dc3a8 Release 0.63.1
129ecac84 Merge branch 'temp631'
bcd7c1154 releaser: Add release notes to /docs for release of 0.63.1
e4f0d9285 releaser: Add release notes to /docs for release of 0.63.1
6a40124d6 Update theme
c486747de Params cleanup
c408c4334 netlify: Bump to 0.63.0
7e8a48be8 Adjust base template docs
a5920e9aa Adjust release notes
d4d25c524 Merge branch 'temp63'
16d981721 releaser: Add release notes to /docs for release of 0.63.0
08ab681d1 releaser: Add release notes to /docs for release of 0.63.0
90feaac39 docs, output: Add base template lookup variant to docs.json
afe2b4399 docs, output: Add base template lookup variant to docs.json
1f7466a76 docs: Regen docs helper
7ceefb94a docs: Regen docs helper
ee14087cd Remove typo from RenderString.md
6daf333d3 Remove the calibreapp action
682f710d7 docs: Updating 'submodule add' command in "Host on GitHub" to use https instead of ssh.
ef57b2dae Improve documentation on slug behavior
835ddd9c2 Fix broken link
137a32f90 Fixed typo in content-management/page-resources
936633e25 Fixed spelling error, "wich" -> "which"
a559d41e3 Using a Different Version of Hugo in AWS Amplify
2ee83402d Update rss.md
f900a2ce0 Add render-image code example and edit wording
bd0a0207c Change wording on Page Resources documentation
d213b4599 linuxbrew was renamed to homebrew (#1004)
dcb0925f8 Update index.md
789416a08 Release 0.62.2
2dc66f13c releaser: Add release notes to /docs for release of 0.62.2
813fbc865 releaser: Add release notes to /docs for release of 0.62.2
ed5b07df3 docs: Document the new autoHeadingIDType setting
02d4747e5 docs: Document the new autoHeadingIDType setting
406a8a9a6 docs: Regenerate docshelper
065319786 docs: Regenerate docshelper
61d540021 Merge commit '26f1458a2df6b55eee3a5de46f5fec23a43a7c7d'
7cac5909b releaser: Add release notes to /docs for release of 0.62.1
6e30e01a2 releaser: Add release notes to /docs for release of 0.62.0
2694dcdd8 Merge commit '8a4005cf2b0ef34265ff8051a6b76226685fc226'
115dd6782 docs: More on hooks
f4460fd54 tpl: Do not return any value in errorf
3587d2998 tpl: Add a warnf template func
7c9b02e30 docs: Regen docshelper
a7bfdeb24 Fix incorrect MIME type from image/jpg to image/jpeg
1a6089cfe Preserve HTML Text for link render hooks
4544a998c docs: Footnote
c42733258 Add render template hooks for links and images
0d8bec78a Merge commit '2e711a28c71e8667258e5ab824f9b9a71c261b0a'
3974c326c markup/tableofcontents: Add config option for ordered list
8c2bd1a62 releaser: Add release notes to /docs for release of 0.61.0
f00b2d507 releaser: Add release notes to /docs for release of 0.60.1
9a5109838 releaser: Add release notes to /docs for release of 0.60.0
d2c222f71 Add Goldmark as the new default markdown handler
df96f9efa Update homepage.md
f17e67b4b tpl/collections: Allow dict to create nested structures
5f923768a Merge commit 'efc0b1bb6c6564f54d596467dbc6a18cb206954e'
8a861bf16 Support Go time format strings in permalinks
bbb8c4fea releaser: Add release notes to /docs for release of 0.59.1
9d9070dda releaser: Add release notes to /docs for release of 0.59.0
98716176b Merge commit '5ac0f751aa47e52625662215f66efa99a6abfc2e'
2057ba4c5 Merge commit '5070ba6c9e6c492deade3c30cfe769b9dbf7151d'
c98bcff07 Merge commit 'b9bd35d72e14932fb6588ff62b90cddef0a060fc' as 'docs'

git-subtree-dir: docs
git-subtree-split: 16753a78d8
2020-02-06 13:02:49 +01:00
Cameron Moore 7f0ebd4a3c CONTRIBUTING: Fix note about CGO 2020-02-06 09:09:08 +01:00
Bjørn Erik Pedersen 23ea43180b Update Go version requirement
We run tests on current + (current -1) (we also test on the latest Go source), which means that the current supported Go versions are Go 1.12 and 1.13.

Closes #6853
2020-02-04 23:48:31 +01:00
hugoreleaser 6a74cbe916 releaser: Prepare repository for 0.65.0-DEV
[ci skip]
2020-02-04 09:16:38 +00:00
hugoreleaser 241db8f78a releaser: Add release notes to /docs for release of 0.64.0
[ci skip]
2020-02-04 09:07:21 +00:00
hugoreleaser 7624ab0281 releaser: Bump versions for release of 0.64.0
[ci skip]
2020-02-04 09:07:21 +00:00
Bjørn Erik Pedersen 8490a0aa9d Update 0.64.0-relnotes.md 2020-02-04 09:59:09 +01:00
hugoreleaser bd731d27be releaser: Add release notes for 0.64.0
Rename to *-ready.md to continue.
[ci skip]
2020-02-04 08:45:30 +00:00
Bjørn Erik Pedersen 80dd6ddde2 Fix module mount in sub folder
This addresses a specific issue, but is a also a major simplification of the filesystem file mounts.

Fixes #6730
2020-02-04 00:17:10 +01:00
Bjørn Erik Pedersen 2997310124 Mention a "no CGO rule"
See #6842
2020-02-01 10:27:26 +01:00
Bjørn Erik Pedersen 2bbc865f7b commands: Fix config environment handling
Fixes #6503
Fixes #6824
2020-01-31 16:36:36 +01:00
Bjørn Erik Pedersen 0792cfa9fa Update to Go 1.13.7 and Go 1.12.16
Fixes #6830
2020-01-31 14:18:48 +01:00
Bjørn Erik Pedersen b3f0674b80 transform/livereloadinject: Add defer to livereload script tag
In #6821 we moved the loading from end of body to head to make Turbolinks and similar work.

This commit adds a defer attribute to avoid page parse blocking.
2020-01-31 08:15:22 +01:00
Bjørn Erik Pedersen ef78a0d18a transform/livereloadinject: Don't use document.write to inject livereload
I suspect the person who originally implemented it saw examples using location.host etc. to build the URL.

We have all that information ready at build (static) time.

Fixes #6507
2020-01-31 08:02:53 +01:00
Bjørn Erik Pedersen 5859586453 hubolig: Add a render hook whitespace test
See #6832
2020-01-31 07:51:05 +01:00
Bjørn Erik Pedersen 2d159e9cc7 Do not render alias paginator pages for non-HTML outputs
Update #6797
2020-01-30 23:45:19 +01:00
Bjørn Erik Pedersen f45cb31728 Fix base template handling with preceding comments
Fixes #6816
2020-01-30 23:44:42 +01:00
Bjørn Erik Pedersen 49ef647203 modules: Fix "hugo mod get -u" with no arguments
Fixes #6826
Closes #6825
2020-01-30 17:15:35 +01:00
Bjørn Erik Pedersen 8f08cdd0ac transform/livereloadinject: Inject livereload script right after head if possible
We used to insert the livereload script right before the closing body.

This dord  not work when combined with tools such as Turbolinks.

This commit changes it So we try to inject the script as early as possible.

Fixes #6821
2020-01-29 21:12:07 +01:00
Bhavin Gandhi 281abb18ee deps: Update goldmark to v1.1.22
v1.1.22 has a fix for issue where links with newline in the title
don't get parsed correctly. Reference:
https://github.com/yuin/goldmark/issues/94

Signed-off-by: Bhavin Gandhi <bhavin7392@gmail.com>
2020-01-29 19:48:33 +01:00
hugoreleaser d8e685154d releaser: Prepare repository for 0.64.0-DEV
[ci skip]
2020-01-27 12:22:47 +00:00
hugoreleaser 934ee21fac releaser: Add release notes to /docs for release of 0.63.2
[ci skip]
2020-01-27 12:13:04 +00:00
hugoreleaser c7427a50ed releaser: Bump versions for release of 0.63.2
[ci skip]
2020-01-27 12:13:04 +00:00
hugoreleaser 49e2931eb2 releaser: Add release notes for 0.63.2
[ci skip]
2020-01-27 12:13:04 +00:00
Bjørn Erik Pedersen e8831a056b hubolib: Revert to .Type = "page" when empty
This was changed with good intentions in 0.63.0.

This behaviour was not documented, but it was of course in use.

This commit rolls back to how it behaved before:

For `Page.Type` you will get:

* `type` from front matter if set.
* `.Section`
* If none of the above returns anything, return "page"

Fixes #6805
2020-01-27 12:33:33 +01:00
Bjørn Erik Pedersen 74b6c4e5ff And now finally fix the 404 templates
Fixes #6795
2020-01-27 12:30:31 +01:00
Bjørn Erik Pedersen 8df5d76e70 Fix 404 with base template regression
Fixes #6795
2020-01-26 13:14:08 +01:00
hugoreleaser 8ae2c9c3d6 releaser: Prepare repository for 0.64.0-DEV
[ci skip]
2020-01-23 20:17:44 +00:00
hugoreleaser ce9aceb749 releaser: Add release notes to /docs for release of 0.63.1
[ci skip]
2020-01-23 20:08:10 +00:00
hugoreleaser fd32849bfe releaser: Bump versions for release of 0.63.1
[ci skip]
2020-01-23 20:08:10 +00:00
hugoreleaser 417f9ddf55 releaser: Add release notes for 0.63.1
[ci skip]
2020-01-23 20:08:10 +00:00
Bjørn Erik Pedersen 0df7bd62df deps: Make the build flags shared between sites
Updates #6789
2020-01-23 20:11:53 +01:00
Bjørn Erik Pedersen f441f67512 Fix baseof with regular define regression
Fixes #6790
2020-01-23 19:54:06 +01:00
Bjørn Erik Pedersen 7ed22e9fb6 Revert to minify v2.6.1
Closes #6791
2020-01-23 17:03:23 +01:00
hugoreleaser fb974ae87f releaser: Prepare repository for 0.64.0-DEV
[ci skip]
2020-01-23 12:48:39 +00:00
hugoreleaser 745ddcbbab releaser: Add release notes to /docs for release of 0.63.0
[ci skip]
2020-01-23 12:39:31 +00:00
hugoreleaser 3b3f5a2596 releaser: Bump versions for release of 0.63.0
[ci skip]
2020-01-23 12:39:31 +00:00
Bjørn Erik Pedersen d10ed683c5 Release 0.63.0 2020-01-23 13:30:04 +01:00
hugoreleaser 19e387d181 releaser: Add release notes for 0.63.0
Rename to *-ready.md to continue.
[ci skip]
2020-01-23 11:12:11 +00:00
Bjørn Erik Pedersen cafb1d53c0 docs, output: Add base template lookup variant to docs.json 2020-01-23 11:59:52 +01:00
Bjørn Erik Pedersen 4f466db666 docs: Regen docs helper 2020-01-23 11:55:08 +01:00
Bjørn Erik Pedersen 17af79a03e Fix 0.62.1 server rebuild slowdown regression
Fixes #6784
2020-01-23 11:50:02 +01:00
Bjørn Erik Pedersen 2fefc01606 tpl/compare: Fix eq when > 2 args
Fixes #6786
2020-01-23 10:48:28 +01:00
Tan Yuanhong 0c251be66b Allow multiple arguments in ne/ge/gt/le/lt functions
Treat op arg1 arg2 arg3 ... as (arg1 op arg2) && (arg1 op arg3)
and so on for ne/ge/gt/le/lt.

Closes #6619
2020-01-23 10:36:35 +01:00
Bjørn Erik Pedersen 836c24261f hugolib: Disable a test assertion on ARM
See #6655
2020-01-22 11:44:29 +01:00
Bjørn Erik Pedersen c6d650c8c8 tpl/tplimpl: Rework template management to get rid of concurrency issues
This more or less completes the simplification of the template handling code in Hugo started in v0.62.

The main motivation was to fix a long lasting issue about a crash in HTML content files  without front matter.

But this commit also comes with a big functional improvement.

As we now have moved the base template evaluation to the build stage we now use the same lookup rules for `baseof` as for `list` etc. type of templates.

This means that in this simple example you can have a `baseof` template for the `blog` section without having to duplicate the others:

```
layouts
├── _default
│   ├── baseof.html
│   ├── list.html
│   └── single.html
└── blog
    └── baseof.html
```

Also, when simplifying code, you often get rid of some double work, as shown in the "site building" benchmarks below.

These benchmarks looks suspiciously good, but I have repeated the below with ca. the same result. Compared to master:

```
name                              old time/op    new time/op    delta
SiteNew/Bundle_with_image-16        13.1ms ± 1%    10.5ms ± 1%  -19.34%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file-16    13.0ms ± 0%    10.7ms ± 1%  -18.05%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories-16      46.4ms ± 2%    43.1ms ± 1%   -7.15%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs-16            52.2ms ± 2%    47.8ms ± 1%   -8.30%  (p=0.029 n=4+4)
SiteNew/Deep_content_tree-16        77.9ms ± 1%    70.9ms ± 1%   -9.01%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates-16      43.0ms ± 0%    37.2ms ± 1%  -13.54%  (p=0.029 n=4+4)
SiteNew/Page_collections-16         58.2ms ± 1%    52.4ms ± 1%   -9.95%  (p=0.029 n=4+4)

name                              old alloc/op   new alloc/op   delta
SiteNew/Bundle_with_image-16        3.81MB ± 0%    2.22MB ± 0%  -41.70%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file-16    3.60MB ± 0%    2.01MB ± 0%  -44.20%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories-16      19.3MB ± 1%    14.1MB ± 0%  -26.91%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs-16            70.7MB ± 0%    69.0MB ± 0%   -2.40%  (p=0.029 n=4+4)
SiteNew/Deep_content_tree-16        37.1MB ± 0%    31.2MB ± 0%  -15.94%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates-16      17.6MB ± 0%    10.6MB ± 0%  -39.92%  (p=0.029 n=4+4)
SiteNew/Page_collections-16         25.9MB ± 0%    21.2MB ± 0%  -17.99%  (p=0.029 n=4+4)

name                              old allocs/op  new allocs/op  delta
SiteNew/Bundle_with_image-16         52.3k ± 0%     26.1k ± 0%  -50.18%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file-16     52.3k ± 0%     26.1k ± 0%  -50.16%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories-16        336k ± 1%      269k ± 0%  -19.90%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs-16              422k ± 0%      395k ± 0%   -6.43%  (p=0.029 n=4+4)
SiteNew/Deep_content_tree-16          401k ± 0%      313k ± 0%  -21.79%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates-16        247k ± 0%      143k ± 0%  -42.17%  (p=0.029 n=4+4)
SiteNew/Page_collections-16           282k ± 0%      207k ± 0%  -26.55%  (p=0.029 n=4+4)
```

Fixes #6716
Fixes #6760
Fixes #6768
Fixes #6778
2020-01-22 09:39:49 +01:00
Niklas Fasching 8585b388d2 deps: Update go-org
Not really a new major version but it's used in production and apparently that
means it should be a 1+. Will try to follow semver better from now on.

Changes:

- `#+OPTIONS: toc:1` now supports not just true/false but numbers to limit
  headline levels included in table of conents
- bug fix latex fragment parsing
2020-01-21 10:21:57 +01:00
Jonathan Ling d61bee5e09 examples: Fix blog not building
The example blog had not been updated for some time and I had to restructure it a little bit.

Fixes #6752

Changed tag and category directory structure
2020-01-19 14:42:27 +01:00
Joshua Wong 21ca2e9ce4 Add support for newline characters in raw string shortcode 2020-01-18 11:24:10 +01:00
Ghislain Bourgeois 3efa1d8121 deps: Update github.com/alecthomas/chroma
This new release improves YAML syntax highlighting.
2020-01-16 20:57:02 +01:00
Bjørn Erik Pedersen 65ec8fe827 deps: Update minify to v2.7.2
Fixes #6756
2020-01-15 16:04:44 +01:00
Matt Riggott d3e8ab2e39 deps: Update Goldmark to v1.1.21
This is the first version of Goldmark that supports all the
Smartypants-style typographic punctuation transformations. Now, a
straight single quote in the middle of a word is translated into a curly
quote (e.g. "that's" becomes "that&rsquo;s"). Earlier versions leave
them untouched. This brings Goldmark in line with Blackfriday.

Fixes #6571.
2020-01-15 12:07:25 +01:00
Joshua Wong da81455656 Allow raw string literals in shortcode params 2020-01-15 09:27:19 +01:00
Bjørn Erik Pedersen 0c0bb37285 deps: Update github.com/gohugoio/testmodBuilder 2020-01-14 17:09:11 +01:00
Bjørn Erik Pedersen ddd75f2121 hugolib: Some more benchmark adjustments 2020-01-13 16:47:10 +01:00
Bjørn Erik Pedersen 4ed6ebef4c hugolib: Adjust site benchmarks 2020-01-13 16:39:33 +01:00
Bjørn Erik Pedersen 94cfdf6bef deps: Update direct dependencies
Closes #6719
2020-01-07 20:12:20 +01:00
Bjørn Erik Pedersen 4513801778 minifiers: Update to new CSS config
Update #6719
2020-01-07 18:06:22 +01:00
Bjørn Erik Pedersen 56354a63bb deps: Update to Minify v2.7.0
Updates ##6719
2020-01-07 16:13:38 +01:00
Bjørn Erik Pedersen b9b73a2f63 Revert "Add support for freebsd/arm64"
golang.org/x/sys is an indirect dependency and needs to be updates as such.

This reverts commit aead8108b8.
2020-01-07 13:42:43 +01:00
Dmitri Goutnik aead8108b8 Add support for freebsd/arm64
Update #6719 6719
2020-01-07 13:21:19 +01:00
Bjørn Erik Pedersen 1cf235412f tpl: Put Go's internal template funcs in Hugo's map
```
name                            old time/op    new time/op    delta
SiteNew/Many_HTML_templates-16    43.4ms ± 0%    42.7ms ± 0%  -1.71%  (p=0.016 n=4+5)

name                            old alloc/op   new alloc/op   delta
SiteNew/Many_HTML_templates-16    17.5MB ± 0%    17.5MB ± 0%    ~     (p=0.690 n=5+5)

name                            old allocs/op  new allocs/op  delta
SiteNew/Many_HTML_templates-16      247k ± 0%      247k ± 0%    ~     (p=0.310 n=5+5)
```

Fixes #6717
2020-01-07 13:18:19 +01:00
Bjørn Erik Pedersen df6e9efd8f Update releasenotes_writer.go 2020-01-07 13:15:22 +01:00
Bjørn Erik Pedersen ea05c0e845 hugolib: Add a benchmark with lots of templates 2020-01-07 10:48:17 +01:00
hugoreleaser 273047b5ba releaser: Prepare repository for 0.63.0-DEV
[ci skip]
2020-01-05 18:58:55 +00:00
hugoreleaser 83e501849e releaser: Add release notes to /docs for release of 0.62.2
[ci skip]
2020-01-05 18:50:35 +00:00
hugoreleaser 12230b6897 releaser: Bump versions for release of 0.62.2
[ci skip]
2020-01-05 18:50:35 +00:00
hugoreleaser afdb180e23 releaser: Add release notes for 0.62.2
[ci skip]
2020-01-05 18:50:35 +00:00
Bjørn Erik Pedersen 196a9df585 hugolib: Fix relative .Page.GetPage from bundle
Fixes #6705
2020-01-05 19:41:53 +01:00
Bjørn Erik Pedersen 9b6e61464b markup/goldmark: Adjust auto ID space handling
GitHub does not consider tabs as delimiter, see https://github.com/bep/portable-hugo-links/blob/master/blog/p2.md

Closes #6710
2020-01-05 15:58:14 +01:00
Bjørn Erik Pedersen d62ede8e9e docs: Document the new autoHeadingIDType setting
See #6707
See #6616
2020-01-05 12:10:12 +01:00
Bjørn Erik Pedersen 81b7e48a55 docs: Regenerate docshelper
See #6707
See #6616
2020-01-05 11:57:49 +01:00
Bjørn Erik Pedersen 16e7c11203 markup/goldmark: Add an optional Blackfriday auto ID strategy
Fixes #6707
2020-01-05 11:56:05 +01:00
Bjørn Erik Pedersen 8f071fc159 markup/goldmark: Make the autoID type config a string
To potentially make room for one more.

See #6707
2020-01-05 11:29:22 +01:00
Bjørn Erik Pedersen 469351d5b6 Merge commit '26f1458a2df6b55eee3a5de46f5fec23a43a7c7d' 2020-01-05 11:14:51 +01:00
Bjørn Erik Pedersen 26f1458a2d Squashed 'docs/' changes from 54f0e8776..bd0e15bb6
bd0e15bb6 Optimised images with calibre/image-actions
59830ea44 Remove comments from quickstart code samples
348821b5d Remove image-actions
1cbbd26a9 Update index.md
bcf3de764 Update index.md
fcf17e6ef Release 0.62.1
0956bde21 Merge branch 'temp621'
28d604756 releaser: Add release notes to /docs for release of 0.62.1
c895f12e7 Fix statement about version installed with apt-get (#854)
e96928e38 Updated quickstart to split theme download and theme config add into separate blocks (#967)
e099c1ad6 changed ".Title" to ".URL" (#972)
bea71280d Fix small typing error (#1001)
9c28c422e Correct hyperlink for 'markdownify' function
cf3844a06 Corrected small conjugation mistake (#996)
8b9c1d4f2 Added remarks about additional parameters in ref/relref (#995)
ca06c9a56 Fix illegal character in render-link.html example
7a85c789b Update RenderString.md
69df3b17e Update configuration-markup.md
43e9222a2 Revert "Add shortcodes to note comparing with `markdownify`"
2bd5bc2d7 Add shortcodes to note comparing with `markdownify`
ddfee60b7 Update configuration-markup.md
f87c35fe2 docs: Remove extra double quotation
5ca5cc15f Update index.md
6e457f5ec Update configuration-markup.md
12df3c0fc Update configuration-markup.md
91977fd96 Update configuration-markup.md
377b8954a Update configuration-markup.md
99d691b5e Update hosting-on-render.md
ccf855b22 Update index.md
a945acc42 Update index.md
7d4f308d6 Fix Netlify config
f4caa07f5 Release 0.62.0
79d18276f releaser: Add release notes to /docs for release of 0.62.0
9db1a08d1 Merge commit '8a4005cf2b0ef34265ff8051a6b76226685fc226'
79e556223 docs: More on hooks
5088c54df tpl: Do not return any value in errorf
98c8c8638 tpl: Add a warnf template func
4a9d76cea docs: Regen docshelper
626e53b55 Fix incorrect MIME type from image/jpg to image/jpeg
f92f77c5d Preserve HTML Text for link render hooks
6db9c52b1 docs: Footnote
16801db3b Add render template hooks for links and images
0facb823c Merge commit '2e711a28c71e8667258e5ab824f9b9a71c261b0a'
79bf8ed4c markup/tableofcontents: Add config option for ordered list

git-subtree-dir: docs
git-subtree-split: bd0e15bb60
2020-01-05 11:13:09 +01:00
Bjørn Erik Pedersen 5ee1f0876f markup/goldmark: Simplify code 2020-01-04 23:58:23 +01:00
Bjørn Erik Pedersen a82d2700fc markup/goldmark: Make auto IDs GitHub compatible
You can turn off this behaviour:

```toml
[markup]
  [markup.goldmark]
    [markup.goldmark.parser]
      autoHeadingIDAsciiOnly = true
```
Note that the `anchorize` now adapts its behaviour depending on the default Markdown handler.

Fixes #6616
2020-01-04 19:46:01 +01:00
hugoreleaser ae816452b1 releaser: Prepare repository for 0.63.0-DEV
[ci skip]
2020-01-01 17:46:46 +00:00
hugoreleaser a1518704a7 releaser: Add release notes to /docs for release of 0.62.1
[ci skip]
2020-01-01 17:38:22 +00:00
hugoreleaser 3a21a1708d releaser: Bump versions for release of 0.62.1
[ci skip]
2020-01-01 17:38:22 +00:00
hugoreleaser 451746ddd7 releaser: Add release notes for 0.62.1
[ci skip]
2020-01-01 17:38:22 +00:00
Bjørn Erik Pedersen ff6253bc7c Support files in content mounts
This commit is a general improvement of handling if single file mounts.

Fixes #6684
Fixes #6696
2020-01-01 18:19:49 +01:00
Remco de Man aa4ccb8a1e Update alpine base image in Dockerfile to 3.11
When building the extended version of Hugo using the Dockerfile and
`--build-arg HUGO_BUILD_TAGS=extended`, the obtained Docker container is
broken, because the source is build under alpine 3.11 and the compiled
binary is copied to an image based on alpine 3.10. This problem was most
likely introduced due to an update of the golang base image.

This commit changes the base image from alpine:3.10 to alpine:3.11,
fixing extended version builds.
2019-12-30 13:56:58 +01:00
Bjørn Erik Pedersen 5509954c7e hugolib: Fix inline shortcode regression
Fixes #6677
2019-12-28 14:31:51 +01:00
hugoreleaser 6b59b64f02 releaser: Prepare repository for 0.63.0-DEV
[ci skip]
2019-12-23 10:32:39 +00:00
hugoreleaser 6608f15570 releaser: Add release notes to /docs for release of 0.62.0
[ci skip]
2019-12-23 10:23:27 +00:00
hugoreleaser b361d9a462 releaser: Bump versions for release of 0.62.0
[ci skip]
2019-12-23 10:23:27 +00:00
Bjørn Erik Pedersen 592a7d104d Release 0.62.0 2019-12-23 10:49:08 +01:00
hugoreleaser 93216fda72 releaser: Add release notes for 0.62.0
Rename to *-ready.md to continue.
[ci skip]
2019-12-23 08:57:02 +00:00
Bjørn Erik Pedersen 8a4005cf2b Squashed 'docs/' changes from af4b7ac5b..54f0e8776
54f0e8776 Update image-actions.yml
94e5cad02 Update image-actions.yml
0ad20d226 Add a page about Hugo's Security Model
0dee16d11 Link to Régis Full Partials series
138782808 Update partialCached.md

git-subtree-dir: docs
git-subtree-split: 54f0e87767
2019-12-22 22:51:45 +01:00
Bjørn Erik Pedersen 740b72558b Merge commit '8a4005cf2b0ef34265ff8051a6b76226685fc226' 2019-12-22 22:51:45 +01:00
Bjørn Erik Pedersen 1fb17be9a0 deps: Update Goldmark to v1.1.18
Fixes #6649
2019-12-22 18:14:04 +01:00
Niklas Fasching 51d89dab18 deps: Update go-org
- export #+TITLE (front-matter title) as `<h1>` and demote all normal headlines
  by 1 accordingly (i.e. a normal top level headline now becomes a `<h2>`
  rather than a `<h1>`)
- preserve whitespace in paragraphs - this allows rendering meaningful
  whitespace when wished for using e.g. css `white-space: pre;` (e.g. in verse
  / quote blocks)
2019-12-22 16:18:55 +01:00
Bjørn Erik Pedersen c8bfe47c6a docs: More on hooks 2019-12-21 11:59:36 +01:00
Bjørn Erik Pedersen 50cc7fe545 tpl: Do not return any value in errorf
Fixes #6653
2019-12-21 10:26:14 +01:00
Bjørn Erik Pedersen 1773d71d5b tpl: Add a warnf template func
Fixes #6628
2019-12-21 10:23:00 +01:00
Bjørn Erik Pedersen 8a58ebb311 hugolib: Improve error and reload handling of hook templates in server mode
Fixes #6635
2019-12-20 11:38:44 +01:00
Bjørn Erik Pedersen 0453683816 deps: Update to Goldmark v1.1.17
Fixes #6641
2019-12-20 08:00:37 +01:00
Bjørn Erik Pedersen 55c29d4de3 docs: Regen docshelper 2019-12-19 23:48:01 +01:00
Bjørn Erik Pedersen ccb1bf1abb tpl/collections: Some more params merge adjustments
* If the end result is maps.Params, we need to lower the keys
* Also make sure to handle nested maps of different type

Update #6633
2019-12-19 20:50:30 +01:00
Bjørn Erik Pedersen a67d95fe1a Preserve HTML Text for image render hooks
Fixes #6639
2019-12-19 19:02:03 +01:00
Bjørn Erik Pedersen ad6504e6b5 Fix abs path handling in module mounts
Fixes #6622
2019-12-19 18:51:59 +01:00
John Zaitseff 158e7ec204 Fix incorrect MIME type from image/jpg to image/jpeg
According to multiple sources, both official ([IANA] and [RFC2046]) and
otherwise (eg, [Mozilla] and [Wikipedia]), the official MIME type for
JPEG images is `image/jpeg`, not `image/jpg`.  Change Hugo to match.

[IANA]: https://www.iana.org/assignments/media-types/media-types.xhtml#image
[RFC2046]: https://tools.ietf.org/html/rfc2046
[Mozilla]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types
[Wikipedia]: https://en.wikipedia.org/wiki/JPEG
2019-12-19 18:02:11 +01:00
Bjørn Erik Pedersen eef934ae7e deps: Update Goldmark
Fixes #6626
2019-12-19 09:05:35 +01:00
Bjørn Erik Pedersen 00954c5d1f Preserve HTML Text for link render hooks
The context now have two text methods:

* Text - rendered
* PlainText

Fixes #6629
2019-12-18 22:55:19 +01:00
Bjørn Erik Pedersen 1b785a7a6d tpl/collections: Fix merge vs Params
Fixes #6633
2019-12-18 21:31:34 +01:00
Bjørn Erik Pedersen d20ca37005 tpl: Get rid of the custom template truth logic
Fixes #6615
2019-12-18 20:05:22 +01:00
Bjørn Erik Pedersen 3e316155c5 docs: Footnote 2019-12-18 16:37:43 +01:00
Bjørn Erik Pedersen e625088ef5 Add render template hooks for links and images
This commit also

* revises the change detection for templates used by content files in server mode.
* Adds a Page.RenderString method

Fixes #6545
Fixes #4663
Closes #6043
2019-12-18 11:44:40 +01:00
Bjørn Erik Pedersen 67f3aa72cf Merge commit '2e711a28c71e8667258e5ab824f9b9a71c261b0a' 2019-12-15 10:37:36 +01:00
Bjørn Erik Pedersen 2e711a28c7 Squashed 'docs/' changes from 51c4f3184..af4b7ac5b
af4b7ac5b Remove mention of Amber and Ace
c841e9207 Exif docs corrections (#978)
0f82420b8 Change cache assets default example to 1 year
676dc6e12 Release 0.61.0
a1d9fb18a Merge commit '79c5d7053486f540b6219e693d5590f2c4c3937a'
1b9e675cd releaser: Add release notes to /docs for release of 0.61.0
5b95cbc8a Fixed suffixIsRemoved error in code samples (#975)
59b2c245b Fix Usage section in toc.md to consider Goldmark TOC settings
fd3828673 Add link on how to configure TOC w/ Goldmark
ea339f2d6 Added external learning resources including Hugo In Action book.
fab502d5d Adjust release notes
269a025ef Release 0.60.1
6bff50bea Merge branch 'temp601'
e15251c43 releaser: Add release notes to /docs for release of 0.60.1
690b864b9 Update use-modules.md
345ca8c36 Update syntax-highlighting.md
be64af9f5 Update syntax-highlighting.md
df9dead83 Update syntax-highlighting.md
1c6e6d238 Fix relnotes
0ea6b2012 Update homepagetweets.toml
2c465625d Update index.md
0025bba09 Update index.md
7417f1c05 Update index.md
9eeb8ce57 Release 0.60.0
25a711023 Merge branch 'temp60'
0c4faab0e releaser: Add release notes to /docs for release of 0.60.0
779e5108e Update installing.md
2ef1c386a Minor text improvements in README.md
41ec5a19a Reword sentence for clarity search.md
ded74f098 Add Goldmark as the new default markdown handler
cb55cdbb0 Update introduction.md
fcaad653a Update homepage.md
7427a1fc5 Update configuration.md
8cc2c72ca tpl/collections: Allow dict to create nested structures
4538c092c Merge commit 'efc0b1bb6c6564f54d596467dbc6a18cb206954e'
90f908e7b Support Go time format strings in permalinks

git-subtree-dir: docs
git-subtree-split: af4b7ac5b4
2019-12-15 10:35:09 +01:00
Shohei Ueda 0947cf9583 Enhance accessibility to issues
Add links to the Hugo issues, Hugo docs issues, and Hugo website theme issues.

Close #6233
2019-12-14 18:47:23 +01:00
Bjørn Erik Pedersen 3c24ae030f hugolib: Fix test 2019-12-12 14:48:59 +01:00
Bjørn Erik Pedersen 03d6960a15 deps: Re-introduce the correct version of Goldmark
It was accidently pulled back to an old version earlier today.
2019-12-12 14:45:46 +01:00
Bjørn Erik Pedersen 92c7f7ab85 tpl: Add some comments 2019-12-12 11:44:36 +01:00
Bjørn Erik Pedersen a03c631c42 Rework template handling for function and map lookups
This is a big commit, but it deletes lots of code and simplifies a lot.

* Resolving the template funcs at execution time means we don't have to create template clones per site
* Having a custom map resolver means that we can remove the AST lower case transformation for the special lower case Params map

Not only is the above easier to reason about, it's also faster, especially if you have more than one language, as in the benchmark below:

```
name                          old time/op    new time/op    delta
SiteNew/Deep_content_tree-16    53.7ms ± 0%    48.1ms ± 2%  -10.38%  (p=0.029 n=4+4)

name                          old alloc/op   new alloc/op   delta
SiteNew/Deep_content_tree-16    41.0MB ± 0%    36.8MB ± 0%  -10.26%  (p=0.029 n=4+4)

name                          old allocs/op  new allocs/op  delta
SiteNew/Deep_content_tree-16      481k ± 0%      410k ± 0%  -14.66%  (p=0.029 n=4+4)
```

This should be even better if you also have lots of templates.

Closes #6594
2019-12-12 10:04:35 +01:00
Bjørn Erik Pedersen 167c01530b Create lightweight forks of text/template and html/template
This commit also removes support for Ace and Amber templates.

Updates #6594
2019-12-12 09:59:34 +01:00
Gavin D. Howard 4c804319f6 markup/tableofcontents: Add config option for ordered list 2019-12-12 07:48:40 +01:00
hugoreleaser 186a5ebfca releaser: Prepare repository for 0.62.0-DEV
[ci skip]
2019-12-11 08:35:04 +00:00
hugoreleaser 9b445b9da2 releaser: Add release notes to /docs for release of 0.61.0
[ci skip]
2019-12-11 08:26:33 +00:00
hugoreleaser 3af783966d releaser: Bump versions for release of 0.61.0
[ci skip]
2019-12-11 08:26:33 +00:00
Bjørn Erik Pedersen 31f322a610 Release 0.61.0 2019-12-11 09:14:48 +01:00
hugoreleaser 38c60f2be4 releaser: Add release notes for 0.61.0
Rename to *-ready.md to continue.
[ci skip]
2019-12-11 07:55:37 +00:00
Bjørn Erik Pedersen 3cc217a650 deps: Update Goldmark 2019-12-11 08:41:57 +01:00
Bjørn Erik Pedersen 5f8c2818f1 Deprecate Ace and Amber
Fixes #6609
2019-12-11 08:08:42 +01:00
Daniel Tang c5f2f5837f markup: Add typographic chars from goldmark to toc
Fixes #6592
2019-12-10 23:48:44 +01:00
Bjørn Erik Pedersen 0efb00c2a8 tpl/partials: Allow any key type in partialCached
Fixes #6572
2019-12-03 00:13:47 +01:00
Bjørn Erik Pedersen 40a092b068 markup: Reimplement pygmentsCodefencesGuessSyntax
Fixes #6565
2019-12-02 14:12:23 +01:00
Bjørn Erik Pedersen d534ce9424 deps: Update Goldmark
Fixes #6557
2019-12-01 22:07:31 +01:00
hugoreleaser a6b6b135a4 releaser: Prepare repository for 0.61.0-DEV
[ci skip]
2019-11-29 15:05:19 +00:00
hugoreleaser 960667561f releaser: Add release notes to /docs for release of 0.60.1
[ci skip]
2019-11-29 14:56:16 +00:00
hugoreleaser 6c05563082 releaser: Bump versions for release of 0.60.1
[ci skip]
2019-11-29 14:56:16 +00:00
hugoreleaser f5250ec09d releaser: Add release notes for 0.60.1
[ci skip]
2019-11-29 14:56:16 +00:00
MeiK 86a5b59f64 deps: Update minify
Fixes #6475
2019-11-29 14:37:32 +01:00
Bjørn Erik Pedersen bb80fff69a Fix headless regression
Fixes #6552
2019-11-29 13:46:29 +01:00
Bjørn Erik Pedersen 347cfb0c17 deps: Update Goldmark
Fixes #6549
Fixes #6551
2019-11-29 13:44:29 +01:00
Bjørn Erik Pedersen b60ae35b97 hugolib: Fix timeout number parsing for YAML/JSON config
Where numbers are all floats.

Fixes #6555
2019-11-29 10:50:36 +01:00
hugoreleaser 003ba5b10f releaser: Prepare repository for 0.61.0-DEV
[ci skip]
2019-11-27 10:19:00 +00:00
hugoreleaser f2dea9b036 releaser: Add release notes to /docs for release of 0.60.0
[ci skip]
2019-11-27 10:09:46 +00:00
hugoreleaser 763b0dcb97 releaser: Bump versions for release of 0.60.0
[ci skip]
2019-11-27 10:09:46 +00:00
Bjørn Erik Pedersen b2969b7a77 Release 0.60.0 2019-11-27 11:01:50 +01:00
hugoreleaser 60fea562c4 releaser: Add release notes for 0.60.0
Rename to *-ready.md to continue.
[ci skip]
2019-11-27 11:01:23 +01:00
Bjørn Erik Pedersen 14a1de14fb modules: Add some more output if modules download takes time
Closes #6519
2019-11-27 09:51:47 +01:00
Bjørn Erik Pedersen dcde8af8c6 Add some internal template image tests
Closes #6542
2019-11-27 09:24:08 +01:00
Max Arnold c91970c08d tpl/tplimpl: Featured and Site.Params image support for Schema 2019-11-26 23:53:43 +01:00
Bjørn Erik Pedersen dd1e5fc0b4 hugolib: Disable test assertion on Windows 2019-11-26 23:51:31 +01:00
Bjørn Erik Pedersen b0c7749fa1 deps: Update Goldmark
Closes https://github.com/yuin/goldmark/issues/36#event-2832923993
2019-11-26 23:51:31 +01:00
Max Arnold 25a6b33693 tpl/tplimpl: Add support for featured and global image to OpenGraph template 2019-11-26 20:11:53 +01:00
Bjørn Erik Pedersen 0176643924 hugolib: Fix cascade in server mode
Fixes #6538
2019-11-26 17:04:39 +01:00
Bjørn Erik Pedersen da53523599 hugolib: Fix .Sections vs siblings
Fixes #6365
2019-11-26 13:12:44 +01:00
Bjørn Erik Pedersen 96f09659ce Fix language handling in ExecuteAsTemplate
Fixes #6331
2019-11-26 12:55:00 +01:00
Bjørn Erik Pedersen 03b369e672 hugolib: Adjust .Site.Permalinks deprecation level 2019-11-25 20:19:41 +01:00
Bjørn Erik Pedersen 69fd1c60d8 hugolib: Remove .Site.Ref/RelRef 2019-11-25 20:17:59 +01:00
Bjørn Erik Pedersen 33d733300a Deprecate mmark
Fixes #6486
2019-11-25 20:14:20 +01:00
Bjørn Erik Pedersen e3451371bd hugolib: Fix recently broken timeout config 2019-11-25 20:13:29 +01:00
Bjørn Erik Pedersen 5c5231e09e commands: Use HUGO_ENV if set
Fixes #6456
2019-11-25 19:12:14 +01:00
Bjørn Erik Pedersen d6f7a9e28d resources/images: Make the image cache more robust
Also allow timeout to be set as a duration string, e.g. `30s`.

Fixes #6501
2019-11-25 18:59:06 +01:00
Bjørn Erik Pedersen 031f948f87 Update to Go 1.13.4 and Go 1.12.13 2019-11-25 18:59:06 +01:00
Bjørn Erik Pedersen 71597bd1ad mage: Restore -v behaviour 2019-11-25 18:59:06 +01:00
Bjørn Erik Pedersen a8e9f8389a hugolib: Increase default timeout value to 30s
Fixes #6502
2019-11-25 18:59:06 +01:00
Bjørn Erik Pedersen 03e2d7462d hubolig: Fix potential data race
Fixes #6478
2019-11-25 18:59:06 +01:00
Bjørn Erik Pedersen ea96e1dc55 Revert "deps: Update Goldmark"
See https://github.com/yuin/goldmark/issues/36

This reverts commit 8221912869.
2019-11-25 16:58:37 +01:00
Bjørn Erik Pedersen 8221912869 deps: Update Goldmark 2019-11-25 12:50:45 +01:00
Chris Trimble 8beaa4c25e mage: Fix mage check on darwin and add debugging output
Darwin no longer supports 386 builds after Catalina. Also add
debugging output when running test suites from mage.
2019-11-25 09:48:26 +01:00
Chris Trimble 8a89b8582f commands: Fix jekyll metadata import on individual posts
Prior refactor had eliminated writing FrontMatter for Jekyll imports. This
fixes that bug as well as adds a regression test.

Also removed unused site var, replaced some raw strings, and added regression
test for \r\n removal.

Fixes #5576
2019-11-25 09:46:44 +01:00
jasdeepgill e1175ae83a Improve grammar in README.md 2019-11-25 09:45:21 +01:00
Bjørn Erik Pedersen a2d77f4a80 markup/highlight: Replace the temp for with a dependency 2019-11-24 13:59:16 +01:00
Bjørn Erik Pedersen b546417a27 deps: Update Chroma 2019-11-24 12:29:55 +01:00
Bjørn Erik Pedersen 4175b04686 deps: Update Goldmark 2019-11-24 12:28:57 +01:00
Bjørn Erik Pedersen 55f951cbba markup/tableofcontents: GoDoc etc. 2019-11-23 16:59:43 +01:00
Cameron Moore 20f351ee4c Minor cleanups
Use fmt.Fprint were appropriate instead of Fprintf.  Remove some unused
code.
2019-11-23 16:38:02 +01:00
Bjørn Erik Pedersen bfb9613a14 Add Goldmark as the new default markdown handler
This commit adds the fast and CommonMark compliant Goldmark as the new default markdown handler in Hugo.

If you want to continue using BlackFriday as the default for md/markdown extensions, you can use this configuration:

```toml
[markup]
defaultMarkdownHandler="blackfriday"
```

Fixes #5963
Fixes #1778
Fixes #6355
2019-11-23 14:12:24 +01:00
Bjørn Erik Pedersen a3fe5e5e35 Fix Params case handling in the index, sort and where func
This means that you can now do:

```
{{ range where .Site.Pages "Params.MYPARAM" "foo" }}
```
2019-11-22 18:41:50 +01:00
Bjørn Erik Pedersen cd07e6d57b Fix GetPage Params case issue
Fixes #5946
2019-11-22 18:41:40 +01:00
Bjørn Erik Pedersen 628efd6e29 common/para: Add parallel task executor helper
Usage of this will come later.
2019-11-21 18:38:14 +01:00
Bjørn Erik Pedersen 2dcc1318d1 Add some more output if loading modules takes time
Also include the time to collect modules etc. in the "Total in ..." time reported for the `hugo` command.

Fixes #6519
2019-11-21 18:11:07 +01:00
Bjørn Erik Pedersen 14a985f8ab Update homepage.md
Fixes https://github.com/gohugoio/hugo/issues/6510
2019-11-18 09:17:49 +01:00
Bjørn Erik Pedersen 0cf85c071a hugolib: Add a benchmark 2019-11-17 17:22:32 +01:00
Bjørn Erik Pedersen 20ec9fa2bb modules: Do not check for remote modules if main project is vendored
Fixes #6506
2019-11-14 12:24:55 +01:00
Bjørn Erik Pedersen 812688fc2f hugolib: Fix emoji handling inside shortcodes
Fixes #6504
2019-11-14 10:00:06 +01:00
Bjørn Erik Pedersen a2670bf460 tpl/collections: Allow dict to create nested structures
Fixes #6497
2019-11-11 21:55:16 +01:00
reuben honigwachs 1a36ce9b09 commands: Add hint when dir not empty
Many users seem to stumble over creating new sites in existing non-empty directories. And that `--force` is the necessary option. So I added *See --force* as a hint to the error.

Fixes #4825.
2019-11-11 21:38:10 +01:00
Bjørn Erik Pedersen 90d0cdf236 tpl/collections: Add collections.Reverse
Fixes #6499
2019-11-11 18:33:22 +01:00
Bjørn Erik Pedersen 95ef93be66 tpl/collections: Make index work with slice as the last arg
Fixes #6496
2019-11-11 13:54:57 +01:00
Bjørn Erik Pedersen 79355043e8 Merge commit 'efc0b1bb6c6564f54d596467dbc6a18cb206954e' 2019-11-11 11:46:22 +01:00
Bjørn Erik Pedersen efc0b1bb6c Squashed 'docs/' changes from 723da4a37..51c4f3184
51c4f3184 update figure shortcode docs
2e9c8200d Fix mediatype table
040355013 Rework the index doc
6f0c67c08 Release 0.59.1
a1add2ad0 Merge branch 'temp591'
e0ad971c0 releaser: Add release notes to /docs for release of 0.59.1
c03eb16e7 Fix automatic typo
a623ccfd1 Update quick-start.md
de36e6f8f Clarify that `print` takes 1+ arguments
de439ab84 correct the themes url www.themes.gohugo.io > themes.gohugo.io
806102d10 Remove homepage Tweet (Account no longer exists)
fc4c88513 Add extended version choco instructions (#703)
1b1e8b33c Fix environment typo (#950)
76932cb49 HTTPS relevant search link URLs (#951)
2ef6bdfa4 Update theme
336a6468a Fix consecutive typo (#949)
f44183ddb Fix corresponding typo (#948)
995bf0048 Update index.md
e99758f79 Release 0.59.0
36517d198 releaser: Add release notes to /docs for release of 0.59.0
3acb75f89 Merge commit '5ac0f751aa47e52625662215f66efa99a6abfc2e'
8b3cb611a Merge commit '5070ba6c9e6c492deade3c30cfe769b9dbf7151d'
fd0127841 Merge commit 'b9bd35d72e14932fb6588ff62b90cddef0a060fc' as 'docs'
39121de4d docs: Replace /docs
180195aa3 cache/filecache: Recover from file corruption
4b286b9d2 resources/images: Allow to set background fill colour
689f647ba media: Add common video media types
46cafdbac examples: Replace .RSSLink
653e6856e resources/page: Use binary search in Pages.Prev/Next if possible
f4f566edf Make Pages.Prev/Next work like the other Prev/Next methods
7b3edc293 tpl: Add optional "title" attribute to iframe in Vimeo shortcode
65b7d4221 tpl: Modify error messages of after, first, and last
0e75af74d tpl: Last now accepts 0 as limit
5f1aafafb Update feature_request.md
a9762b5c4 common: Fix elements are doubling when append a not assignable type
096a4b67b tpl: After now accepts 0 as index
bc70f2bf1 helpers: Fix data race in global logger init
0d7b05be4 tpl: Make getJSON/getCVS accept non-string args
71b18a078 Update to Go 1.12.10 and 1.13.1
339ee3714 Simplify test output to simplify diffing
f10db101a hugofs: Add FileMeta.String
b401858eb deps: Update minify to v2.5.2
39ed33fce resources: Fix image test error on s390x, ppc64* and arm64
020a6fbd7 Add BaseFs to RenderingContext
b152216d5 deps: Update go-org
64ec8c890 media: Use + to create the Type string
c466b88c9 deps: Upgrade to latest version of emoji dependency
2df5d202c Revert "deps: Upgrade to latest version of emoji dependency"
170f18d93 deps: Upgrade to latest version of emoji dependency
15a0364d3 readme: Update Architectures
674e81ae8 deploy: Add ability to invalidate Google Cloud CDN
298092d51 resources: Ensure same dirinfos sort order in TestImageOperationsGolden
019ae3848 Update bug_report.md
329e88db1 Support typed bool, int and float in shortcode params
e073f4efb deps: Update Chroma
454a033dc github: Add issue templates and action
e5856e61d resources: Support output image format in image operations
34dc06b03 tpl: Add `rel="noopener"` for external links
2b1814ee5 tpl: Remove unneeded space
8cb7a0d4d releaser: Prepare repository for 0.59.0-DEV
4aac02d49 releaser: Add release notes to /docs for release of 0.58.3
85376a757 releaser: Bump versions for release of 0.58.3
0fd30f832 releaser: Add release notes for 0.58.3 [ci skip]
c262a95a5 Add some more resource transform tests
6dec671fb Fix cache key transformed resources
c0d7188ec deploy: Do not compile in Azure on Solaris
13768c3c5 releaser: Prepare repository for 0.59.0-DEV
253e5fdc6 releaser: Add release notes to /docs for release of 0.58.2
7bc1270ec releaser: Bump versions for release of 0.58.2
d4c98e580 releaser: Add release notes for 0.58.2 [ci skip]
c0d757367 Fix cache keys for bundled resoures in transform.Unmarshal
fcfa6f33b filecache: Ignore "does not exist" errors in prune
77b23fe3d releaser: Prepare repository for 0.59.0-DEV
24277b920 releaser: Add release notes to /docs for release of 0.58.1
8bc478d3f releaser: Bump versions for release of 0.58.1
609a9afbe releaser: Add release notes for 0.58.1 [ci skip]
9442937d8 Avoid writing the same processed image to /public twice
901077c03 hugolib: Fix broken bundle live reload logic
24ad42957 deps: Update github.com/bep/gitmap
3be2c2535 Fix concat with fingerprint regression
5e6609477 tpl: Remove eq argument limitation
f4e1cb8d0 releaser: Prepare repository for 0.59.0-DEV
64d8bf1ee releaser: Add release notes to /docs for release of 0.58.0
10c0baddf releaser: Bump versions for release of 0.58.0
9d3ae81b9 Release 0.58.0
bb894ceaf Allow slices in the image Filter funcs, not just varargs
529c7f109 Update 0.58.0-relnotes.md
57a54d19d releaser: Add release notes for 0.58.0
dc3f3df29 hugolib: Adjust Go version specific test
b43130115 Update to Go 1.13
28501ceb9 hugolib: Remove the old and slow site benchmarks
8624b9fe9 Cache processed images by their source path
018494f36 Remove test artifact
43298f028 Make the "is this a Hugo Module" logic more lenient
1b5c7e327 hugolib: Add a Sass includePaths test
05d83b6c0 Update to Go 1.11.13 and 1.12.9
4898fb3d6 Make home.Pages work like any other section
45d7988f2 Add some fingerprint tests
ce47c21a2 resources: Cache Exif data to disk
de9cbf619 Remove metaDataFormat setting
4f5011692 resources: Make the Exif benchmark filenames distinct
3becba7a9 resources: Add Exif benchmark
20bdc69a4 resources: Remove unused map type
28143397d Add image.Exif
8a8d4a6d9 deps: Update go-org (fix descriptive lists)
00297085d tpl: Migrate last shortcodes (YouTube and Vimeo) to HTTPS embeds
823f53c86 Add a set of image filters
f9978ed16 Image resource refactor
58d4c0a8b deps: Update go-org (fix footnotes in headlines)
c5319db9f Discrepancy typo fix
ad1d6d640 source: Remove debug check left during development
fd3d90ced hugolib: Change to output non-panic error message if missing shortcode template
3ae4b3e19 releaser: Prepare repository for 0.58.0-DEV
a849cb2d9 releaser: Add release notes to /docs for release of 0.57.2
01fbb4635 releaser: Bump versions for release of 0.57.2
9958e5e91 releaser: Add release notes for 0.57.2 [ci skip]
f77a4a2f4 Revert "Update to Go 1.11.13 and 1.12.9"
88d699361 tpl: Use RegularPages for RSS template
ea6816030 hugolib: Don't use the global warning logger
564cf1bb1 tpl: Avoid "home page warning" in RSS template
4b4bdcfe7 hugolib: Allow index.md inside bundles
18836a71c Adjust the default paginator for sections
ab40ce679 Revert the 0.57 home.Pages change
416493b54 hugolib: Add a site benchmark
f28efd358 Update to Go 1.11.13 and 1.12.9
36d749f4e releaser: Prepare repository for 0.58.0-DEV
58c56e9de releaser: Add release notes to /docs for release of 0.57.1
484106cfa releaser: Bump versions for release of 0.57.1
4d60a920f releaser: Add release notes for 0.57.1 [ci skip]
6ccf50ea7 hugolib: Fix draft etc. handling of _index.md pages
67524c993 Fix mainSections logic
952a31949 Fix live reload mount logic with sub paths
321418f22 modules: Disable "auto tidy" for now
7f3aab5ac hugolib: Recover and log panics in content init
028b99261 hugolib: Add some outputs tests
9475f61a3 hugolib: Fix taxonomies vs expired
ea9261e85 commands: Make sure the hugo field is always initialized before it's used
37f592980 releaser: Prepare repository for 0.58.0-DEV
9b00e6476 releaser: Add release notes to /docs for release of 0.57.0
ab849fcc9 releaser: Bump versions for release of 0.57.0
8a4c080cc Add release notes for 0.57.0
4644b95bd hugolib: Remove temporary warning
1089cfe4e Add FileInfo to resources created with resources.Match etc.
cd575023a Improve the server assets cache invalidation logic
631509810 modules: Do not fail build on errors in theme.toml
b64617fe4 Add resources.Match and resources.GetMatch
17ca8f0c4 commands: Fix faulty -h logic in hugo mod get
9e5718270 tests: Convert from testify to quicktest
6027ee110 Avoid unnecessary conversions
c577a9ed2 Fixed ineffectual assignments
a93cbb0d6 Simplify code
bd98182db Implement cascading front matter
e88d79899 Fixed tautological error conditions
c0eef3b40 Use the SVG logo in README.md
166a394a2 Fix static sync issue with virtual mounts
824395204 Add a branch bundle test case
7ff0a8ee9 Simplify page tree logic
df374851a hugolib: Add some more site benchmarks
a843ca53b  transform/urlreplacers: Cache the next position of `urlreplacer.prefix`
02397e76c postcss: Fix no-map vs noMap discrepancy
de8762424 hugolib: Fix output format handling of mix cased page kinds
9ef4dca36 hugolib: Fix broken test
2d1d33673 tpl: Regenerate templates
be0d4efc3 tpl: Always load GitHub Gists over HTTPS
f7f549e3a Fix assorted typos
6512d128c common/collections: Fix typo
b8758de19 examples: Fix multilingual example compatibility with latest version
53077b0da Merge pull request #6149 from bep/sort-caseinsensitive
a4f96a9d8 releaser: Prepare repository for 0.57.0-DEV
f637a1eac releaser: Add release notes to /docs for release of 0.56.3
9433c3c70 releaser: Bump versions for release of 0.56.3
7b448340c releaser: Add release notes for 0.56.3 [ci skip]
0e086785f hugolib: Fix bundle header clone logic
02b947eaa docs: Regenerate CLI docs
d7c233afe commands: Add "hugo config mounts" command
45ee8a7a5 commands: Cleanup the hugo config command
4b6c5eba3 Move the mount duplicate filter to the modules package
edf9f0a35 Allow overlap in module mounts
36220851e Fix self-mounts on the main project
53ade40ba releaser: Prepare repository for 0.57.0-DEV
5f033a7fc releaser: Add release notes to /docs for release of 0.56.2
2e6da0067 releaser: Bump versions for release of 0.56.2
06f29068f releaser: Add release notes for 0.56.2 [ci skip]
84bc8d84e Add some more content language test assertions
6eca0a3de commands: Fix config reloading in Vim and similar
e28bd4c0f Fix Jekyll import
2c7c36109 releaser: Create a proper automated title for patch releases
c62bbf7b1 Fix image format detection for upper case extensions, e.g. JPG
00a238e32 Fix i18n project vs theme order
e5f960245 Add proper error message when receiving nil in Resource transformation
9f497e7b5 Merge branch 'release-0.56.1'
3ad16af6f releaser: Prepare repository for 0.57.0-DEV
56908509e deps: Update go-org to v0.1.2
0ad218afc releaser: Add release notes to /docs for release of 0.56.1
b5fda703f releaser: Bump versions for release of 0.56.1
447700228 releaser: Add release notes for 0.56.1 [ci skip]
544f826dd releaser: Make it a one click release for patch releases
e393c6290 common/maps: Do not return error on params dot access on incompatible types
93d02aabe resources: Fix image Width/Height regression
508db1906 Revert "cache/filecache: Skip resource cache init if the fs is missing"
e5fe37892 modules: Set GO111MODULE=on
da4c4a778 cache/filecache: Skip resource cache init if the fs is missing
b4827fbb1 releaser: Prepare repository for 0.57.0-DEV
45f4eb984 releaser: Add release notes to /docs for release of 0.56.0
263f86d45 releaser: Bump versions for release of 0.56.0
bed75108e Update release notes
8d7006d85 releaser: Add release notes draft for 0.56.0
e5b6e2085 resources: Fix test on Windows
77bf2991b docs: Add Hugo Modules docs
e5f229974 Block symlink dir traversal for /static
87a07282a modules: Gofmt
882d678bb modules: Rename disabled => disable in config
fa28df105 hugolib: Fix broken test
072aa7f11 hugolib: Add a symdiff test
215d2ed88 docs: Regenerate CLI docs
23adc0c2d docs: Regenerate data helpers
461b0e066 Merge commit '5cb4e46cfa65bddae8ac5344540e3dd1e4c266b2'
5cb4e46cf Squashed 'docs/' changes from 540aeddc7..41aae7abb
9f5a92078 Add Hugo Modules
47953148b deps: Tidy
2fc0abd22 Fix livereload for @import case
53da3881d releaser: Remove unused function
ac101aba4 deps: Update xerrors
58a47ccde travis: Ignore errors in go mod download
95b1d3013 deps: Update Chroma
a5604e18b resource/postcss: Change postcss to check for local installation under node_modules/.bin
05d0eddd2 Merge commit '35febb2e2a3780c3338a2665fddea7dda28a17f4'
35febb2e2 Squashed 'docs/' changes from 0c3c04fd6..540aeddc7
c624a7799 tpl/collections: Add Merge function
020086cb2 Add org to front matter formats
8524baee1 deps: Update go-org
90b0127f6 Fix typo s/Meny/Menu/
7611078da hugolib: Add testfile to .gitignore
b2a3d4644 tpl/tplimpl: Regenerate templates
88c8a15be Pagination - do not render href if no next item
59c4bc52e Include path to source page in non-relative ref/relref warning
dc1d4a920 hugolib: Add another site benchmark
de7b9475c commands: Remove comma after URL in new site output
d6ca728ff deps: Revert to an older version of Blackfriday
ff10aa522 examples: Update link to prevent redirect
9f258d2b8 examples: Update URLs
31c9c690f releaser: Update Go Releaser and consolidate the 2 configs
e8a716b23 tpl/collections: Fix slice type handling in sort
3e6cb2cb7 hugolib: Fix bundle path when slug is set
8d898ad66 tpl/collections: Unwrap any interface value in sort and where
fad183c4a Refactor Org mode front matter: Introduce '#+KEY[]:' array notation
b6867bf80 Improve Org mode support: Replace goorgeous with go-org
9df57154e deploy: Default --target to the first deployment target
35abce27c Add safety barrier between concatenated javascript resources
8914fe7ed Update CLI doc for "long" form
b0f536fb2 Drop dashes in http header matcher attributes; other changes from code review
1384d77a0 docs: Add documentation for "hugo deploy"
5e83f4256 deploy: remove TODO comment about subfolders; handled by GoCDK blob URLs
b376b2685 deps: Update gocloud.dev to v0.15.0.
fb007e9ae tpl/collections: Convert numeric values to float64 and compare them
4c560020b resources: Return nil when not found in resources.Get
d44d3ea89 deps: Update Viper
d1cf53f5f Remove references to Google+
811ee996a Update gitmap to get CommitDate field
4f61a926f Merge commit 'be04ece8590f775a52ea167fbe4555753e8c5211'
be04ece85 Squashed 'docs/' changes from 50c02516c..0c3c04fd6
5b4b8bb3c commands: Create new 'hugo list all' command
2278b0eb0 Medium -> Hugo exporting tool
41974303f dockerfile:  Switch base image for final build
6b3f1a100 Merge branch 'release-0.55.6'
fa8e334da releaser: Prepare repository for 0.56.0-DEV
a5d4c82d2 releaser: Add release notes to /docs for release of 0.55.6
32f4b3833 releaser: Bump versions for release of 0.55.6
9b48c5d6b Release 0.55.6
8a1873a2d releaser: Add release notes draft for 0.55.6
95ce2a40e hugolib: Prevent parallel server rebuilds
e22b3f54c tpl: Fix internal templates usage of safeHTMLAttr
71b8d8b6a Update to Go 1.12.5 and Go 1.11.10
5dc6d0df9 deploy: Add tests; fix Windows
527cf1ab0 deploy: Support configuration of upload order
f4956d9aa deploy: Support invalidating a CloudFront CDN cache
2838d58b1 i18n: Move the package below /langs
f330e869e deploy: compute MD5 by reading if List didn't provide one
f2b5d4de3 Revert docs/config.toml changes
0091b1f89 travis: Use proxy.golang.org
c7165589b Add a "deploy" command
ad5703a91 hugolib: Disable racy test
f94a388ad releaser: Prepare repository for 0.56.0-DEV
a83256b9c releaser: Add release notes to /docs for release of 0.55.5
77ad1336d releaser: Bump versions for release of 0.55.5
e33ed29b7 Release 0.55.5
2fb708d3d releaser: Add release notes draft for 0.55.5
cee181c3a docs: Regenerate docs helper
b1d438ea2 Merge commit 'f147b5c53eda15982e0fe762847532eeddb7485f'
f147b5c53 Squashed 'docs/' changes from 13097daf2..50c02516c
6b76841b0 output: Fix permalink in sitemap etc. when multiple permalinkable output formats
bcbed4ebd hugolib: Fix PrevInSection/NextInSection for nested sections
009076e5e lazy: Fix concurrent initialization order
1cbb501be Update blackfriday to v1.5.2
66b143a01 tpl/compare: Fix nil compare in eq/ne for interface values
4f93f8c67 tpl: Fix hugo package name and add godocs
f76e50118 tpl: Provide more detailed errors in Where
f84df16fe releaser: Prepare repository for 0.56.0-DEV
579004178 releaser: Add release notes to /docs for release of 0.55.4
f2fbca23a releaser: Bump versions for release of 0.55.4
1707f1a5f Release 0.55.4
211d66797 releaser: Add release notes draft for 0.55.4
33c738116 hugolib: Fix shortcode version=1 logic
69a56420a hugolib: Avoid recloning of shortcode templates
4756ec3cd i18n: Avoid rebuilding the Translations map for every lookup
4c3c51203 commands: Init mem profile at the end
0775c98e6 hugolib: No links for bundled pages
1477fb33c releaser: Prepare repository for 0.56.0-DEV
993b84333 releaser: Add release notes to /docs for release of 0.55.3
a9ee2ab58 releaser: Bump versions for release of 0.55.3
c85b726f8 Release 0.55.3
89cf7a3f4 releaser: Add release notes draft for 0.55.3
75b16e30e docs: Regenerate docs helper
0508ca185 Merge commit 'a0c28c943c2f4714fa340b22a583b96f5013090b'
a0c28c943 Squashed 'docs/' changes from 0f2bf195e..13097daf2
c7dd66bfe Fix links for non-HTML output formats
7aeeb60d7 hugolib: Add some OutputFormats.Get tests
ea529c847 Fix menu URL when multiple permalinkable output formats
6c80acbd5 hugolib: Add some integration tests for in/uniq using Pages
7fbfedf01 tpl/collections: Return error on invalid input in in
06f56fc98 tpl/collections: Make Pages etc. work with the in func
d7a67dcb5 tpl/collections: Make Pages etc. work in uniq
3e421bd47 commands: Replace IsDraft with Draft in list command
102876033 releaser: Prepare repository for 0.56.0-DEV
9d0203488 releaser: Add release notes to /docs for release of 0.55.2
ccfbb63d1 releaser: Bump versions for release of 0.55.2
fcd63a865 Release 0.55.2
7ace59d5b releaser: Add release notes draft for 0.55.2
35f41834e hugolib: Add more tests for Permalinkable
9b17cbb62 hugolib: Fix Pages reinitialization on rebuilds
2957795f5 tpl/tplimpl: Handle late transformation of templates
56550d1e4 hugolib: Fix shortcode namespace issue
7881b0965 hugolib: Fix false WARNINGs in lang prefix check
49d0a8264 hugolib: Fix bundle resource publishing when multiple output formats
b799b12f4 hugolib: Fix panic for unused taxonomy content files
701486728 hugolib: Fix dates for sections with dates in front matter
f2795d4d2 Fix WeightedPages in union etc.
e85c057f9 releaser: Prepare repository for 0.56.0-DEV
223b3c2ee releaser: Add release notes to /docs for release of 0.55.1
7ca15c7dd releaser: Bump versions for release of 0.55.1
adb776b22 Release 0.55.1
5efdd14eb releaser: Add release notes draft for 0.55.1
8d7607aed hugolib: Add a test for parent's resources in shortcode
4d425a86f Fix
9e9a1f92b hugolib: Fix simple menu config
f7375c497 Fix paginator refresh on server change
7966c0b5b Remove the space in `. RelPermalink`
cc98fc8ad Merge commit '8b73644d81a81e82851b7f7c90aa8ab5524fbe93'
8b73644d8 Squashed 'docs/' changes from acf70cdd9..0f2bf195e
3b86b4a9f resources/page: Fix .RSSLinke deprecation message
27a8049da tpl/tplimpl: Replace deprecated .GetParam usage
ee4274244 releaser: Prepare repository for 0.56.0-DEV
4333cc77f releaser: Add release notes to /docs for release of 0.55.0
452cdcd7c releaser: Bump versions for release of 0.55.0
05d614e13 Release 0.55.0
018cd0c9d releaser: Add release notes draft for 0.55.0
612a06f06 Misc paginator adjustments
3db4a1cf7 Update to Go 1.12.2 and Go 1.11.7
f34e6172c hugolib: Log warning on relative front matter url with lang
708d4ceeb Adjust rlimit logic
ed65bda3b docs: Add information about summary front matter variable
3a62d5474 hugolib: Consider summary in front matter for .Summary
ebab291c0 resources/page: Regenerate JSON wrapper
75467cd78 resources/page: Add missing GitInfo to Page
d1553b4b0 integrity: Add support for sha384
1d9dde82a hugolib: Fix default date assignment for sections
87b16abd9 Add HUGO_NUMWORKERMULTIPLIER
415ca9673 hugolib: Fix the GOMAXPROCS env get
8559f5c29 Use YAML for the benchmark compare
e2dc432fe hugolib: Fix benchmark for YAML front matter
950295516 hugolib: Buffer the render pages chan
032e6802d deps: Update to imaging v1.6.0
d0d661dff hugolib: Re-work "fast render" logic in the new flow
4494a01b7 metrics: Adjust the howSimilar logic vs strings
e91e222cd resources/page: Implement compare.ProbablyEqer for the core slices
5185fb065 hugolib: Allow relative URLs in front matter
92baa14fd hugolib: Allow page-relative aliases
a55640de8 tpl: Allow the partial template func to return any type
9225db636 releaser: Remove version replacement in docs config
f7ef7d376 releaser: Adjust patch vs images logic
f9d6feca0 hugolib: Fix alias path for AMP and similar
439ab0339 resources: Fix image publish ordering issue
b6a60f718 output: Add missing JSON tag
bfdc44964 docs: Regenerate docshelper data
cc8515f18 deps: Update Chroma
8bfd3a54a hugolib: Add a simple test for jsonify of Site
bb533ca5e docs: Regenerate CLI docs
876e5f67b Merge commit 'c2037f0c9a3a35b9db9c404f6b5f94ec8b690a53'
c2037f0c9 Squashed 'docs/' changes from 4f4d1f48c..acf70cdd9
9bc6187b8 hugolib: Do not fall back to site title if not set in content file
10bb614a7 deps: Update Afero
bceda1b28 hugolib: Add a test for home page with no title
4dae52af6 Avoid nilpointer on no File on Page
794d4052b herrors/errors: Improve the "feature not available" error
a7ee9b0bb hugolib: Add String() to fileInfo
91ef9655a resources/page: Re-introduce .Page.Page
b5f39d23b all: Apply staticcheck recommendations
3011f36c2 hugolib: Remove unused slice
d30e84548 Run gofmt -s
597e418cb Make Page an interface
44f5c1c14 List future and expired dates in CSV format
984a73af9 Update to Go 1.12.1 and Go 1.11.6
e54213f52 tpl/tplimpl: Fix mutex unlock
4a2a8afff commands: Fix doLiveReload logic
79d517d86 deps: Update Viper
34c49d788 hugolib: Adjust site benchmark
b9e75afd6 Update to Go 1.12
dfc72d61a Remove Gitter dev chat link
02eaddc2f tpl/tplimpl: Fix template truth logic
bdf47e8da Update Travis config to work for forked builds
75904332f Add skipHTML option to blackfriday config
60c0eb4e8 Update stretchr/testify to 1.3.0.
c154c2f7b Rewrite relative action URLS
075b17ee1 Support Docker args TAGS, WORKDIR, CGO; speed up repetitive builds
b4148cd1d hugolib: Adjust test for Go 1.12
908692fae Support nested keys/fields with missing values with the `where` function
7e4b18c5a commands: Update debouncer version
483cf19d5 common/herrors: Fix args order in strings.TrimPrefix
720104294 tpl: Fix strings.HasPrefix args order
5383fe458 releaser: Prepare repository for 0.55.0-DEV
b1a82c61a releaser: Add release notes to /docs for release of 0.54.0
6fe6b9c17 releaser: Bump versions for release of 0.54.0
52cec0fb2 Release 0.54.0
23e52ea4c releaser: Add release notes draft for 0.54.0
9b619dc02 releaser: Adjust patch logic
fab41f42d common/hugo: Use official semver even for main releases
f27faf9af Squashed 'docs/' changes from 49809a038..4f4d1f48c
c7c66e664 Merge commit 'f27faf9afd0a8db768a21954b8755f1bf1a14f1b'
5e078383a Squashed 'docs/' changes from 785e375f..49809a03
ddc15ed41 Merge commit '5e078383a787e8b5ec3ba73f05ea4130840afbe2'
ddc6d4e30 tpl/data: Adjust tests
6a2bfcbec tpl/data: Prevent getJSON and getCSV fetch failure from aborting build
59d87044a commands: Add test for --configDir
3244cb3b3 Ignore unknown config files in config dir
d9282cf98 Store supported config formats in a variable
c52045bbb Fix some inline shortcode issues
8ed2a1caa Bump to Go 1.11.5
e85961390 Update Afero
2a9060a85 hugolib: Expand TestPageWithEmoji to cover '+', '-' and '_' too
3038464ea Accept hyphen and plus sign in emoji detection
526b5b1c4 Fix OpenGraph image fallback to site params
26f75edb7 Support numeric sort in ByParam
e1a66c734 Fix Params case handling in the new site global
db3c49d04 Make hugo server -t work again
e3cb8e6c7 Add configFile(s) back to the watch list after RENAME event too
55251aa89 Remove historical rssURI config
843fcd19d Use subtests with server_test.go
ce8a09a4c resources: Move resource interfaces into its own package
669ada436 resource: Move resource processors into sub-packages
507451229 Update _index.md
40ffb0484 hugolib: Restore 0.48 slash handling in taxonomies
4bae8b04a Revert " Fix handling of taxonomy terms containing slashes"
0584432b0 Update go.sum
65fa06927 Revert "hugolib: Restore taxonomy term path separation"
9e4f9e0bb tpl: Fix reflect
3f3187de0 cache/namedmemcache: Fix data race
cc351958e Update Chroma
c24f3ae22 Make docshelper run again
214e9745b releaser: Use Git short commit in release binaries
ecc892275 releaser: Bump Goreleaser version
22afe2804 Merge commit '978856e2ad12d2bcaf37bb9e31f806b30a4c42f4'
978856e2a Squashed 'docs/' changes from bd91d1cfd..785e375f5
843187120 releaser: Prepare repository for 0.54-DEV
8fc339dc2 releaser: Add release notes to /docs for release of 0.53
5236cb8e9 releaser: Bump versions for release of 0.53
a28865cfc release: Fix goreleaser config
cb6c77b81 Release 0.53
be58c7b9c tpl/transform: Include options in cache key
62d031aed docs: Adjust CSV example
ce06bdb16 Rename CSV option from comma to delimiter
2efc1a64c docs: Document transform.Unmarshal
25ddbb09f hugolib: Adjust test
e691c48a5 docs: Regenerate CLI docs
094709e10 tpl/transform: Simplify transform.Unmarshal func
a57446979 Add CSV support to transform.Unmarshal
822dc627a tpl/transform: Add transform.Unmarshal func
43f9df019 Prevent resource publishing for transformed inline resources
102171444 hugolib: Add .Name as a shortcode variable
5a83bf314 Squashed 'docs/' changes from d1cf9adc4..bd91d1cfd
6f069e549 Merge commit '5a83bf314f4c0ce1d61341e0a1df21c9998e8154'
0483299bc hugolib: Improve logic of output path trimming
27b62a546 snap: Revert build-snap to 1.11/stable channel for go
35bfca3b1 commands: Remove the benchmark command
9cd54cab2 Move the emoji parsing to pageparser
a8853f1c5 parser/pageparser: Split the page lexer into some more files
4d93aca27 hugolib: Enable Emoji in site benchmark
f2167de83 parser/pageparser: Add a benchmark
64b6b2907 tpl: Fix case handling in cast params
bb9c2988f Update to Go 1.11.4
c04030b14 releaser: Get ldflags for build date etc. in line for all builds
f7691fe96 transform/urlreplacers: Simplify implementation
efe0b4e5c transform/urlreplacers: Support unquoted URLs in canonifyURLs replacer
d5a0b6bbb hugolib: Remove "double layout" lookup
5178cd13a Fix "failed to create file caches from configuration: file exists" on Windows
9ce0a1fb7 hugolib: Restore taxonomy term path separation
ab9214768 importer: fix jekyll import highlight options
506868170 docs: Regenerate CLI docs
b17a61a60 Merge commit 'eb16165694f868d73e57b6aed5c26ba5e98229de'
eb1616569 Squashed 'docs/' changes from 37095d540..d1cf9adc4
782947408 Add /config dir support
256418917 resource/image: Fix "always false" condition
c84f506f8 tpl: Add reflect namespace
4b5f74395 minifiers: Fixx CSS2 color code handling
931a13245 tpl/hugo: Use the correct Hugo var
837835885 hugolib: Add .Site.Sites
831d23cb4 Add tpl/site and tpl/hugo
514e18dc2 cache/filecache: Simplify test
b804a7088 cache/filecache: Use OS fs for test
30a7c9ea3 tpl: Add godoc packages comments
834684810 common/collections: Fix defines typo
54ecade02 releaser: Prepare repository for 0.53-DEV
9433cf5a9 releaser: Add release notes to /docs for release of 0.52
3c909eb3f releaser: Bump versions for release of 0.52
724b3e673 Release 0.52
056c75477 releaser: Add release notes draft for 0.52
a9a93d082 hugolib: Fall back to title in ByLinkTitle sort
b09a40333 hugolib: Improve nil handling in IsDescendant and IsAncestor
7540a6283 parser/pageparser: Fix handling of commented out front matter
7e75aeca8 Remove duplicate mapstructure depdendency
e14e0b192 Add dependency list to README
ed698e94c tpl/path: Add tests
89e2716d2 tpl: Regenerate templates
aba2647c1 tpl: Fix whitespace issue
f37c5a256 tpl: Add "param" shortcode
aded0f25f docs: Document inline shortcodes
bc337e6ab Add inline shortcode support
112461fde tpl/collections: Add float64 support to where
94ab125b2 parser/pageparser: Fix when only shortcode and then summary
dcfeed35c commands: Include drafts in convert command
f9b4eb4f3 Handle themes in the new file cache (for images, assets)
e82b2dc8c Fix ignored --config flag with 'new' command
5df2b79dd Fix Permalink for resource, baseURL with path and canonifyURLs set
12742bac7 Add tests for permalink on Resource with baseURL with path
fabf026f4 helpers: Add a comment about file mode for new files
94f0f7e59 cache/filecache: Add a :project placeholder
3c29c5af8 cache/filecache: Add a cache prune func
33502667f cache/filecache: Add a filecache root dir
d3489eba5 cache/filecache: Use time.Duration for maxAge
17d7ecde2 cache/filecache: Split implementation and config into separate files
e4b257288 Update to LibSASS 3.5.5
782dd1585 More spelling corrections
aff9c0916 cache/filecache: Spelling corrections
fdd4a768f Remove appveyor
abeeff132 docs: Document the new file cache
f7aeaa612 Add a consolidated file cache
7d78a2afd Add Windows build config to Travis
5570a6e47 Revert "Add Elasticsearch/bonsai.io to services doc."
c0b3a1af0 Add Elasticsearch/bonsai.io to services doc.
a8cb1b07b tpl: Fix test to pass with gccgo
2900801ac releaser: Prepare repository for 0.52-DEV
f3d519079 releaser: Add release notes to /docs for release of 0.51
1ccc0b79a releaser: Bump versions for release of 0.51
cbed50e22 Release 0.51
05ecd8111 releaser: Add release notes draft for 0.51
e456e34bd docs: Document shortcode error handling
5d14d04ac docs: Document symdiff
ddcb40285 docs: Document complement
3a44920e7 hugolib: Improve error message on duplicate menu items
79a06aa4b tpl/collections: Properly handle pointer types in complement/symdiff
d212f6094 deps: Update minify
488776b64 tpl/collections: Add collections.SymDiff
b8b8436fc hugolib: Fix changing paginators in lazy render
42d8dfc8c tpl/collections: Add collections.Complement
47506d164 commands: Fix spelling
2998fa0cd docs: Re-generate CLI docs
d16a7a33f Fix shortcode directly following a shortcode delimiter
5b1edd281 commands: Add --minify to hugo server
2bd9d9099 commands: Fix recently broken error template
4b7d3e57a Make WARN the new default log log level
4f3c09596 Revert "tpl: Update Jsonify to return pretty-print output"
486bc46a5 docs: Regenerate the docs helper
61f210dd7 tpl: Fix the docshelper
f8446188d Skip watcher event files if matched in ignoreFiles
d523aa4bb deps: Update Chroma
b8725f518 Fix ANSI character output regression on Windows
0bc4b0246 hugolib: Remove deprecated useModTimeAsFallback
faeb55c1d hugolib: Bump to ERROR for the deprecated Pages.Sort
6c6a6c87e hugolib: Deprecate .Site.Ref and .Site.RelRef
1d18eb057 Add file (line/col) info to ref/relref errors
33a7b36fd hugolib: Add .Position to shortcode
6180c85fb hugolib: Fix REF_NOT_FOUND logging to include page path
d3a98325c common/loggers: Improve log color regexp
b2a676f5f hugolib: Fix broken manual summary handling
3a786a248 tpl: Fix BOM issue in templates
729593c84 hugolib: Fix deadlock when content building times out
e65268f2c Correct minor typo (#5372)
f863b6a07 releaser: Prepare repository for 0.51-DEV
f5be59920 releaser: Add release notes to /docs for release of 0.50
b14c11b0e releaser: Bump versions for release of 0.50
0addb2add Release 0.50
8bba85601 releaser: Add release notes draft for 0.50
7082a5d14 Update go.sum
aa281b513 mod: Update minify
325019872 docs: Regenerate CLI docs
d6a4af701 Squashed 'docs/' changes from 084804447..37095d540
27569275b Merge commit 'd6a4af7018e8618944a6471ceeb7aae1d4df6afa'
4b2738d87 Merge commit '74309fe5699a595080fdb3a14711e0869babce99'
74309fe56 Squashed 'docs/' changes from e5e98b950..084804447
9c88a8a55 common/loggers: Make sure the global logger also gets colored labels
95e72f5e8 i18n: Avoid using the global logger
1c7b7b4ef common/loggers: Add color to ERROR and WARN
1ad117cbe common/herrors: Make the file error log format configurable
dac7092a9 common/collections: Allow a mix of slice types in append/Scratch.Add
b27ccf34b resource: Allow .Data.Integrity to be accessed on its own
286d0b7dc Revert "mod: Update minify"
83c873ff3 mod: Update minify
a2440dc0e mod: Update cast
1e9ac3dcc commands: Truncate the error log on repeated config errors
40e99672b docs: Regenerate CLI docs
3a3badfd1 resource: Serialize image processing
df021317a commands: Only show Ansi escape codes if in a terminal
78578632f Fix archetype handling of directories in theme
6b78b3810 Revert "commands: Read disableFastRender from flag even if it's not changed"
78a4c2e32 commands: Read disableFastRender from flag even if it's not changed
d4ebfea1f comamnds: Use overflow-x: auto; for browser errors
93aa6261b common/loggers: Remove the ANSI color for the browser error version
acc14b464 hugolib: Adjust error test to make it pass on Go tip
2d7709d15 tpl: Handle truncated identifiers in Go template errors
deff9e154 Add some color to the relevant filenames in terminal log
889aca054 Run gofmt -s
e3ed4a83b hugolib: Rename some page_* files
6636cf1be Resolve error handling/parser related TODOs
f669ef6be herrors: Improve handling of JSON errors
ed7b3e261 commands, hugolib: Get file context in "config parse failed" errors
2bf686ee2 hugolib: Improve errors in /i18n handlling
9f74dc2a5 hugolib: Improve errors in /data handlling
d1661b823 hugolib: Continue the file context/line number errors work
7930d2132 hugolib: Remove the now superflous Source struct
eb038cfa0 Convert the rest to new page parser code paths
129c27ee6 parser/metadecoders: Consolidate the metadata decoders
44da60d86 hugolib: Redo the summary delimiter logic
1e3e34002 hugolib: Integrate new page parser
1b7ecfc2e hugolib: Use []byte in shortcode parsing
27f5a906a parser/pageparser: Use []byte in page lexer
2fdc4a24d parser/pageparser: Add front matter etc. support
f6863e1ef parser/pageparser: File renames and splitting
d6c16afde Move the shortcode parser to the new pageparser package
6f3716dc2 commands: Avoid panic in error handler on config errors
5a52cd5f9 tpl: Update Jsonify to return pretty-print output
4a366fcfe Prevent stale content in Fast Render Mode
083311d03 hugolib: Fix test on Windows
0fe4ff187 tpl: Improve the Execute panic error message
1f42e47e4 Allow date and slug from filename for leaf bundles
35fbfb19a commands: Show server error info in browser
3a3089121 Simple doc fix in CONTRIBUTING.md
c21e5179c tpl: Use .Lastmod in embedded schema template
a205f24ba Revert "commands: Add .gitignore "hugo new site""
92979d928 commands: Add .gitignore "hugo new site"
0a3340e95 resource: Optimize integrity string generation
6b21ac3e6 commands: Add help text to "hugo new"
d14420539 snap: Set "extended" tag based on build_url on Launchpad
3d4a9882b helpers: Call rst2html directly on *nix
bdca97279 Update URLs to stop 301 redirects
604ddb90c Merge branch 'release-0.49.2'
b09e495a7 releaser: Prepare repository for 0.50-DEV
42cde6666 releaser: Add release notes to /docs for release of 0.49.2
ad60948c4 releaser: Bump versions for release of 0.49.2
c397f2c08 Release 0.49.2
b9e18e20c releaser: Add release notes draft for 0.49.2
2159d77f3 common/collections: Fix type checking in Append
535755e4f common/collections: Fix type checking in Append
3583dd6d7 Merge branch 'release-0.49.1'
e5b4cb241 releaser: Prepare repository for 0.50-DEV
821adf3ae releaser: Add release notes to /docs for release of 0.49.1
8ba9a2736 releaser: Bump versions for release of 0.49.1
235acf223 Relase 0.49.1
ac0fac934 releaser: Add release notes draft for 0.49.1
23f48c300 common/maps: Improve append in Scratch
e2201ef15 tpl/collections: Fix handling of different interface types in Slice
b5e17f7c8 Add GOPATH Hugo building tip
31a8bb8c0 common/maps: Improve append in Scratch
8e825ddf5 Revert "tpl: Fix baseof.html in error message"
646a52a5c tpl: Fix baseof.html in error message
e421696d0 helpers: Consolidate MakeSegment vs MakePathSanitized
4b4af2c52 hugolib: Use stdlib context package
fae48d745 hugolib: Normalize permalink path segments
06d28a464 hugolib: Fix FuzzyWordCount test error message
681817030 Render Markdown in figure shortcode "caption" and "attr" params
c5279064d Re-organize the figure shortcode for better readability
152cffb13 Update README & CONTRIBUTING
0d5110d03 tpl: Cast IsSet key to int for indexed types
d3b81ee58 hugolib: Improve error message for bad taxonomy weights
1fd30d462 hugolib: Cast taxonomy weight parameters to int
498d62995 hugolib: Allow nil to be unwrapped as *Page
10ac2ec44 tpl/collections: Fix handling of different interface types in Slice
ce264b936 tpl: Add a delimiter parameter to lang.NumFmt
91f49c070 snap: Add custom x-nodejs plugin to support ppc64el and s390x
a475bf125 snap: Fetch mage with GO111MODULE=off
f1dede370 snap: Revert 'Skip "mage -v test" due to build failure on Launchpad'
fa873a6cb snap: Use build-snaps instead of building go from source
fb732d532 hugolib: Be a litle more specific in NextPage TODO
ad705aac0 hugolib: Introduce Page.NextPage and Page.PrevPage
52ac85fbc snap: Skip "mage -v test" due to build failure on Launchpad
048a64be1 releaser: Update path to snap/snapcraft.yaml
3033a9a37 snap: Fix go plugin build failure by renaming go.mod
27d421118 snap: Move snapcraft.yaml to snap/snapcraft.yaml
4730a78a7 snapcraft: Try installing postcss again
b7706d6ae snapcraft: Set GO111MODULE=on in override-build script
48413d76f build: Update the temp docker script
66b9e2bff releaser: Prepare repository for 0.50-DEV
398996e8b releaser: Add release notes to /docs for release of 0.49
7f005f5e9 releaser: Bump versions for release of 0.49
011e3aaa9 Release 0.49
369744845 docs: Document directory based archetypes
2638b04c6 releaser: Add release notes draft for 0.49
cf47f43ff ci: Add "go mod download" to CI scripts
3b6bd1210 docs: Regenerate CLI docs
8388cd90e docs: Document group
807c55192 Squashed 'docs/' changes from 6b00298bb..e5e98b950
bc57f5c36 Merge commit '807c551922707fc5ae0eb26e8f01638c0c63fdb3'
fe6a6f273 resource/integrity: Make Data.Integrity be of type template.HTMLAttr
2650fa772 Add directory based archetypes
ef525b15d Build on CircleCI outside of GOPATH
f91681469 Prevent symbolic links from themes
cae07ce84 tpl/collections: Allow first function to return an empty slice
4f9c109dc tpl/opengraph: Use safeHTMLAttr instead of safeHTML for HTML attributes
f1a00b206 hugolib: Remove deprecated rssURI
df4cbbd3b commands: Remove deprecated flags
2e2e34a93 hugolib: Deprecate Pages.Sort
2eed35c82 hugolib: Minor cleaning in the sorting code
dd692c710 hugolib: Clear the page cache per render
ed4f1edbd hugolib: Compare every element in pages cache
058cc6c2c Revert "hugolib: Normalize permalink path segments"
4b82f7484 Update releasenotes_writer.go
06976ebb8 hugolib: Normalize permalink path segments
555a5612b hugolib: Do not set RSS as Kind in RSS output
75e54345f hugolib: Make sure ambiguous lookups in GetPage gets an error
df50c108b docs: Add docs for append
e27fd4c1b tpl/collections: Add collections.Append
b7ca3e1b3 Merge commit '13e64d72763bf8d6d92d4cdfc15ed45ee9debfab'
13e64d727 Squashed 'docs/' changes from 9b494a58c..6b00298bb
9b26b5487 minifiers: Set minifier to KeepEndTags
3dafe206e minifiers: Make JSON minification more generic
37d646347 Update Mage
43d446522 tpl/data: Revise error handling in getJSON and getCSV
4f72e7912 tpl: Show error on union or intersect of uncomparable types
fe6676c77 tpl/collections: Improve type handling in collections.Slice
7a97d3e6b tpl/collections: Allow pointer receiver in Group
6667c6d74 tpl/collections: Add group template func
cfda13b36 hugolib: Allow creating page groups from any page collection
bb2fe814c Update dependencies
e5d66074c tpl/strings: Add strings.FirstUpper
d970327d7 hugofs: Fix filepath issue in test
0013bea90 resource: Fix golint issues
30bc4ed0a Improve some godoc comments
f6f22ad94 tpl: Fix golint godoc issues
400fe96ae media: Fix golint issues
3f45e729f output: Fix golint godoc issues
ffaa73dc8 publisher: Fix golint godoc issue
f8d8c8542 langs: Fix golint godoc issue
10dc87bf8 i18n: Fix golint issue
7231869ba related: Fix golint issues
ccd328548 releaser: Fix golint issues
600047ff1 source: Fix golint godoc issues
5f2e1cb89 hugofs: Fix golint issues
c8ce65046 helpers: Fix golint issues
a53f96231 deps: Fix most golint issues
daffeec30 config: Fix golint issues
b8b91f550 common: Fix golint errors
f0effac80 commands: Fix golint issues
be3ae3ec9 hugolib: Do not FirstUpper taxonomy titles
2cf8fe2ea Fix broken Travis config
3b103cb7b Update to latest Mage
0cc936583 resource: Fix broken build
c15c7da42 resource: Remove some duplicate code
bcbe57c6e Update Dockerfile to Go 1.11
e38e88124 hugolib: Simplify some code
0665a3951 hugolib: Add missing error checks
1ed8c3633 hugolib: Remove extraneous createStaticFs call
e03eb90a3 hugolib: Fix godoc comment
c915d0d32 hugolib: Fix typo in private func name
47d4edce6 Fix error message for go vet
ea8ef573c mage: Init packages once
293e12355 appveyor: Update script to Go 1.11
fdf3c3b82 build: Remove the remains of Go Dep
312d2252b Update CONTRIBUTING.md
f627903ef Update README.md
a2f0f9d47 snapcraft: Update to work with Go Modules
1ff54ab3d releaser: Prepare repository for 0.49-DEV
456f5476c releaser: Add release notes to /docs for release of 0.48
09811d0be releaser: Bump versions for release of 0.48
d351ac2e6 Release 0.48
59f57900a releaser: Add release notes draft for 0.48
59cdad325 release: Fix CircleCI script
6022f219f hugolib: Only run variable variable overwrite test on Go 1.11
0c8a41548 hugolib: Add a test for template variable overwrite
f4675fa0f helpers: Fix permissions when creating new folders
ebb56e8bd Improve minifier MIME type resolution
6b9934a26 circleci: Update to Go 1.11
c7f057797 travis: Set GO111MODULE=on for mage install
08d14113b resource: Add instruction to install PostCSS when missing
94d6d6780 Update snapcraft build config to Go 1.11
45c9c45d1 Use Go 1.11 modules with Mage
fce32c07f Add go.mod
d32ff16fd Update Travis to Go 1.11 and Go 1.10.4
e6eda2a37 minfiers: Keep end tags
66f688f71 snap: Skip installing postcss due to failure on build server
2c934be8a snap: Refactor, fix bin/node, and add bin/postcss
94d0e79d3 hugolib: Include language code in REF_NOT_FOUND errors
b9a503feb tpl/tplimpl: Make the autogenerated templates collapsed in PRs
fff132537  Fix handling of taxonomy terms containing slashes
8999de193 Fix build on armv7
a81c64e43 releaser: Prepare repository for 0.48-DEV
7ef509625 releaser: Add release notes to /docs for release of 0.47.1
16b691a87 releaser: Bump versions for release of 0.47.1
aefd9a80a Release 0.47.1
57ace857a releaser: Add release notes draft for 0.47.1
fdff0d3af tpl/tplimpl: Fix .Site.Params case regression
834617f9f snap: Remove unused files from Git, Perl, etc.
ef20ec1fb snap: Add nodejs to allow PostCSS to work
5a0ee2b93 minifiers: Do not strip IE conditional statements
674682668 releaser: Prepare repository for 0.48-DEV
caf608d56 releaser: Add release notes to /docs for release of 0.47
6711dacde releaser: Bump versions for release of 0.47
de2329348 releaser: Work around a Goreleaser bug
918177ac2 Release  0.47
83a980d29 releaser: Add release notes draft for 0.47
4a16b5f4b docs: Regenerate CLI docs
a95896878 Squashed 'docs/' changes from d88477eb3..9b494a58c
873f8805c Merge commit 'a95896878f4b4a79448b39ce93a4e0d3258b4a43'
374387577 tpl/tplimpl: Fix compiling Amber templates that import other templates
baa62d0ab hugolib: Adjust tests for shortcode p-issue
78c99463f hugolib: Fix shortcode output wrapped in p
abc54080e Add configFile(s) back to the watch list after REMOVE event
a655e00d7 commands: Gracefully handle typos in server config when running the server
9d973004f hugolib: Fix image cache-clearing for sub-languages
224754601 hugolib: Force render of any changed page, even in Fast Render Mode
d139a037d hugoblib: Fix "adding a bundle" in server mode
0a88741fe hugolib: Fix error when deleting a bundle in server mode
d999b4e82 Revert "releaser: Revert to the old versions of the release pipeline"
20148345a releaser: Fix goreleaser config
e5052f4e0 commands: Include theme name in version mismatch error
c81fbf462 minifiers: Make the JS minifier matcher less specific
a6f199f7a hugolib: Use the interface value when doing Related search
0dd06bdac hugolib: Fix Related when called from shortcode
5c5384916 tpl/tplimpl: Reimplement the ".Params tolower" template transformer
56c61559b Only duplicate resource output in multihost mode
78f8475a0 Fix Resource output in multihost setups
c09ee78fd tpl: Suppress blank lines from opengraph internal template
f6ae436c5 publisher: Close file when done
2182ecfd3 hugolib: Fix GitInfo when multiple content dirs
e85833d86 hugolib: Add multiple content dirs to GitInfo test site
43a5aaa77 Fix broken tests
1639fd20d Merge commit '3a44bf182fed5f34621f450114083a6dd7e88a07'
3a44bf182 Squashed 'docs/' changes from 81847981f..d88477eb3
c2a674139 readme: https links to 3rd party sites
06bd01364 Update alias.go
755d1ffe7 tpl/tmplimpl: Add MIME type to embedded JS
fb3cb05cc resource: Remove test debug
d07882dfb Update dependencies
7f5356717 Update Chroma
789ef8c63 Add support for minification of final output
71931b30b Remove alias of os.Stat
d40116e5f Renmae FileStat Stat
c362634b7 Fix typo
d71120852 Add fileStat to tpl/os/os
a6b1eb1e9 transform: Reduce allocation in the benchmark itself
27110133f transform: Simplify the 0 transformer case
31faf98ce releaser: Prepare repository for 0.47-DEV
f14d77384 releaser: Add release notes to /docs for release of 0.46
3aa838cf2 releaser: Bump versions for release of 0.46
a3a26597c Release 0.46
92d776b0d releaser: Add release notes draft for 0.46
e6dd54943 Merge commit '766085c2dc6fc95ac30fda2a9ebde2355fc12554'
766085c2d Squashed 'docs/' changes from a4fa0d1d6..81847981f
b5d13ca16 Update Chroma
6b02f5c0f Make resources fetched via resources.Get and similar language agnostic
88e447c44 tocss/scss: Improve _ prefix handling in SCSS imports
b718d743b Fix file paths for uncached transformed images
0ba19c57f tpl/partials: Add templates.Exists
0afa2897a tpl/partials: Remove superflous loop
f219ac09f tocss/scss: Improve SCSS project vs themes import resolution
786f72302 Fix image cache eviction for sites with subdir in baseURL
0cae1cf82 releaser: Prepare repository for 0.46-DEV
3b18042ee releaser: Add release notes to /docs for release of 0.45.1
e38843f4b releaser: Bump versions for release of 0.45.1
87f0dc14a Release 0.45.1
b7d9ab136 releaser: Add release notes draft for 0.45.1
04d4c08db hugolib: Fix .Site.GetPage regression
016dd4a69 Add Page.FirstSection
c6b599a06 hugolib: Fix "borrow content from another language" issue
3a6784b16 releaser: Prepare repository for 0.46-DEV
48d7a641d releaser: Add release notes to /docs for release of 0.45
2c5a036de releaser: Bump versions for release of 0.45
592c5b307 Update release notes 0.45
a0c4a3660 releaser: Add release notes draft for 0.45
062510cf1 Get rid of the utils package
4e1d0cd9f Update hugo_windows.go
a451c49fd hugolib: Print a WARNING about relative non-relative ref/relref matches
ff16c42ed hugolib: Allow untyped nil to be merged in lang.Merge
166483fe1 resource/scss: Add IncludePaths config option
f01505c91 resource/scss: Fix source maps on Windows
8278384b9 Increase refLinker test coverage
65e610e16 hugolib: Avoid nilpointer in absoluteSourceRef
b56d9a129 Fix typo-logic bug in GetPage
d6fde8fa1 Enable test case fixed by commit 501543d4
2bac37154 Add test coverage for recent ref overhaul
9b4b97a72 hugolib: Create an adapter from old to new getPage
501543d4b hugolib: Only do page-relative getPage for relative paths
6ffa88234 hugolib: Improve error handling in refLink
1eb8b36b3 docs: Update ref, relref, GetPage docs
00c74ee7f docs: Document refLinksErrorLevel and refLinksNotFoundURL
e25aa655f Add configurable ref/relref error handling and notFoundURL
12679b408 hugolib: Mark shortcode changes as content changes in server mode
c39ac5738 Revert "hugolib: Fix potential server panic with drafts/future enabled"
a3535c848 Squashed 'docs/' changes from cfe89ecbc..a4fa0d1d6
9da617912 Merge commit 'a3535c8486b2ce762b1a8a9c30b03985c3e02cee'
1ab4658c0 hugolib: Fix potential server panic with drafts/future enabled
75acff5f2 hugolib: Avoid server panic on TOML mistake in i18n
5c9d5413a hugolib/filesystems: Fix theme config for Work Fs
59ebc83d7 Merge commit 'b6b37a1f00f808f3c0d2715f65ca2d3091f36495'
b6b37a1f0 Squashed 'docs/' changes from f59b3ab06..cfe89ecbc
ebe4d39f1 resource/postcss: Try node_modules/postcss-cli/bin/postcss first
1b0aeeaaf commands: Disable flaky server tests on Windows CI
a4c513cae commands: Increase sleep in server teset to make it less shaky on Windows
d741064be Add optional lang as argument to rel/relref
3eb313fef Simplify .Site.GetPage etc.
b93417aa1 Unify page lookups
fd1f4a786 Fix addkit link to account for i18n
4c240800a resource/bundler: Improve error message
38204c4ab hugolib: Only set 'allThemes' if there are themes in the config file
2f2bc7ff7 resource/integrity: Remove unused code
242b297f5 releaser: Remove flag on Windows build
f44c9ab9c releaser: Prepare repository for 0.45-DEV
9f9695cf7 releaser: Add release notes to /docs for release of 0.44
0831d8cca releaser: Bump versions for release of 0.44
1d4ff024c Finish release notes 0.44
521e63ac7 releaser: Add release notes draft for 0.44
47d38628e resource: Clean up the in-memory Resource reader usage
0024dcfe3 resource: Move opening of the transformed resources after cache check
beec1fc98 resource: Fix resources.Concat for transformed resources
306573def Improve type support in resources.Concat
80c8f3b81 hugolib: Fix static filesystem for themed multihost sites
6b6dcb44a Flush partialCached cache on rebuilds
d96f2a460 resource: Include the transformation step in the error message
ac5303503 media: Only show deprecation warning when needed
b874a1ba7 media: Allow multiple file suffixes per media type
410870593 hugolib: Remove empty resources/ dir after TestNewSiteDefaultLang
9c1e82085 .gitattributes: Exclude *.svg from CRLF/LF conversion
2b73e89d6 tpl: Set permission of embedded templates to 0644
febf0aec8 Build a fully static Windows extended binary
a4fad5be6 Adjust release notes
6084f0433 releaser: Prepare repository for 0.44-DEV
cbb7214b6 releaser: Add release notes to /docs for release of 0.43
e6136b36f releaser: Bump versions for release of 0.43
659917a00 releaser: Revert to the old versions of the release pipeline
9d194ab90 releaser: Add release for 0.43
a305609e1 snap: Migrate from deprecated keywords to "override-build"
179de5f5b Revert "Consider root and current section's content type if set in front matter"
5dc1f95b6 Revert "Restrict the new type layout resolution to page and section kinds"
6bc892fc2 Revert "output: gofmt -l -w output/layout.go"
5f06dbf77 Revert "snap: Build both hugo and hugo.extended for 0.43"
0850e9798 Revert "Revert "Add Goreleaser extended config""
a3b4b10f6 Revert "Add Goreleaser extended config"
e3df6478f Bump CircleCI image
626afc982 Add Goreleaser extended config
e1027c584 snap: Build both hugo and hugo.extended for 0.43
e1a052ecb fix: nfpm replacements
bfc3488b8 Add temporary build script
ce84b524f Add "extended" to "hugo version"
3cea2932e Fix typos
0efd37480 Merge commit '98293eaa1570b5aff4452021c8b6d6c8560b3f06'
98293eaa1 Squashed 'docs/' changes from 501c6e233..f59b3ab06
2b8d907ab Add a newScratch template func
43338c3a9 hugolib: Do not create paginator pages for the other output formats
dea71670c Add Hugo Piper with SCSS support and much more
a5d0a57e6 output: Fix the shortcodes/partials vs base template detection
f465571b3 output: gofmt -l -w output/layout.go
f8212d200 tpl/collections: Return en empty slice in after instead of error
78e8a744b Restrict the new type layout resolution to page and section kinds
c790029e1 Consider root and current section's content type if set in front matter
554553c09 circleci: Update docker image
de37455ec hugolib: Allow forward slash in shortcode names
282f6035e Merge branch 'release-0.42.2'
360fa1221 releaser: Prepare repository for 0.43-DEV
02aa32003 releaser: Add release notes to /docs for release of 0.42.2
d2640fbc1 releaser: Bump versions for release of 0.42.2
1637d12e3 Release 0.42.2
3a7706b06 commands: Fix broken server-reload on config changes
2955f93fc commands: Fix broken server-reload on config changes
1f0c4e1fb Update GoReleaser config
91ab455d8 tpl: Remove some "debug info"
ca1e46efb tpl: Update internal pagination template to support Bootstrap 4
fd71fa89b Create missing head.html partial on new theme generation
b5a3aa708 Add html doctype to baseof.html template for new themes
3d5928889 Revert "tpl: Support text/template/parse API change in go1.11"
dc7bc7b4d appveyor: Disable asciidoctor for now
42ed60258 hugolib: Replace deprecated {Get,}ByPrefix with {Get,}Match
6a2968fd5 Adds .gitattributes to force Go files to LF
23d5fc82e Update to Go 1.9.7 and Go 1.10.3
8531ec7ca Update Dockerfile to a multi-stage build
9f27091e1 tpl: Support text/template/parse API change in go1.11
187621ae2 releaser: Prepare repository for 0.43-DEV
4172a835e releaser: Add release notes to /docs for release of 0.42.1
fc9738896 releaser: Bump versions for release of 0.42.1
d67e843c1 Release 0.42.1
6e33c557b releaser: Add release notes draft for 0.42.1
128f14efa hugolib: Reset the global pages cache on server rebuilds
34ee27a78 commands: Do not fail server build when /static is missing
0f1fc01ef releaser: Prepare repository for 0.43-DEV
f32ccd018 Merge tag 'v0.42'
ffb609f4a releaser: Add release notes to /docs for release of 0.42
19d91abc9 releaser: Bump versions for release of 0.42
f5c0a2b4b Release 0.42
31828026a releaser: Add release notes draft for 0.42
c74b0f8f9 docs: Update theme documentation
80949dc73 docs: Remove some files now moved
e02629f81 Merge commit 'b239595af5a9fc1fc9a1ccc666c3ab06ccc32f04'
b239595af Squashed 'docs/' changes from 0fd7b4169..501c6e233
ed4a345ef commands: Create LICENSE rather than LICENSE.md in "new theme"
9717ac7dc commands: Create _default/baseof.html in "new theme"
692ec0087 commands: Make "new theme" feedback more intuitive
d3dd74fd6 commands: Move nextStepsText() to new_site.go
80230f26a Add support for theme composition and inheritance
6464981ad hugolib: Make sure that .Site.Taxonomies is always set on rebuilds
2e6712e28 tpl: Always load GA script over HTTPS
65deb72dc tplimpl: Remove speakerdeck shortcode
dc4226a8b hugolib: Reset Page's main output on server rebuilds
bf5f10faa Reset the "distinct error logger" on rebuilds
019bd5576 tpl/strings: strings.RuneCount
c3115292a tpl: Prevent isBaseTemplate() from matching "baseof" in dir
0c6c98e40 tpl/strings: Remove overflow check in strings.Repeat
90c774908 tpl/strings: Adjust the overflow validation in strings.Repeat
13435a6f6 tpl: Add strings.Repeat
07b96d16e Fixes #4798
ceaff7caf tpl: Remove frameborder attr YT iframe + CSS fixes
b84389c5e Fix vimeo_simple thumb scaling
8de532447 Add vimeo_simple
20cbc2c78 Add a BlackFriday option for rel="noreferrer" on external links
2174525ce hugolib: A little more on shortcode ordinal
7a6192647 Add a BlackFriday option for rel="nofollow" on external links
d68367cbe fix typo instagram_simple
5241f0bae releaser: Prepare repository for 0.42-DEV
b5b36e320 dep: Update Chroma
4f0665f47 Enhance Page and Resource String()
fc8c5ad82 Merge tag 'v0.41'
171caf28a releaser: Add release notes to /docs for release of 0.41
0e77f5d4e releaser: Bump versions for release of 0.41
9e7e322de Release 0.41
06827398f releaser: Add release notes draft for 0.41
cfc5096e8 releaser: Put release notes below /en
ab02594e0 create: Provide the correct .Site object to archetype templates
c71f201fd docs: Document the GDPR Privacy Config
4ed1228d5 Fix GA anonymizeIp order
a51945ea4 Add no-cookie variants of the Google Analytics templates
7b9dbef41 Merge commit 'd2b1030060d3c91d5f9ffa3456418da16bd74f1d'
d2b103006 Squashed 'docs/' changes from e161ea09d..0fd7b4169
0bf0e1972 tpl: Remove the shortcode assets for now
1f244b802 tpl: Adjust instagram_simple margins
448081b84 Remove youtube_simple for now
1f1d955b5 Add anonymizeIP to GA privacy config
ffcf26e68 Fix broken test
9753cb59f Support DNT in Twitter shortcode for GDPR
3bfe8f4be tpl: Alias tweet shortode to twitter
6aa2c3850 Regenerate embedded templates
6d69dac9d Fix youtube_simple thumb scaling
9ad46a203 Add instagram_simple shortcode
4256de339 deps: Go fmt
bed7a0faf Remove the id from youtube_simple
35ccf06da Fix some recently broken embedded templates
4ddcf52cc Add an unified .Site.Config with a services section
353148c2b Move the privacy config into a parent
568b4335c commands: Avoid ANSI character output on Windows
14705ecea tpl: Add another class and an id to youtube_simple
69ee6b41e Make the simple mode YouTube links schemaless
88e356868 Add YouTube shortcode simple mode
2f17f9378 Do not return error on .Get "class" and vice versa in shortcodes
0a7027e2a Create SUPPORT.md
5f24a2c04 Add PrivacyEnhanced mode for YouTube to the GDPR Policy
710142016 Add RespectDoNotTrack to GDPR privacy policy for Google Analytics
f45b522eb tpl/tplimpl: Adjust GA templates
678920734 tpl/tplimpl/embedded: Wrap the relevant templates with the privacy policy disable check
0bbdef986 config: Add the foundation for GDPR privacy configuration
9bd4236e1 Show site build warning in TestPageBundlerSiteRegular
4eedb377b commands: Do not show empty BuildDate in version
b2b500f56 hugolib: Use double quotes instead of back quotes
2fb9af59c Improve markup determination logic
00e36a416 Merge branch 'release-0.40.3'
bfb774490 releaser: Prepare repository for 0.41-DEV
ecae2106b releaser: Add release notes to /docs for release of 0.40.3
315a73c9f releaser: Bump versions for release of 0.40.3
46dc006f1 Release 0.40.3
d089e9d45 releaser: Add release notes draft for 0.40.3
90d0d8309 hugolib: Fix possible .Content cut
086ae81a9 hugolib: Fix possible .Content cut
c2bb62d63 tpl/tplimpl: Move README one level up
34ad9a4f1 tpl/tplimpl: Extract internal templates
914cc85e2 Merge commit '83bef6955e014d40c0f00db9cebe09113154e999'
83bef6955 Squashed 'docs/' changes from 896bad9f4..e161ea09d
a6816db77 Fix typo
b6ededf05 Update CONTRIBUTING.md
8b03c51ea releaser: Prepare repository for 0.41-DEV
5a9d1324d releaser: Add release notes to /docs for release of 0.40.2
f1269a6d0 releaser: Bump versions for release of 0.40.2
669b3d3a9 Release 0.40.2
317d81ec4 releaser: Add release notes draft for 0.40.2
655983a22 Reset .Page.Scratch on live-reload
001a28c2f Fix .WordCount, .FuzzyWordCount, .ReadingTime when summary marker is set
391f59f99 releaser: Prepare repository for 0.41-DEV
459935b29 releaser: Add release notes to /docs for release of 0.40.1
b5dafb0f2 releaser: Bump versions for release of 0.40.1
88cb2697e Release 0.40.1
6fb2d30d2 releaser: Add release notes draft for 0.40.1
288c39643 hugolib: Fix some shortcode vs .Content corner cases
44e47478d releaser: Prepare repository for 0.41-DEV
c7e59367d releaser: Add release notes to /docs for release of 0.40
3aed26837 releaser: Bump versions for release of 0.40
7ef118392 Release 0.40
2e77cc07a releaser: Add release notes draft for 0.40
402f6788e hugolib: Add .Page.BundleType
3decf4a32 hugolib: Add zero-based Ordinal to shortcode
24c662ce6 hugolib: Defer the unlock in orderedMap.Add
a215abf70 Squashed 'docs/' changes from 76e881257..896bad9f4
474bad34c Merge commit 'a215abf70e018f4bf40d6c09d8bd148d8684b33d'
85535084d hugolib: Process and render shortcodes in their order of appearance
19084eaf7 hugolib: Init the content and shortcodes early
47e7788b3 tpl/path: Add path.Ext, path.Dir and path.Base
51af1d2ea tpl/os: Make fileExist use the same filesystem as readFile
1b9dc52ef Merge commit 'd2ec1a06df8ab6b17ad05cb008d5701b40327d47'
d2ec1a06d Squashed 'docs/' changes from f9a5dc59b..76e881257
4d26ab33d Make .Content (almost) always available in shortcodes
d6a2024e6 Revert "Improve .Content vs shortcodes"
d6982ac0a Revert "hugolib: Prepare child page resources before the page itself"
3238e14fd hugolib: Prepare child page resources before the page itself
47c05c47e Add language merge support for Pages in resource.Resources
e590cc26e Improve .Content vs shortcodes
74520d2cf Improve .Get docs
e2b277bba Update missing positional parameter test for .Get
236f0c840 .Get doesn't crash on missing positional param fixes #4619
cd6a26124 .Get function: fix syntax signature
d681ea55a Improve error message in metadata parse
a96ad5c21 hugolib: Fix broken test
159bed34c parser: Add some context to front matter parse error
5cc944ffd Updated GetCSV error message (#4636)
89d2cf49a releaser: Prepare repository for 0.40-DEV
933a16b10 releaser: Add release notes to /docs for release of 0.39
60845a5a0 releaser: Bump versions for release of 0.39
9a39146ed releaser: Fix LICENSE vs LICENSE.md
1a6a0fa6f Release 0.39
936fc76ad releaser: Add release notes draft for 0.39
f21b827f7 commands: Re-add the missing releaser command
7c597c7d7 Merge commit '047c4188dfc854f658d16f1e4a9501f9c97a31c7'
047c4188d Squashed 'docs/' changes from d9c8fc220..f9a5dc59b
e136c26d0 Remove old LICENSE.md
dd4827749 Add a GitHub compatible Apache 2 license text
4dba6ce15 tpl/urls: Add anchorize template func
880ca19f2 tpl/path: Add path.Join
01b72eb59 tpl: Add path.Split template func
61d52f146 hugolib: Do not reset .Page.Scratch on rebuilds
0e7716a42 resource: Implement Resource.Content
417c5e2b6 Make Page.Content a method that returns interface{}
94c8b29c3 source: Remove deprecated File.Bytes
1b4e0c416 commands: Remove accidental and breaking space in baseURL flag
27a524b09 commands: Properly handle CLI slice arguments
bede93de0 commands: Correctly handle destination and i18n-warnings
2aab6dee8 commands: Fix handling of persistent CLI flags
f3775877c hugolib: Fix livereload of bundled pages
9c782d514 commands: Fix failing Travis server test
14c35c8a5 Allow "*/" inside commented out shortcodes
96689a5c3 commands: Make commands.Execute return a Response object
e7010c1b6 commands: Remove some TODOs
f396cffa2 commands: Fix the config command
24d5c2194 commands: Fix some flag diff
a7d00fc39 commands: Add basic server test
1e233b1c4 commands: Fix TestFixURL
b110d0ae0 commands: Remove the Hugo global
73825cfc1 commands: Make the limit command work again
a8f7fbbb1 commands: Move the commands related logic to its own file
e8d6ca953 commands: Add CLI tests
4d32f2fa8 commands: Make the hugo command non-global
018602c46 commands: Extract some common types into its own file
2f0d98a19 commands: Make the server command non-global
e0621d207 commands: Make the gen commands non-global
e26a8b242 commands: Make the list commands non-global
2a2c98386 commands: Make the import commands non-global
15b1e269a comands: Make the config command non-global
56a130804 commands: Make the new commands non-global
4b780ca77 commands: Make convert command non-global
7bc5e89fb commands: Make more commands non-global
fdf1d94eb commands: Make benchmark non-global
1157fef85 commands: Start of flag cleaning
e614d8a57 commands: Use short date format in CLI docs
fca49d6c6 Update README.md
0e8b3cbcd Sync dependencies
230f2b8c4 Bump Go versions
d7f47b780 releaser: Prepare repository for 0.39-DEV
712c0fdfe releaser: Add release notes to /docs for release of 0.38.2
62e758826 releaser: Bump versions for release of 0.38.2
47da0dca5 Release 0.38.2
8d87bfd5e releaser: Add release notes draft for 0.38.2
719251c1a Bump the debouncer dependency
8b2ef83bb Use a versioned debounce dependency
080302eb8 Fix handling of --contentDir etc. flag
094ec1714 travis: Disable shallow clone to fix TestPageWithLastmodFromGitInfo
e84b7ade6 Revert "Disable failing test on Travis"
2817e8424 Fix handling of content files with "." in them
623c9afa8  And now really disable failing test on Travis
2170943ae Disable failing test on Travis
9cd4d3597 Revert "Try an older GitMap version"
3a3261a3b Try an older GitMap version
6792d86ad hugolib: Set .Parent in bundled pages to its owner
e7d87e241 releaser: Prepare repository for 0.39-DEV
c475eab47 releaser: Add release notes to /docs for release of 0.38.1
3a96fa40b releaser: Bump versions for release of 0.38.1
c356f1d41 Release 0.38.1
30c2c2f8e releaser: Add release notes draft for 0.38.1
f87239e4c Fix livereload for the home page bundle
db0633c1a snap: Revert to "mage test" because "mage check" fails
874159b54 snap: Add bash completion
294c0f800 snap: Fix empty BuildDate in "hugo version"
a4deaeff0 Fix some livereload content regressions
4d115c56f Update github.com/bep/gitmap to fix snap build
26f34fd59 Fix two tests that are broken on Windows
730b66b65 commands: Handle mass content etc. edits in server mode
4f639d6bd releaser: Prepare repository for 0.39-DEV
f7bc28c52 releaser: Add release notes to /docs for release of 0.38
20e9c08e1 releaser: Bump versions for release of 0.38
37140a093 Release 0.38
da80163c7 releaser: Add release notes draft for 0.38
60e66d12e travis: Clean up and increase verbosity
ed8bf081f Squashed 'docs/' changes from 3068989b9..d9c8fc220
558825cc2 Merge commit 'ed8bf081fdbf336e026517b7e1b123c039014ab5'
10c33c17c docs: Generate docshelper data
2c54f1ad4 docshelper: List Chroma lexers
eb15ac37e travis: Run "gem install" without sudo
eb42774e5 Add support for a content dir set per language
f27977809 Update stale.yml
7a634898c Update Chroma
1823c053c Add .Site.IsServer
511d5d3b7 travis: Move to Ubuntu Trusty image
8299fa885 snap: Remove "make" from build-packages because we use mage now
06495f713 snapcraft.yaml: Call mage with "-v" for debugging
93e24a03c hugolib: Fix freeze in invalid front matter error case
e9c7b6205 Allow themes to define output formats, media types and params
3d1a6e109 hugolib: Add ConfigSourceDescriptor
b6798ee86 Bump some deprecations
0a23baa6a Squashed 'docs/' changes from 211a3c613..3068989b9
84f4b731d Merge commit '0a23baa6a90901f772c234107c4f12c16c76f4aa'
61f6e9f63 tpl/transform: Add a comments test for Remarshal
904a3d9dd Update Chroma to get Go template support
f0052b6d0 commands: Recover from error in server
da8801577 Spring test cleaning, take 2
debd3663d hugolib: Test cleaning #1
af67ad8af hugolib: Trim some now superflous tests
e46ab29bd hugolib: Add Reset method to delete key from Scratch
10fef32de releaser: Adjust the "thank you" section
70005364a docs: Add docs for lang.Merge
ffaec4ca8 Add a way to merge pages by language
3886fc1fe Squashed 'docs/' changes from 4e7e1815b..211a3c613
91fb8f1b5 Merge commit '3886fc1fef6ac19d58b9ba1bb642d0c6c9a54031'
ac12d51e7 create: Remove archetype title/date warning
3fbc75534 resource: Fix path duplication/flattening in processed images
e427ba426 hugolib: Remove superflous debug file
79dd7cb31 hugolib: Simplify Prev/Next
0dbf79c2f docs: Add docs on the new front matter configuration
f12ad7d56 hugolib: Adjust GitInfo author date test
ce6e4310f Refactor the GitInfo into the date handlers
95d62004a Merge commit 'c0290655825e7bb36e13fb39f89d85b392cf1adc'
c02906558 Squashed 'docs/' changes from 715741f73..4e7e1815b
68bf1511f hugolib: Extract date and slug from filename
f8dc47eef Allow partial redefinition of the ouputs config
ae3fa349d output: Fix build
64cec0729 outputs: Adjust the layout examples
9ac620658 releaser: Prepare repository for 0.38-DEV
f414966b9 releaser: Add release notes to /docs for release of 0.37.1
c29a2ed2f releaser: Bump versions for release of 0.37.1
dfb6484a4 Release 0.37.1
8a0296839 releaser: Add release notes draft for 0.37.1
e7fda289b Remove defaultLayout config
50a03a5ac commands: Do not print build total when --quiet is set
ba94abbf5 resource: Fix SVG and similar resource handling
55fb0eac2 releaser: Remove suplerflous release notes slug
06e5ee652 releaser: Prepare repository for 0.38-DEV
956a2dce8 releaser: Add release notes to /docs for release of 0.37
1f1c562b9 releaser: Bump versions for release of 0.37
3e1a6ebc1 Release 0.37
8915cb83f releaser: Add release notes draft for 0.37
900b5f6cf Squashed 'docs/' changes from 1dc05a16b..715741f73
57637d89e Merge commit '900b5f6cfe5a377ef369d26cd700201be4cf6b06'
13ea1e7c3 resource: Use Floyd-Steinberg dithering for PNGs
9f740b37c hugolib: Fix paginator URL for sections with URL in front matter
e39797fa7 hugolib: Avoid scanning entire site to find the home
00868081f Fix bug in Site.assembleSections method
e9750d831 hugolib: Continue GitInfo lookup on error
19d9a46f6 Properly handle -DEV suffix when comparing Hugo versions
0602135fd Make ge, le etc. work with the Hugo Version number
55bd46a63 commands: Remove ERROR on missing baseURL
8dc77b84a releaser: Create bundles for the release notes
4560261b5 Merge commit '374d184e6747678364fd61f5faf328ec9205eb6b'
374d184e6 Squashed 'docs/' changes from f97826a17..1dc05a16b
772128485 Run gofmt -s with Go 1.10
c2c4cb1f9 hugolib: Fix broken footnote test
492fea7cd Update Blackfriday to fix footnote HTML5 validation error
5ed11edf5 releaser: Update to Go 1.10
799c654b0 resource: Preserve color palette for PNG images
faa3159e5 Fix typos in development contribution doc
eaf573a27 Update dependencies
3ced6f8d4 magefile: Disable Go 1.10 gofmt check for now
a3f26e563 Second try: Update to Go 1.10 (!)
0c452c6e7 Revert "Update to Go 1.10 (!)"
ff10c15a9 Update to Go 1.10 (!)
efd506314 Merge branch 'release-0.36.1'
8de91da74 releaser: Prepare repository for 0.37-DEV
25e88ccab releaser: Add release notes to /docs for release of 0.36.1
19228ed83 releaser: Bump versions for release of 0.36.1
a1f40084f Release 0.36.1
d7bf9d4da releaser: Add release notes draft for 0.36.1
53e661e7c releaser: Update to Go 1.9.4
fc23a80ff Bump Travis/Snapcraft to Go 1.9.4
d8fdffb55 resource: Fix multi-threaded image processing issue
2851af022 resource: Improve error processing error message
08521dac8 hugolib: Improve error message in .Render
58382e957 resource: Fix multi-threaded image processing issue
53dac9a50 resource: Improve error processing error message
4edb4bcc6 hugolib: Improve error message in .Render
0816a97a4 parser: Add WARNING for integer YAML keys
10a917dfd parser: Tune stringifyMapKeys
d4beef0d2 parser: Rename stringifyYAMLMapKeys to stringifyMapKeys
51213e0be parser: Add benchmarks for stringifyYAMLMapKeys
1fa241777 Add support for YAML array data files
bb549a0d5 Account for array type data in data dir merge/override logic
82eefded1 hugolib: Refactor tests for JSON, YAML and TOML equivalency, add coverage
e17283499 hugolib: Re-enable YAML data tests disabled in f554503f
b5cb8866e Merge commit '9cc9bab46288d8d5f9fda7009c5f746258cec1b4'
9cc9bab46 Squashed 'docs/' changes from 2fc775dec..f97826a17
d382502d6 tpl/transform: Add template func for TOML/JSON/YAML docs examples conversion
2e95ec684 Add "target" and "rel" parameters to figure shortcode
76d38d5e5 Use more canonical "twitter:image" property, not "twitter:image:src"
f554503fe hugolib: Temp. disable some YAML data tests
16a5c7451 parser: Fix YAML maps key type
49b98975b releaser: Update to Go 1.9.4
0de375a7e Bump Travis/Snapcraft to Go 1.9.4
e02ee7d6a releaser: Prepare repository for 0.37-DEV
18e3657a2 releaser: Add release notes to /docs for release of 0.36
4bc8727fc releaser: Bump versions for release of 0.36
a9a0190b1 Release 0.336
742deaa3d releaser: Add release notes draft for 0.36
694c0fd76 docs: Add documentation for smart cropping etc.
15ff07657 Merge commit 'c305e44f5f081e4436195923a4593e396f07cd49'
c305e44f5 Squashed 'docs/' changes from dce236ad1..2fc775dec
722086b4e resource: Add smart cropping
084cf4191 tpl: Ensure site templates can override theme templates
fc06d5c18 hugolib: Add additional test to TestTemplateLookupOrder
9a367d9d0 hugolib: Fix broken TestTemplateLookupOrder
4402c0777 Fix JSON array-based data file handling regression
4743de0d3 Increase data directory test coverage
19e26cb4e releaser: Prepare repository for 0.36-DEV
0283db6c6 releaser: Add release notes to /docs for release of 0.35
58188807a releaser: Bump versions for release of 0.35
51d5c5421 Release 0.35
a9a5b1e09 docs: Regenerate CLI docs
cf5c2df81 releaser: Add release notes draft for 0.35
158e1151c Merge commit '337d0c5f516ee085205e8abefdb7f87e6d33ca05'
337d0c5f5 Squashed 'docs/' changes from 56c34962c..dce236ad1
f0c0ece44 Add "removable-media" interface to snapcraft.yaml
a34213f0b Fix Docker build
fe40823de readme: Update list of "builders" to include myself
ae742cb1b Fix language params handling
feeed073c commands: Remove some now superflous Fast Render Mode code
94e736c5e hugolib: Extract the Fast Render Mode logic into a method
1707dae8d hugolib: Handle newly created files in Fast Render Mode
2fa70c934 command: Remove undraft command
b6f3f087a commands: Mark deprecated flags in the CLI help
adfd4370b hugolib: Deprecate useModTimeAsFallback
25d691daf tpl: Update Twitter card to also consider images in .Resources
df20b0546 resource: Make resource counters for name and title independent
863a812e0 create: Provide .Name to the archetype templates
f08ea02d2 commands: Deprecate CLI flags canonifyURLs, pluralizeListTitles, preserveTaxonomyNames, uglyURLs
016398ffe hugolib: Fix --uglyURLs from comand line regression
3752348ef Only set 'url' if permalink in metadata and remove duplicate confirm msg
4eb2fec67 Fix handling of top-level page bundles
83c761b71 tpl/collections: Seed random on init only
ed4a00e46 commands: Fix baseURL server regression for multilingual sites
7b472e460 resource: Start Resources :counter first time they're used
96e3fbcf2 travis: Re-enable macOS builds
a91aba1c1 Update to Go 1.9.3
6413559f7 Add a way to disable one or more languages
322c56722 Fix "date" page param
91bb774ae Support pages without front matter
3f0379adb Add page metadata dates tests
ae5a45be6 hugolib: Remove unused code
4d912e2aa hugolib, output: Fix robots.txt in multihost mode
1e27d0589 docs: Re-generate CLI docs
d418c2c2e Remove and update deprecation status
b2fcbb1f9 output: Remove duplicate layout lookup layouts
3446fe9b8 hugolib: Add the last lookup variant for the GetPage index
4a7c2b369 github: Shorten the stale setup
912147ab8 resource: Fix typo in comment
517b6b623 hugolib: Simplify bundle lookup via .Site.GetPage, ref, relref
a19563910 Add a GetPage to the site benchmarks
0432c64dd Add headless bundle support
5a0819b9b Merge matching resources params maps
78c863305 Add some general code contribution criterias
22ad1ebdb travis: Disable macOS builds for now
ebdd8cba3 helpers: Avoid unescape in highlight
8125b4b03 Tighten page kind logic, introduce tests
87217d1d0 releaser: Prepare repository for 0.35-DEV
ffd7dc396 releaser: Add release notes to /docs for release of 0.34
2228d3e28 releaser: Bump versions for release of 0.34
5903a9ce1 Release 0.34
4d644c9d6 releaser: Add release notes draft for 0.34
34a216fe6 resource: Avoid some strings.ToLower in globbing
adee04f4b releaser: Fix BuildDate in release binaries
942138016 resource: Add Match and GetMatch
5d0308698 hugolib: Fix handling of pages bundled in sub-folders in ByPrefix etc.
07700aab0 output: Add some more layout docshelper variants
4d5e4f379 hugolib: Add validation for defaultContentLanguage
cd7796828 releaser: Prepare repository for 0.34-DEV
c7b9347be releaser: Add release notes to /docs for release of 0.33
c6b903729 releaser: Bump versions for release of 0.33
09a934b32 Release 0.33
e6cc2a655 releaser: Add release notes draft for 0.33
a39ae4bb0 output: Redo the docshelper layouts examples
b3eeb9764 Merge commit '3cf4300097610bb8b5bd0686d96d1df5db641895'
3cf430009 Squashed 'docs/' changes from ddb7d8fae..56c34962c
9409bc0f7 Improve .Site.GetPage for regular translated pages
4eb1650be resource: Use path.Match instead of filepath.Match
20c9b6ec8 resource: Add front matter metadata to Resource
f8a119b60 Update Afero to avoid panic on "file name is too long"
ecaf14514 resource: Fix handling of very long image file names
d4f8f88e6 commands: And now really fix the server watch logic
4e524ffcf commands: Fix server without watch
64f0e9d1c Update Chroma and other third-party deps
13d53b31f commands: Remove superflous BuildDate logic
51dd462c3 layout: Respect Type and Layout for list template selection
b6ea6d07d Run benchmarks 3 times
4dac1781e resource: Add some GoDoc
8a409894b hugolib: Allow url in front matter for list type pages
46db900da resource: Implement Resources.ByPrefix
60c9f3b1c resource: Make GetByPrefix work for Page resources
57e10f174 Support uglyURLs per section
db85e8340 resource: Make .Resources.GetByPrefix case insensitive
1046e9363 Update CONTRIBUTING.md
d5803da1b Support offline builds
27c77e1ab releaser: Prepare repository for 0.33-DEV
218773a82 releaser: Add release notes to /docs for release of 0.32.4
a97ef61ba releaser: Bump versions for release of 0.32.4
4aaf27dc5 Release 0.32.4
f7d0b05f9 releaser: Add release notes draft for 0.32.4
f82428d2e releaser: Git info bounds checking
50fb49c3d resource: Remove superflous comment
5235a5bf5 Correct fix for --cleanDestinationDir flag
1921a70ab Revert "Remove the --cleanDestinationDir flag", there is a better fix.
f0eecc6a4 Fix non-ASCII path handling for Page resources
768ec5df9 Remove the --cleanDestinationDir flag
238e7f7fb releaser: Prepare repository for 0.33-DEV
0aaa38544 releaser: Add release notes to /docs for release of 0.32.3
fdec5e308 releaser: Bump versions for release of 0.32.3
71abb53ff Release 0.32.2
db5d79862 releaser: Add release notes draft for 0.32.3
2d3189b22 hugolib: Fix handling of mixed-case taxonomy folders with content file
4b04db0f0 resource: Avoid processing and storing same image for each language
97c1866e3 resource: Resources.ByType should return Resources
8969331f5 Fix multihost detection for sites without language definition
6feb13878 commands: Report build time on config.toml change
059e8458d Fix hugo benchmark --renderToMemory
ab82a27d0 Fix URLs for bundle resources in multihost mode
f25d8a9e1 Fix sub-folder baseURL handling for Page resources
54a89cde6 releaser: Prepare repository for 0.33-DEV
2cd962233 releaser: Add release notes to /docs for release of 0.32.2
865877cd0 releaser: Bump versions for release of 0.32.2
1ff80a8bb Release 0.32.2
956ef4097 releaser: Add release notes draft for 0.32.2
196da49c9 resource: Handle publish to /public on fresh build
2aa4c009e Merge commit 'eb738cd35cca1ffc68c5ed688dbe2a19108e8761'
eb738cd35 Squashed 'docs/' changes from fc61378a3..ddb7d8fae
3dd8c1c02 releaser: Prepare repository for 0.33-DEV
fd301c3c0 releaser: Add release notes to /docs for release of 0.32.1
54ef60b03 releaser: Bump versions for release of 0.32.1
14a758ff2 Release Hugo 0.32.1
e64eb5ec2 releaser: Add release notes draft for 0.32.1
d36d71edd commands: Fix broken hugo --renderToMemory
a54fd7df2 resource: Use the correct Destination FS
16e1d99c6 resource: Create target dir if not exists
bf8a61fde hugolib: Add test for image processing from shortcodes
72158ab2e releaser: Prepare repository for 0.33-DEV
cb359a75c releaser: Add release notes to /docs for release of 0.32
82db03943 releaser: Bump versions for release of 0.32
2d2289c79 Release v0.32
6894f121b releaser: Add release notes draft for 0.32
245212a5b Merge commit 'f3cd083961f36dc96d05e98aaf67f650102bc757'
f3cd08396 Squashed 'docs/' changes from 3e663efb2..fc61378a3
407c24020 hugolib: Add test for homepage content for all rendering engines
c067f3455 tpl/transform: Do not unescape input to highlight
72903be58 commands: Make sure all language homes are always re-rendered in fast render mode
1c114d539 hugolib: Do not tolower result from Page.GetParam
e14129461 resource: Avoid potential case issue in image names
612dcc194 helpers: Avoid writing the last MD5 buff part twice
e50a8c7a1 resource: Use MD5 to identify image files
7e76a6fd3 source: Fix test on Windows
1b0780dbe source: Make sure .File.Dir() ends with a slash
3cdf19e9b  Implement Page bundling and image handling
02f2735f6 tpl/strings: Fix broken test
22cd89adc Make chomp return the type it receives
db4b7a5c6 Reuse the BlackFriday instance when possible
251149860 livereload: Fix host comparison when ports aren't present
9df3736fe Add .Title and .Page to MenuEntry
243694102 Remove the goroutines from the shortcode lexer
315352616 mage: Do not run Go Fmt check on Go tip
fdbef2a81 Adjust the stale setup
426ac9c18 Add Github stale bot config
84805a68c Use StopTimer in site benchmarks
a2d81ce98 Add output formats definition to benchmarks
051fa343d Improve site benchmarks
23f69efb3 Fix context of opengraph video range
e69da7a4c Add Pandoc support, refactor external helpers
e7652180a vendor: Fix Humanize for multi-byte runes
798921012 vendor: Update Chroma to v0.2.0
7f2ae3ef3 vendor: update goorgeous@v1.1.0
8a8ba63c7 releaser: Prepare repository for 0.32-DEV
c1c04d74a releaser: Add release notes to /docs for release of 0.31.1
aa68205d1 releaser: Bump versions for release of 0.31.1
94115888e Release 0.31.1
bf8aa4ac5 releaser: Add release notes draft for 0.31.1
6d79beb5f tpl/images: Close image file
8afd7d9ce commands: Fix broken --appendPort=false
42fbf15fb releaser: Prepare repository for 0.32-DEV
288723a04 releaser: Add release notes to /docs for release of 0.31
f4b416bbe releaser: Bump versions for release of 0.31
058f25146 Release 0.31
3dd7e8b7a releaser: Add release notes draft for 0.31
30c0d485e Squashed 'docs/' changes from a042b67b5..3e663efb2
14786c4d8 Merge commit '30c0d485eaff6d70df1be0353911ddca485d52bf'
089fe4930 hugolib: Make sure everything ends up in its lang root in multihost mode
118b83d74 helpers: Properly handle []interface{} as staticDir
adbd5bc47 source: Enable disabled test
c1d325934 helpers: Remove (now) unused GetStaticDir
d99db71ab livereload: Fix recently broken window.location.reload logic
503ca6de6 Fix broken shortcodes for Ace and Amber
b3daa1f4b hugolib: Fix .IsTranslated  with identical filenames
df1677a6e Merge commit '05e42bc643f1840ed2ad9c2eff82a269d1381683'
05e42bc64 Squashed 'docs/' changes from e65df1059..a042b67b5
0a81a6b4b output: Fall back to unstranslated base template
60dfb9a6e Add support for multiple staticDirs
2e0465764 Add multilingual multihost support
6233ddf9d tpl/partials: Fix the lock contention in cached partial
e66d813bc gopkg: Update Chroma to get SVG support
f5ed04bd4 tpl/partials: Fix cache locking
7730d683e tplimpl: Make partial benchmarks use RunParallel
bb048d811 Use ms precision for static change logging
9299a16c9 circleci: Bump to Go 1.9.2
a9be687b8 hugolib: Pre-allocate some slices
b32ffed6a Update Chroma to get the latest SASS lexer
77cbd001f Update Travis and snapcraft to Go 1.9.2
764f1304e hugolib: Add some more taxonomy permalinks test cases
d9a78b61a Handle Taxonomy permalinks
23ba779fa i18n: Support unknown language codes
550cec0b1 gopkg: Bump go-i18n version
b88a105a7 Revert "i18n: Allow custom language codes"
b3443b3d0 Revert "i18n: Prevent data race in lang code handling"
c97216e4f i18n: Prevent data race in lang code handling
bb04010cb i18n: Allow custom language codes
76dc811c6 tpl/math: Refactor Mod with cast
488631fe0 Add support for height argument to figure shortcode
fdd62eb4c Add linebreak to README.md for better readability
b6f2e3b43 Update toml dependency revision in Gopkg.lock too
c61998d3a Update toml dep to fetch its latest master branch instead of v0.3.0
45ad8ac38 vendor: Lock mage to v1
133cfd171 mage: Skip Check on Go 1.8
db1a5af15 Gopk.toml cleanup
9ccc958ce Update Dockerfile and Snap build to reflect move to dep
30e471b8c Update CONTRIBUTING to reflect Go Dep
f711b170e Update magefile to use Go Dep
9536f7cd0 Adjust some deps versions
1ac47cd88 Run dep init
ba0b22ef4 vendor: Remove to prepare for dep
c9c19d794 Fix error handling in mage build
1d52bfbb4 releaser: Prepare repository for 0.31-DEV
142ebba2c releaser: Add release notes to /docs for release of 0.30.2
bf633ea2f releaser: Bump versions for release of 0.30.2
6faf47e8d 0.30.2 Release
7954bc0f0 releaser: Add release notes draft for 0.30.2
c4bf03a55 releaser: Improve release notes front matter
316410331 commands: Support Fast Render mode with sub-path in baseURL
6a5170116 Merge commit '325009c3fd4ac90021897b7e3e025c14e70ce162'
325009c3f Squashed 'docs/' changes from 4628b9ec2..e65df1059
bc53cd7b1 releaser: Prepare repository for 0.31-DEV
4e07b4144 releaser: Add release notes to /docs for release of 0.30.1
89a3f47a2 releaser: Bump versions for release of 0.30.1
35be07f7c Release 0.30.1
6f84570d8 releaser: Add release notes draft for 0.30.1
896416257 circleci: Must go get mage
e939aaed8 releaser: Correctly set final version on patch releases
d2b3f00df Bump Snap to go1.9.1
fa53b13ca Fix hugo -w
c3c10f2c7 Simplify Site benchmarks
ad5ef4383 Fix mage vs make issues
5109ed520 Revert "tplimpl: Output xmlns:xhtml only if there are translations available"
45e0908b8 releaser: Prepare repository for 0.31-DEV
41180c51e releaser: Add release notes to /docs for release of 0.30
811f381e2 releaser: Bump versions for release of 0.30
7d783a1c0 Release Hugo 0.30
49d5e7da4 Use Make for the release for now
190508ae1 releaser: Add release notes draft for 0.30
04bdb596a Fix CircleCI build issue
fe71cb6f5 Replace make with mage in CircleCI build
68ace4343 Update CircleCI build to use Mage
ecf5e081b Squashed 'docs/' changes from 000ab7c42..4628b9ec2
5c31e0c34 Merge commit 'ecf5e081b5540e69f4af330233f39a07baf53846'
7c30e2cbb Add table linenos support for Chroma highlighter
60bd332c1 Only re-render the view(s) you're working on
6a30874f1 Make sure Date and PublishDate is always set to a value if one is available
15ec031d9 Add correct config file name to verbose server log
01e54609e metrics: Reset benchmark timer
5800a20a2 metrics: Detect partialCached candidates
e2e8bcbec tpl: Rework the partial test and benchmarks
66a169a24 Simplify HugoNoGitInfo in magefile
2cc476567 Add mage installation step to CONTRIBUTING.md
856fc445d Bump Go versions in Travis config
a6ed645a3 Change last 'make' statements to 'mage'
23488f874 Minor README changes
8d2580f07 Replace make with mage
06e563340 Merge commit 'dae5a7c61cceeb0de59f2d755f63e453f71dd9b2'
dae5a7c61 Squashed 'docs/' changes from 36d7e22f5..000ab7c42
a58741a17 helpers: Fix broken test
d32fd8e32 vendor: Update deps
0859d9dfe tplimpl: Output xmlns:xhtml only if there are translations available
384a6ac4b Create magefile from Makefile
4fc67fe44 tpl: Add errorf template function
47fdfd519 Clean up lint in various packages
d45e358a0 helpers: Fix broken Chroma test
24fab9984 hugolib: Fix broken hightlighter smoke test
6a986b7c0 vendor: Update dependencies
8cf55aff0 vendor: Update Chroma
8717a60cc Change SummaryLength to be configurable (#3924)
281887899 tpl: Add os.fileExists template function
b6a30283f Merge commit '9d68f695e782c6a83c77aff13317c7a22c694c98'
9d68f695e Squashed 'docs/' changes from 20959c7b..36d7e22f
57adc539f tpl: Add float template function
b277cb33e hugolib: Move metrics output to the end of the site build
a354d130d examples: Fix `now` usage in footer
f806e951f releaser: Prepare repository for 0.30-DEV
524c67107 releaser: Add release notes to /docs for release of 0.29
396759a09 releaser: Bump versions for release of 0.29
e6079a9c0 releaser: Add release notes for 0.29
b5e1dc589 tpl: Set Metrics at creation time
d3681f51c metrics: Fix sort order
4f576e1c0 Revert "vendor: Update Chroma"
b4a14c25f metrics: Add simple template metrics feature
cb8eb4726 vendor: Update Chroma
e94d4f017 commands: Make noHTTPCache default false
8a69d2356 tpl: Add math.Ceil, Floor, and Round to method mappings
d9697e275 Split go build in Dockerfile
09d960f17 Update Dockerfile to benefit build cache
a3a3f5b86 snap: Add git to snap package for GitInfo
404e2994e releaser: Prepare repository for 0.29-DEV
2a7f6dda1 releaser: Add release notes to /docs for release of 0.28
9e850c1f6 releaser: Bump versions for release of 0.28
ab86851a1 releaser: Add final 0.28 release notes
53b6235bb releaser: Add release notes draft for 0.28
61c27b58b Squashed 'docs/' changes from 1662b9d0..20959c7b
932ae5270 Merge commit '61c27b58b353c73772aae572c7d822fdfdf7791b'
30694a133 Squashed 'docs/' changes from 5be6fef0..1662b9d0
23ba0edf7 Merge commit '30694a133a88d5f76a51d0372646e10cbeca7691'
fb33d8286 Use Chroma as new default syntax highlighter
81ed56479 tpl: Add urls.Parse function
19c591048 tpl: Add math.Ceil, Floor, and Round
80c7ea60a Make noHTTPCache default on
0d29a0f78 Trim newlines in the hightlight shortcode
b8fabce21 vendor: Update goorgeous
b18047763 Add liveReloadPort flag to server
c31e083ea Fix the docs helper tool
9436f0b0c Allow the pull-docs script to pull other than master
7a89dce53 Squashed 'docs/' changes from 32356e4e..5be6fef0
f8fd5796b Merge commit '7a89dce53bfbd67a17442a8f9be8fa895fc4f9b1'
173b54498 commands: Remove superflous space
df411ec81 commands: Rename noHttpCache to noHTTPCache
0b34af216 Add noHttpCache to hugo server
c0370e0ee Merge commit 'ba45da9d03056447e4873de13d4e0f8d658a769b'
ba45da9d0 Squashed 'docs/' changes from 44fe0285..32356e4e
5c3b21036 releaser: Prepare repository for 0.28-DEV
5a4002bc8 releaser: Add release notes to /docs for release of 0.27.1
18126434f releaser: Bump versions for release of 0.27.1
dda269f17 releaser: Add release notes for 0.27.1
2d613dd90 tpl/tplimpl: Fix escaped HTML Go 1.9 multioutput issue (#3880)
642ba6cab snap: Bump to 1.9
d1d6aa634 Remove .goxc.json
0375cbd02 releaser: Prepare repository for 0.28-DEV
01fdf6d26 releaser: Add release notes to /docs for release of 0.27
828eb70fa releaser: Bump versions for release of 0.27
f4ea43398 Release of 0.27
457048634 releaser: Add release notes draft for 0.27
1b4319be6 Squashed 'docs/' changes from 1d052b16..44fe0285
58245a29d docs: Merge commit '1b4319be62ba071f79e90ef32dbe92eb893429f7'
d2249c509 Set up Hugo release flow on CircleCI
f4bf21413 tpl/time: Add time.Duration and time.ParseDuration template funcs
0462c96a5 tpl/compare: Add cond (ternary) template func
202510fdc hugolib: Fix "published" front matter handling
573deca08 hugolib: Fix typo in aquired
eeb057f22 docs: Document Related Content
3b4f17bbc hugolib: Implement "related content"
7d63a23b0 Squashed 'docs/' changes from f887bd7b..1d052b16
16c912766 docs: Merge commit '7d63a23b0c68d9cd7c7c09c2755619237bc03485'
f88fe312c output: Fix taxonomy term base template lookup
d33563b5d release: CGO_ENABLED=0
fc4a0d170 Update Travis build to Go 1.9!
7231d5a82 livereload: Maintain the scroll position if possible
88e1bca92 Update template_embedded.go
d000cf605 tpl: Prepare for template metrics
29a2da059 tpl: Cleanup strings.TrimPrefix and TrimSuffix
7674ad738 tpl: Add strings.TrimLeft and TrimRight
08f48b91d compare, hugolib, tpl: Add Eqer interface
2fc121ce2 appveyor: Simplify
2a2e69070 hugolib: Simplify Page.Eq
a7555c543 hugolib: Do not return error in Eq on type mismatch
c265c102a hugolib: Rename Page.Equals to Page.Eq
f0f49ed9b hugolib: Add Page.Equals
71ae9b453 hugolib: Rewrite replaceDivider to reduce memory allocation
199816fdd hugolib: Extract replaceDivider logic
919bc9210 Add an iFrame title to the YouTube shortcode
07f6e1499 travis: Pull docutils out into requirements.txt
e8468a985 travis: Fix docutils setup
359af563a travis: Try to fix docutils setup on Linux
0019ce002 output: Improve the base template identification
33ae10b6a tpl/transform: Only strip p tag in markdownify if only one paragraph
2d1bd876c Update docs versiona and README
ec4e6f9df Squashed 'docs/' content from commit f887bd7b
a1900826b Merge commit 'ec4e6f9df2ab9ffdc62a3f59675369096e0d3f77' as 'docs'

git-subtree-dir: docs
git-subtree-split: 51c4f31840
2019-11-11 11:45:18 +01:00
Bjørn Erik Pedersen d1d1f240a2 hubolib: Headless bundles should not be listed in .Pages
Fixes #6492
2019-11-10 18:57:31 +01:00
Luke Francl 70a1aa345b Support Go time format strings in permalinks
In the vein of an ancient TODO about supporting custom date formatting with
strftime, this allows `:`-prefixed Go time format strings in permalink segments.
This allows users to customize date-based permalinks any way they need to.

For example, with a date of 2019-11-09, the permalink `/:06/:1/:2` will render
as `/19/11/9`.

See:

https://github.com/gohugoio/hugo/commit/07978e4a4922bc21c230fee65052232b829bd1ab#diff-0688a3b65c7f5d01aa216f8d9b57fd00R111-R112
https://discourse.gohugo.io/t/implementing-additional-date-formats-for-permalinks/17860
https://github.com/gohugoio/hugo/pull/6488
2019-11-10 11:00:02 +01:00
Anthony Fok cafecca440 travis: Increase timeout to 30000 for mage -v check
The default timeout of 15000 millisecond is too short
for go test -race on arm64.

See golang/go#35308
2019-11-08 08:24:41 +01:00
Bjørn Erik Pedersen 5f6b6ec689 Prepare for Goldmark
This commmit prepares for the addition of Goldmark as the new Markdown renderer in Hugo.

This introduces a new `markup` package with some common interfaces and each implementation in its own package.

See #5963
2019-11-06 19:09:08 +01:00
Bjørn Erik Pedersen 366ee4d8da deps: Update quicktest
To make the test build on Go 1.14.
2019-11-06 17:04:58 +01:00
Bjørn Erik Pedersen c26d00db64 hugolib: Fix ref/relref anhcor handling
Fixes #6481
2019-11-06 09:29:38 +01:00
Anthony Fok 8483b53aef deps: Update to Chroma v0.6.9 for Java lexer fix
Fixes #6476
2019-11-05 08:24:41 +01:00
Bjørn Erik Pedersen 9f46a72c7e tpl/collections: Add some index map test cases
See #3974
2019-11-04 11:13:27 +01:00
Bjørn Erik Pedersen 9abd396789 helpers: Use pointer receiver for ContentSpec 2019-11-04 10:57:11 +01:00
Bjørn Erik Pedersen ad4c56b551 travis: Allow arm64 to fail
As that is what it does at the moment.
2019-11-04 09:29:12 +01:00
Bjørn Erik Pedersen 3717db1f90 minifiers: Add a JSON roundtrip test
See #6472
2019-11-03 11:34:22 +01:00
Anthony Fok ae4fde0866 Update .travis.yml for arm64 support, etc.
- Add arm64 support for Linux thanks to Travis CI’s new feature, see
  https://blog.travis-ci.com/2019-10-07-multi-cpu-architecture-support
- Force GO111MODULE=on
- Cache directories
- Switch to bionic (Ubuntu 18.04) environment
- Use "master" instead of "tip" to match the latest Travis CI docs
- Allow "mage -v check" to fail on non-AMD64 architectures
  because "go test -race ./..." currently fails on arm64 and ppc64le.
2019-11-01 11:03:06 -06:00
Anthony Fok c6d69d0c95 mage: Skip Test386 on non-AMD64 architectures
This is to allow "mage check" to run on arm64 on Travis CI.
2019-11-01 11:03:06 -06:00
Anthony Fok c3d433af56 Update past go-cmp's checkptr fix
To fix our -race test under Go 1.14.

See google/go-cmp#167
2019-11-01 02:25:11 -06:00
hugoreleaser 07a203406a releaser: Prepare repository for 0.60.0-DEV
[ci skip]
2019-10-31 15:30:12 +00:00
hugoreleaser d5dab232c2 releaser: Add release notes to /docs for release of 0.59.1
[ci skip]
2019-10-31 15:20:53 +00:00
hugoreleaser e04a22c5e4 releaser: Bump versions for release of 0.59.1
[ci skip]
2019-10-31 15:20:53 +00:00
hugoreleaser d14265da8f releaser: Add release notes for 0.59.1
[ci skip]
2019-10-31 15:20:53 +00:00
Bjørn Erik Pedersen 33c474b9b3 hugofs: Fix crash in multilingual content fs
Fixes #6463
2019-10-31 16:11:53 +01:00
Jake Jarvis ed2682325a Dockerfile: Switch to mage builds, various optimizations
- Use Alpine for both stages for consistency.
- Switch to mage from go install as dictated in the latest docs.
- Easy switch to building Hugo Extended by directly setting HUGO_BUILD_TAGS flag at image build time: `docker build --build-arg HUGO_BUILD_TAGS=extended .`
- Update to Go 1.13 and Alpine 3.10.
- The only possibly breaking change: Moved the `hugo` binary in the final stage from /hugo to /usr/bin/hugo so one can simply run `hugo` without having to search around for its location.
2019-10-31 09:53:49 +01:00
Anthony Fok 66fe68ffc9 resources/images: Add exception for new test image
in TestImageOperationsGolden due to "fused multiply and add" (FMA)
instruction on s390x, ppc64* and arm64.

See #6439
2019-10-30 12:22:13 -06:00
Bjørn Erik Pedersen c5e1e8241a Adjust benchmark templates 2019-10-28 10:56:07 +01:00
Bjørn Erik Pedersen baa975082c deps: Update to Chroma v0.6.8 to fix a crash
Also improve relevant logging.

Fixes #6450
2019-10-24 11:11:18 +02:00
Bjørn Erik Pedersen 3e8b5a5c01 deps: Update quicktest 2019-10-23 09:08:45 +02:00
Nick Krichevsky e6aa6edb4c Do not attempt to build if there is no config file
Fixes #5896
2019-10-22 00:10:36 +02:00
hugoreleaser 6bcc5ad8b2 releaser: Prepare repository for 0.60.0-DEV
[ci skip]
2019-10-21 09:47:26 +00:00
hugoreleaser 1dd0c69c7b releaser: Add release notes to /docs for release of 0.59.0
[ci skip]
2019-10-21 09:38:50 +00:00
hugoreleaser b084af4bfa releaser: Bump versions for release of 0.59.0
[ci skip]
2019-10-21 09:38:50 +00:00
Bjørn Erik Pedersen 0237d45955 Release 0.59.0 2019-10-21 11:33:11 +02:00
hugoreleaser 109ac877c2 releaser: Add release notes for 0.59.0
Rename to *-ready.md to continue.
[ci skip]
2019-10-21 11:32:54 +02:00
Bjørn Erik Pedersen 5ac0f751aa Squashed 'docs/' changes from 0584815c8..723da4a37
723da4a37 Vendor the theme

git-subtree-dir: docs
git-subtree-split: 723da4a376
2019-10-21 10:52:23 +02:00
Bjørn Erik Pedersen de8ca7e4d4 Merge commit '5ac0f751aa47e52625662215f66efa99a6abfc2e' 2019-10-21 10:52:23 +02:00
Bjørn Erik Pedersen 5070ba6c9e Squashed 'docs/' changes from fdea5430f..0584815c8
0584815c8 Add a page about Pages methods (Next, Prev)
653dc8db5 Add note about default bgColor

git-subtree-dir: docs
git-subtree-split: 0584815c8a
2019-10-21 10:49:16 +02:00
Bjørn Erik Pedersen ec5962278f Merge commit '5070ba6c9e6c492deade3c30cfe769b9dbf7151d' 2019-10-21 10:49:16 +02:00
Bjørn Erik Pedersen b9bd35d72e Squashed 'docs/' content from commit fdea5430f
git-subtree-dir: docs
git-subtree-split: fdea5430f8
2019-10-21 10:22:28 +02:00
Bjørn Erik Pedersen 27aef3f1fb Merge commit 'b9bd35d72e14932fb6588ff62b90cddef0a060fc' as 'docs' 2019-10-21 10:22:28 +02:00
Bjørn Erik Pedersen 39121de4d9 docs: Replace /docs 2019-10-21 10:21:51 +02:00
Bjørn Erik Pedersen 180195aa34 cache/filecache: Recover from file corruption
Fixes #6401
2019-10-21 09:51:51 +02:00
Bjørn Erik Pedersen 4b286b9d27 resources/images: Allow to set background fill colour
Closes #6298
2019-10-20 22:06:58 +02:00
Nicolas Martignoni 689f647baf media: Add common video media types
- See https://discourse.gohugo.io/t/resources-bytype-for-video-files/21285
2019-10-16 17:16:14 +02:00
Bjørn Erik Pedersen 46cafdbaca examples: Replace .RSSLink
Fixes #6037
2019-10-14 09:30:09 +02:00
Bjørn Erik Pedersen 653e6856ea resources/page: Use binary search in Pages.Prev/Next if possible
This is obviously much faster for lager data sets:

```bash
name                         old time/op    new time/op    delta
SearchPage/ByWeight-100-4       267ns ± 4%     272ns ± 5%     ~     (p=0.457 n=4+4)
SearchPage/ByWeight-5000-4     10.8µs ± 3%     1.2µs ± 2%  -88.99%  (p=0.029 n=4+4)
SearchPage/ByWeight-10000-4    21.1µs ± 1%     1.4µs ±11%  -93.28%  (p=0.029 n=4+4)
```

See #4500
2019-10-13 12:36:17 +02:00
Bjørn Erik Pedersen f4f566edf4 Make Pages.Prev/Next work like the other Prev/Next methods
Fixes #4500
2019-10-13 12:36:17 +02:00
Zach Bayoff 7b3edc2931 tpl: Add optional "title" attribute to iframe in Vimeo shortcode
Add an optional "title" attribute to the iframe in the vimeo shortcode. If one is not given, the title attribute will default to "vimeo video". It is imperative for iframes to have a non-empty "title" attribute in order to meet WCAG2.0 accessibility guidelines https://www.w3.org/TR/WCAG20-TECHS/H64.
2019-10-12 18:10:14 +02:00
Baibhav Vatsa 65b7d4221b tpl: Modify error messages of after, first, and last
Modified the messages functions after, first, and last threw on being passed invalid parameters (index or limit) to be more standardised and resemble what Go compiler would throw.

Fixes #6415
2019-10-12 18:07:46 +02:00
Baibhav Vatsa 0e75af74db tpl: Last now accepts 0 as limit
Modified the if conditional because of which last threw an error if 0 was passed as limit. The function now returns an empty slice if it is called with 0 as limit. The behavior of first and last is now the same when 0 is passed as limit. Also added tests to test the new behavior.

Fixes #6419
2019-10-11 20:34:51 +02:00
Bjørn Erik Pedersen 5f1aafafb4 Update feature_request.md 2019-10-11 16:43:00 +02:00
Vazrupe (HyeonGyu Lee) a9762b5c48 common: Fix elements are doubling when append a not assignable type
Fixes #6188
2019-10-11 10:38:12 +02:00
Baibhav Vatsa 096a4b67b9 tpl: After now accepts 0 as index
Modified the if conditional because of which after threw an error if called with 0 as index. The function now returns the whole original slice if 0 is passed as an index. Also added tests to test the new behavior.

Fixes #6388
2019-10-11 08:35:27 +02:00
Bjørn Erik Pedersen bc70f2bf12 helpers: Fix data race in global logger init
Fixes #6409
2019-10-10 16:07:53 +02:00
Bjørn Erik Pedersen 0d7b05be4c tpl: Make getJSON/getCVS accept non-string args
This broke for the Twitter simple shortcode now that Shortcodes accepts typed arguments.

Fixes #6382
2019-10-10 13:30:39 +02:00
Bjørn Erik Pedersen 71b18a0786 Update to Go 1.12.10 and 1.13.1
Fixes #6406
2019-10-10 09:50:44 +02:00
Bjørn Erik Pedersen 339ee37143 Simplify test output to simplify diffing 2019-10-09 10:49:52 +02:00
Bjørn Erik Pedersen f10db101a1 hugofs: Add FileMeta.String
To make the page listing easier to compare.
2019-10-09 10:30:09 +02:00
Anthony Fok b401858ebd deps: Update minify to v2.5.2
- v2.5.1 removes import comments, solving a build error with Go 1.13
  in GOPATH mode (used Debian packaging for example)
- v2.5.2 no longer converts polyline/rect/polygon/line to path
  as it has been reported to break a SVG referenced by CSS,
  see tdewolff/minify#260

The test case for Min SVG in TestResourceChains is updated accordingly.

Fixes pocc/tshark.dev#33
2019-10-09 09:01:08 +02:00
Anthony Fok 39ed33fceb resources: Fix image test error on s390x, ppc64* and arm64
In TestImageOperationsGolden, tolerate slight floating-point rounding
differences due to the use or non-use of "fused multiply and add" (FMA)
instruction on different architectures.

Special thanks to @disintegration for the solution in goldenEqual();
see https://github.com/disintegration/gift/issues/20

Fixes #6387
2019-10-07 21:52:43 +02:00
Niklas Fasching 020a6fbd7f Add BaseFs to RenderingContext
The org mode renderer supports including other files [1]. We don't want to
allow reading of arbitrary files (go-org defaults to ioutil.ReadFile [2]) but want
to make use of the FileSystem abstractions hugo provides. For starters we will
allow reading from the content directory only

[1]: e.g. `#+INCLUDE: ./foo.py src python` includes `foo.py` as a python source
block.
2019-10-07 17:30:15 +02:00
Niklas Fasching b152216d5c deps: Update go-org
- add support for latex fragments
- allow customization of ReadFile method for includes (#+INCLUDE: ...)
2019-10-07 17:30:15 +02:00
Bjørn Erik Pedersen 64ec8c8904 media: Use + to create the Type string 2019-10-06 22:20:58 +02:00
Jamie Tanna c466b88c99 deps: Upgrade to latest version of emoji dependency
To add support for new emojis in Hugo, we need to upgrade our internal
dependency on the emoji package.

Note that we also need to update our tests, as the underlying emoji that
is rendered has changed.

Follow-up to #6391. (170f18d935 and
2df5d202c6)
2019-10-05 22:58:53 +02:00
Bjørn Erik Pedersen 2df5d202c6 Revert "deps: Upgrade to latest version of emoji dependency"
This reverts commit 170f18d935.
2019-10-05 19:25:25 +02:00
Jamie Tanna 170f18d935 deps: Upgrade to latest version of emoji dependency
To add support for new emojis in Hugo, we need to upgrade our internal
dependency on the emoji package.
2019-10-05 18:47:35 +02:00
Bjørn Erik Pedersen 15a0364d39 readme: Update Architectures 2019-10-04 20:55:10 +02:00
Garret Kelly 674e81ae87 deploy: Add ability to invalidate Google Cloud CDN 2019-10-03 16:53:45 +02:00
Anthony Fok 298092d516 resources: Ensure same dirinfos sort order in TestImageOperationsGolden
Fix filename mismatch errors on Debian auto-building machines
possibly due to different directory order on ext4 vs tmpfs file systems.
2019-10-03 16:48:22 +02:00
Bjørn Erik Pedersen 019ae38483 Update bug_report.md 2019-09-30 20:09:49 +02:00
Bjørn Erik Pedersen 329e88db1f Support typed bool, int and float in shortcode params
This means that you now can do:

    {{< vidur 9KvBeKu false true 32 3.14 >}}

And the boolean and numeric values will be converted to `bool`, `int` and `float64`.

If you want these to be  strings, they must be quoted:

    {{< vidur 9KvBeKu "false" "true" "32" "3.14" >}}

Fixes #6371
2019-09-29 23:22:41 +02:00
Bjørn Erik Pedersen e073f4efb1 deps: Update Chroma
Closes #6279
2019-09-25 08:42:15 +02:00
Brian MacKinney 454a033dc5 github: Add issue templates and action 2019-09-25 08:40:04 +02:00
J. Ansorg e5856e61d8 resources: Support output image format in image operations
The image format is defined as the image extension of the known formats,
excluding the dot.
All of 'img.Resize "600x jpeg"', 'img.Resize "600x jpg"',
and 'img.Resize "600x png"' are valid format definitions.
If the target format is defined in the operation definition string,
then the converted image will be stored in this format. Permalinks and
media type are updated correspondingly.
Unknown image extensions in the operation definition have not effect.

See #6298
2019-09-21 16:50:27 +02:00
XhmikosR 34dc06b032 tpl: Add rel="noopener" for external links
This could be a security and performance issue.

See https://developers.google.com/web/tools/lighthouse/audits/noopener
2019-09-21 10:08:47 +02:00
XhmikosR 2b1814ee58 tpl: Remove unneeded space 2019-09-21 10:06:15 +02:00
hugoreleaser 8cb7a0d4db releaser: Prepare repository for 0.59.0-DEV
[ci skip]
2019-09-19 15:36:35 +00:00
hugoreleaser 4aac02d49c releaser: Add release notes to /docs for release of 0.58.3
[ci skip]
2019-09-19 15:28:26 +00:00
hugoreleaser 85376a757b releaser: Bump versions for release of 0.58.3
[ci skip]
2019-09-19 15:28:26 +00:00
hugoreleaser 0fd30f832b releaser: Add release notes for 0.58.3
[ci skip]
2019-09-19 15:28:26 +00:00
Bjørn Erik Pedersen c262a95a5c Add some more resource transform tests
See #6348
2019-09-19 16:58:14 +02:00
Bjørn Erik Pedersen 6dec671fb9 Fix cache key transformed resources
Fixes #6348
2019-09-19 12:36:01 +02:00
Fazal Majid c0d7188ec8 deploy: Do not compile in Azure on Solaris
See #6324
2019-09-13 14:53:36 +02:00
hugoreleaser 13768c3c50 releaser: Prepare repository for 0.59.0-DEV
[ci skip]
2019-09-13 08:12:38 +00:00
hugoreleaser 253e5fdc69 releaser: Add release notes to /docs for release of 0.58.2
[ci skip]
2019-09-13 08:04:20 +00:00
hugoreleaser 7bc1270ec7 releaser: Bump versions for release of 0.58.2
[ci skip]
2019-09-13 08:04:20 +00:00
hugoreleaser d4c98e5800 releaser: Add release notes for 0.58.2
[ci skip]
2019-09-13 08:04:20 +00:00
Bjørn Erik Pedersen c0d7573677 Fix cache keys for bundled resoures in transform.Unmarshal
Fixes #6327
2019-09-12 20:58:06 +02:00
Bjørn Erik Pedersen fcfa6f33bb filecache: Ignore "does not exist" errors in prune
Fixes #6326
Fixes #5745
2019-09-12 17:37:41 +02:00
hugoreleaser 77b23fe3db releaser: Prepare repository for 0.59.0-DEV
[ci skip]
2019-09-06 09:26:46 +00:00
hugoreleaser 24277b9202 releaser: Add release notes to /docs for release of 0.58.1
[ci skip]
2019-09-06 09:18:56 +00:00
hugoreleaser 8bc478d3f7 releaser: Bump versions for release of 0.58.1
[ci skip]
2019-09-06 09:18:56 +00:00
hugoreleaser 609a9afbed releaser: Add release notes for 0.58.1
[ci skip]
2019-09-06 09:18:56 +00:00
Bjørn Erik Pedersen 9442937d82 Avoid writing the same processed image to /public twice
Fixes #6307
2019-09-06 11:04:57 +02:00
Bjørn Erik Pedersen 901077c036 hugolib: Fix broken bundle live reload logic
Fixes #6315
Updates #6308
2019-09-06 11:03:23 +02:00
Bjørn Erik Pedersen 24ad429571 deps: Update github.com/bep/gitmap
Fixes #6313
2019-09-06 10:39:21 +02:00
Bjørn Erik Pedersen 3be2c25351 Fix concat with fingerprint regression
In Hugo 0.58 we optimized the transformers that only adjusted metadata, e.g. the fingerprint.

This depended on the source readers implementing `io.ReadSeeker`.

The reader produced by `concat` did that, but the implementation was buggy.

This commit fixes that.

Fixes #6309
2019-09-05 19:59:49 +02:00
Vazrupe (HyeonGyu Lee) 5e66094775 tpl: Remove eq argument limitation
Fixes #6237
2019-09-05 14:38:47 +02:00
hugoreleaser f4e1cb8d05 releaser: Prepare repository for 0.59.0-DEV
[ci skip]
2019-09-04 15:51:16 +00:00
hugoreleaser 64d8bf1ee9 releaser: Add release notes to /docs for release of 0.58.0
[ci skip]
2019-09-04 15:41:58 +00:00
hugoreleaser 10c0baddfa releaser: Bump versions for release of 0.58.0
[ci skip]
2019-09-04 15:41:58 +00:00
Bjørn Erik Pedersen 9d3ae81b91 Release 0.58.0 2019-09-04 17:33:42 +02:00
Bjørn Erik Pedersen bb894ceaf8 Allow slices in the image Filter funcs, not just varargs
[ci skip]

See #6255
2019-09-04 17:24:50 +02:00
Bjørn Erik Pedersen 529c7f1090 Update 0.58.0-relnotes.md
[ci skip]
2019-09-04 13:05:50 +02:00
hugoreleaser 57a54d19d5 releaser: Add release notes for 0.58.0
Rename to *-ready.md to continue.
[ci skip]
2019-09-04 10:39:05 +00:00
Bjørn Erik Pedersen dc3f3df29d hugolib: Adjust Go version specific test
See #6304
2019-09-04 09:50:32 +02:00
Bjørn Erik Pedersen b43130115d Update to Go 1.13
Fixes #6304
2019-09-04 00:54:41 +02:00
Bjørn Erik Pedersen 28501ceb93 hugolib: Remove the old and slow site benchmarks 2019-09-03 21:36:53 +02:00
Bjørn Erik Pedersen 8624b9fe9e Cache processed images by their source path
Fixes #6269
2019-09-03 18:38:57 +02:00
Bjørn Erik Pedersen 018494f363 Remove test artifact 2019-09-03 17:18:18 +02:00
Bjørn Erik Pedersen 43298f028c Make the "is this a Hugo Module" logic more lenient
Now we only try to load modules via Go if there is one or more modules imported in project config.

Fixes #6299
2019-09-03 15:12:33 +02:00
Bjørn Erik Pedersen 1b5c7e327c hugolib: Add a Sass includePaths test
See #6274
2019-09-03 12:25:41 +02:00
Bjørn Erik Pedersen 05d83b6c08 Update to Go 1.11.13 and 1.12.9
Fixes #6228
2019-09-03 10:05:17 +02:00
Bjørn Erik Pedersen 4898fb3d64 Make home.Pages work like any other section
Fixes #6240
2019-09-02 17:34:02 +02:00
Bjørn Erik Pedersen 45d7988f2d Add some fingerprint tests
Closes #6284
Closes #6280
2019-09-02 17:18:32 +02:00
Bjørn Erik Pedersen ce47c21a29 resources: Cache Exif data to disk
```bash
name                        old time/op    new time/op    delta
ImageExif/Cold_cache-4         312µs ±28%     355µs ± 7%     ~     (p=0.343 n=4+4)
ImageExif/Cold_cache,_10-4     479µs ± 6%     546µs ± 0%  +13.91%  (p=0.029 n=4+4)
ImageExif/Warm_cache-4         272µs ± 1%      81µs ± 5%  -70.30%  (p=0.029 n=4+4)

name                        old alloc/op   new alloc/op   delta
ImageExif/Cold_cache-4         151kB ± 0%     161kB ± 0%   +6.46%  (p=0.029 n=4+4)
ImageExif/Cold_cache,_10-4     179kB ± 0%     189kB ± 0%   +5.49%  (p=0.029 n=4+4)
ImageExif/Warm_cache-4         151kB ± 0%      13kB ± 0%  -91.52%  (p=0.029 n=4+4)

name                        old allocs/op  new allocs/op  delta
ImageExif/Cold_cache-4         1.03k ± 0%     1.21k ± 0%  +17.78%  (p=0.029 n=4+4)
ImageExif/Cold_cache,_10-4     1.65k ± 0%     1.83k ± 0%  +11.09%  (p=0.029 n=4+4)
ImageExif/Warm_cache-4         1.03k ± 0%     0.28k ± 0%  -72.40%  (p=0.029 n=4+4)
```

Fixes #6291
2019-09-02 16:37:28 +02:00
Bjørn Erik Pedersen de9cbf6195 Remove metaDataFormat setting
Not in use anymore.
2019-09-01 23:48:51 +02:00
Bjørn Erik Pedersen 4f5011692a resources: Make the Exif benchmark filenames distinct 2019-09-01 22:05:39 +02:00
Bjørn Erik Pedersen 3becba7a98 resources: Add Exif benchmark
See #6291
2019-09-01 18:02:49 +02:00
Bjørn Erik Pedersen 20bdc69a47 resources: Remove unused map type 2019-08-31 21:30:13 +02:00
Bjørn Erik Pedersen 28143397d6 Add image.Exif
Note that we will probably need to add some metadata cache for this to scale.

Fixes #4600
2019-08-31 19:04:56 +02:00
Niklas Fasching 8a8d4a6d97 deps: Update go-org (fix descriptive lists)
</dt> and </dd> closing tags were broken, see
https://github.com/niklasfasching/go-org/pull/9
2019-08-31 15:03:12 +02:00
Jake Jarvis 00297085db tpl: Migrate last shortcodes (YouTube and Vimeo) to HTTPS embeds 2019-08-30 11:55:55 +02:00
Bjørn Erik Pedersen 823f53c861 Add a set of image filters
With this you can do variants of this:

```
{{ $img := resources.Get "images/misc/3-jenny.jpg" }}
{{ $img := $img.Resize "300x" }}
{{ $g1 := $img.Filter images.Grayscale }}
{{ $g2 := $img | images.Filter (images.Saturate 30) (images.GaussianBlur 3) }}
```

Fixes #6255
2019-08-28 15:59:54 +02:00
Bjørn Erik Pedersen f9978ed164 Image resource refactor
This commit pulls most of the image related logic into its own package, to make it easier to reason about and extend.

This is also a rewrite of the transformation logic used in Hugo Pipes, mostly to allow constructs like the one below:

    {{ ($myimg | fingerprint ).Width }}

Fixes #5903
Fixes #6234
Fixes #6266
2019-08-26 15:00:44 +02:00
Niklas Fasching 58d4c0a8be deps: Update go-org (fix footnotes in headlines) 2019-08-24 13:23:42 +02:00
Christian Oliff c5319db9f1 Discrepancy typo fix 2019-08-23 17:21:37 +02:00
Bjørn Erik Pedersen ad1d6d6406 source: Remove debug check left during development
Fixes #6249
2019-08-23 07:37:56 +02:00
Vazrupe (HyeonGyu Lee) fd3d90ced8 hugolib: Change to output non-panic error message if missing shortcode template
A panic occurred when the `nested` variable was nil.
Changed to check if the `nested` variable is nil.

Fixes #6075
2019-08-22 10:40:16 +02:00
hugoreleaser 3ae4b3e19f releaser: Prepare repository for 0.58.0-DEV
[ci skip]
2019-08-17 17:59:28 +00:00
hugoreleaser a849cb2d9b releaser: Add release notes to /docs for release of 0.57.2
[ci skip]
2019-08-17 17:51:54 +00:00
hugoreleaser 01fbb46354 releaser: Bump versions for release of 0.57.2
[ci skip]
2019-08-17 17:51:54 +00:00
hugoreleaser 9958e5e911 releaser: Add release notes for 0.57.2
[ci skip]
2019-08-17 17:51:54 +00:00
Bjørn Erik Pedersen f77a4a2f4a Revert "Update to Go 1.11.13 and 1.12.9"
This reverts commit f28efd3582.
2019-08-17 19:38:12 +02:00
Bjørn Erik Pedersen 88d6993612 tpl: Use RegularPages for RSS template
This is in line with how it was in Hugo 0.56.

See #6238
2019-08-17 19:37:14 +02:00
Bjørn Erik Pedersen ea68160300 hugolib: Don't use the global warning logger
See #6238
2019-08-17 18:50:16 +02:00
Bjørn Erik Pedersen 564cf1bb11 tpl: Avoid "home page warning" in RSS template
See #6238
2019-08-17 18:50:16 +02:00
Bjørn Erik Pedersen 4b4bdcfe74 hugolib: Allow index.md inside bundles
Fixes #6208
2019-08-17 18:50:16 +02:00
Bjørn Erik Pedersen 18836a71ce Adjust the default paginator for sections
To make it in line with 0.56 for sections; only paginate regular pages.

Fixes #6231
2019-08-17 13:08:03 +02:00
Bjørn Erik Pedersen ab40ce679f Revert the 0.57 home.Pages change
In 0.57 we change the behaviour of home.Pages to be in line with the other sections. This has created a lot noise and breakage in the wild.

This commit reverts that change, but adds a warning that we will change this in 0.58 and that you should consider using .Site.RegularPages if that is what you want.
2019-08-17 13:06:39 +02:00
Bjørn Erik Pedersen 416493b548 hugolib: Add a site benchmark 2019-08-16 16:24:21 +02:00
Bjørn Erik Pedersen f28efd3582 Update to Go 1.11.13 and 1.12.9
Fixes #6228
2019-08-16 10:46:34 +02:00
hugoreleaser 36d749f4ea releaser: Prepare repository for 0.58.0-DEV
[ci skip]
2019-08-15 19:00:12 +00:00
hugoreleaser 58c56e9ded releaser: Add release notes to /docs for release of 0.57.1
[ci skip]
2019-08-15 18:52:49 +00:00
hugoreleaser 484106cfa2 releaser: Bump versions for release of 0.57.1
[ci skip]
2019-08-15 18:52:49 +00:00
hugoreleaser 4d60a920fa releaser: Add release notes for 0.57.1
[ci skip]
2019-08-15 18:52:49 +00:00
Bjørn Erik Pedersen 6ccf50ea7b hugolib: Fix draft etc. handling of _index.md pages
We will need to revisit this with a proper spec, but this commit makes sure that draft/expiryDate etc. set in front matter on _index.md content files that should disable the page will:

* Not crash
* Make the rendered page not render any `.Content`.

Fixes #6222
Fixes #6210
2019-08-15 20:41:48 +02:00
Bjørn Erik Pedersen 67524c9936 Fix mainSections logic
Fixes #6217
2019-08-15 20:21:57 +02:00
Bjørn Erik Pedersen 952a319496 Fix live reload mount logic with sub paths
Fixes #6209
2019-08-15 19:14:22 +02:00
Bjørn Erik Pedersen 321418f22a modules: Disable "auto tidy" for now
See #6115
2019-08-15 16:50:02 +02:00
Bjørn Erik Pedersen 7f3aab5ac2 hugolib: Recover and log panics in content init
See #6210
2019-08-15 10:56:49 +02:00
Bjørn Erik Pedersen 028b992611 hugolib: Add some outputs tests
See #6210
2019-08-15 10:30:37 +02:00
Bjørn Erik Pedersen 9475f61a37 hugolib: Fix taxonomies vs expired
In Hugo 0.57 we needed to delay the page metadata initialization until we had built the page graph.

This introduced a regression in that we now created taxonomy entries for expired pages.

This fixes that by moving the "should not build" filter before we assemble the taxonomies.

Fixes #6213
2019-08-15 09:52:08 +02:00
HyeonGyu Lee ea9261e856 commands: Make sure the hugo field is always initialized before it's used
Wrap the field to make it accessible after initialization.

Fixes #6193
2019-08-15 09:33:47 +02:00
hugoreleaser 37f5929803 releaser: Prepare repository for 0.58.0-DEV
[ci skip]
2019-08-14 08:13:53 +00:00
hugoreleaser 9b00e64765 releaser: Add release notes to /docs for release of 0.57.0
[ci skip]
2019-08-14 08:05:33 +00:00
hugoreleaser ab849fcc98 releaser: Bump versions for release of 0.57.0
[ci skip]
2019-08-14 08:05:33 +00:00
hugoreleaser 8a4c080cc5 Add release notes for 0.57.0 2019-08-14 09:56:35 +02:00
Bjørn Erik Pedersen 4644b95bd5 hugolib: Remove temporary warning 2019-08-14 08:11:39 +02:00
Bjørn Erik Pedersen 1089cfe4e1 Add FileInfo to resources created with resources.Match etc.
Without it, image resize fails.

See #6190
2019-08-13 18:45:08 +02:00
Bjørn Erik Pedersen cd575023af Improve the server assets cache invalidation logic
Fixes #6199
2019-08-13 18:09:46 +02:00
Bjørn Erik Pedersen 6315098104 modules: Do not fail build on errors in theme.toml
Fixes #6162
2019-08-13 18:09:11 +02:00
Bjørn Erik Pedersen b64617fe4f Add resources.Match and resources.GetMatch
Fix #6190
2019-08-13 11:44:20 +02:00
Bjørn Erik Pedersen 17ca8f0c4c commands: Fix faulty -h logic in hugo mod get
Fixes #6197
2019-08-13 11:17:19 +02:00
Bjørn Erik Pedersen 9e57182705 tests: Convert from testify to quicktest 2019-08-12 13:26:32 +02:00
Christian Muehlhaeuser 6027ee1108 Avoid unnecessary conversions
No need to convert these types.
2019-08-10 20:12:38 +02:00
Christian Muehlhaeuser c577a9ed23 Fixed ineffectual assignments
Dropped/fixed ineffectual assignments after static code analysis.
2019-08-10 20:11:51 +02:00
Christian Muehlhaeuser a93cbb0d6c Simplify code
- Use bytes.Equal instead of bytes.Compare
- Omit range's value where it's unused
2019-08-10 20:10:32 +02:00
Bjørn Erik Pedersen bd98182dbd Implement cascading front matter
Fixes #6041
2019-08-10 20:07:42 +02:00
Christian Muehlhaeuser e88d798990 Fixed tautological error conditions
Drop error & nil checks where the value can not have changed.
2019-08-10 01:04:43 +02:00
XhmikosR c0eef3b401 Use the SVG logo in README.md 2019-08-09 16:58:41 +02:00
Bjørn Erik Pedersen 166a394a2f Fix static sync issue with virtual mounts
Fixes #6165
2019-08-09 10:18:28 +02:00
Bjørn Erik Pedersen 8243952046 Add a branch bundle test case
See #6173
2019-08-09 09:44:41 +02:00
Bjørn Erik Pedersen 7ff0a8ee9f Simplify page tree logic
This is preparation for #6041.

For historic reasons, the code for bulding the section tree and the taxonomies were very much separate.

This works, but makes it hard to extend, maintain, and possibly not so fast as it could be.

This simplification also introduces 3 slightly breaking changes, which I suspect most people will be pleased about. See referenced issues:

This commit also switches the radix tree dependency to a mutable implementation: github.com/armon/go-radix.

Fixes #6154
Fixes #6153
Fixes #6152
2019-08-08 20:13:39 +02:00
Bjørn Erik Pedersen df374851a0 hugolib: Add some more site benchmarks 2019-08-08 11:04:47 +02:00
HyeonGyu Lee a843ca53b5 transform/urlreplacers: Cache the next position of urlreplacer.prefix
Improved performance due to `bytes.Index` repeated calls

Fixes #5942
2019-08-06 17:46:20 +02:00
Bjørn Erik Pedersen 02397e76ce postcss: Fix no-map vs noMap discrepancy
Fixes #6166
2019-08-05 13:48:58 +02:00
Bjørn Erik Pedersen de87624241 hugolib: Fix output format handling of mix cased page kinds
Fixes #4528
2019-08-05 11:22:03 +02:00
Bjørn Erik Pedersen 9ef4dca361 hugolib: Fix broken test 2019-08-01 22:09:58 +02:00
Bjørn Erik Pedersen 2d1d33673d tpl: Regenerate templates 2019-08-01 14:05:20 +02:00
Christian Oliff be0d4efc3d tpl: Always load GitHub Gists over HTTPS 2019-08-01 13:57:41 +02:00
XhmikosR f7f549e3a7 Fix assorted typos 2019-08-01 13:55:48 +02:00
Shawn Smith 6512d128c6 common/collections: Fix typo 2019-08-01 13:52:05 +02:00
Robin Andersson b8758de19e examples: Fix multilingual example compatibility with latest version 2019-08-01 13:49:07 +02:00
Bjørn Erik Pedersen 53077b0da5 Merge pull request #6149 from bep/sort-caseinsensitive
Implement lexicographically string sorting
2019-08-01 10:19:19 +02:00
hugoreleaser a4f96a9d8c releaser: Prepare repository for 0.57.0-DEV
[ci skip]
2019-07-31 12:56:14 +00:00
hugoreleaser f637a1eace releaser: Add release notes to /docs for release of 0.56.3
[ci skip]
2019-07-31 12:48:33 +00:00
hugoreleaser 9433c3c706 releaser: Bump versions for release of 0.56.3
[ci skip]
2019-07-31 12:48:33 +00:00
hugoreleaser 7b448340c0 releaser: Add release notes for 0.56.3
[ci skip]
2019-07-31 12:48:33 +00:00
Bjørn Erik Pedersen 0e086785fa hugolib: Fix bundle header clone logic
Fixes #6136
2019-07-31 14:20:24 +02:00
Bjørn Erik Pedersen 02b947eaa3 docs: Regenerate CLI docs 2019-07-31 12:11:22 +02:00
Bjørn Erik Pedersen d7c233afee commands: Add "hugo config mounts" command
This prints the effective file mounts in a project.

Fixes #6144
2019-07-31 12:10:05 +02:00
Bjørn Erik Pedersen 45ee8a7a52 commands: Cleanup the hugo config command
Most importantly filter out some keys not relevant for the end user.

See #6144
2019-07-31 12:10:05 +02:00
Bjørn Erik Pedersen 4b6c5eba30 Move the mount duplicate filter to the modules package
Also simplify the mount validation logic. There are plenty of ways a user can create mount configs that behaves oddly.
2019-07-31 12:10:05 +02:00
Bjørn Erik Pedersen edf9f0a354 Allow overlap in module mounts
Fixes #6146
2019-07-31 12:10:05 +02:00
Bjørn Erik Pedersen 36220851e4 Fix self-mounts on the main project
Fixes #6143
2019-07-31 12:10:05 +02:00
hugoreleaser 53ade40ba4 releaser: Prepare repository for 0.57.0-DEV
[ci skip]
2019-07-30 09:12:29 +00:00
hugoreleaser 5f033a7fcc releaser: Add release notes to /docs for release of 0.56.2
[ci skip]
2019-07-30 09:05:09 +00:00
hugoreleaser 2e6da00679 releaser: Bump versions for release of 0.56.2
[ci skip]
2019-07-30 09:05:09 +00:00
hugoreleaser 06f29068f8 releaser: Add release notes for 0.56.2
[ci skip]
2019-07-30 09:05:09 +00:00
Bjørn Erik Pedersen 84bc8d84e4 Add some more content language test assertions
See #6136
2019-07-30 09:58:58 +02:00
Bjørn Erik Pedersen 6eca0a3dee commands: Fix config reloading in Vim and similar
The config path was simplified in Hugo 0.56.0 to support more config dirs/files (go.mod etc.),
and the new code path assumed that every file change would trigger a `Write` event.

This is not true for Vim etc. which triggers a `Chmod` and then a `Rename`.

Lesson learned: Be really careful changing Os/editor specific code without proper tests.

Fixes #6139
2019-07-30 09:35:01 +02:00
Bjørn Erik Pedersen e28bd4c0f8 Fix Jekyll import
Fixes #6131
2019-07-30 09:14:14 +02:00
Bjørn Erik Pedersen 2c7c361091 releaser: Create a proper automated title for patch releases
Fixes #6126
2019-07-30 09:02:03 +02:00
Bjørn Erik Pedersen c62bbf7b11 Fix image format detection for upper case extensions, e.g. JPG
This regression was introduced in 0.56.0.

Fixes #6137
2019-07-30 08:53:50 +02:00
Bjørn Erik Pedersen 00a238e32c Fix i18n project vs theme order
Fixes #6134
2019-07-29 19:10:15 +02:00
Bjørn Erik Pedersen e5f9602459 Add proper error message when receiving nil in Resource transformation
Closes #6128
2019-07-29 09:59:39 +02:00
Bjørn Erik Pedersen 9f497e7b5f Merge branch 'release-0.56.1' 2019-07-28 17:06:46 +02:00
hugoreleaser 3ad16af6f8 releaser: Prepare repository for 0.57.0-DEV
[ci skip]
2019-07-28 15:05:28 +00:00
Niklas Fasching 56908509eb deps: Update go-org to v0.1.2
fixes superfluous whitespace around code blocks due to misuse of pre tag
2019-07-28 16:52:27 +02:00
hugoreleaser 0ad218afc5 releaser: Add release notes to /docs for release of 0.56.1
[ci skip]
2019-07-28 14:51:43 +00:00
hugoreleaser b5fda703f9 releaser: Bump versions for release of 0.56.1
[ci skip]
2019-07-28 14:51:43 +00:00
hugoreleaser 447700228c releaser: Add release notes for 0.56.1
[ci skip]
2019-07-28 14:51:43 +00:00
Bjørn Erik Pedersen 544f826dd6 releaser: Make it a one click release for patch releases 2019-07-28 15:05:15 +02:00
Bjørn Erik Pedersen e393c6290e common/maps: Do not return error on params dot access on incompatible types
This error was introduced in 0.56 and has shown some site breakage in the wild.

Fixes #6121
2019-07-28 13:03:12 +02:00
Bjørn Erik Pedersen 93d02aabe6 resources: Fix image Width/Height regression
Fixes #6120
2019-07-28 12:34:18 +02:00
Bjørn Erik Pedersen 508db1906b Revert "cache/filecache: Skip resource cache init if the fs is missing"
I need to revisit this.

This reverts commit da4c4a7789.
2019-07-26 16:29:33 +02:00
Bjørn Erik Pedersen e5fe378925 modules: Set GO111MODULE=on
Fixes #6114
2019-07-26 10:55:50 +02:00
Bjørn Erik Pedersen da4c4a7789 cache/filecache: Skip resource cache init if the fs is missing
Fixes #6113
2019-07-26 10:45:07 +02:00
hugoreleaser b4827fbb14 releaser: Prepare repository for 0.57.0-DEV
[ci skip]
2019-07-25 16:45:08 +00:00
hugoreleaser 45f4eb9846 releaser: Add release notes to /docs for release of 0.56.0
[ci skip]
2019-07-25 16:37:58 +00:00
hugoreleaser 263f86d456 releaser: Bump versions for release of 0.56.0
[ci skip]
2019-07-25 16:37:58 +00:00
Bjørn Erik Pedersen bed75108e4 Update release notes 2019-07-25 18:29:55 +02:00
hugoreleaser 8d7006d853 releaser: Add release notes draft for 0.56.0
Rename to *-ready.md to continue. [ci skip]
2019-07-25 15:58:15 +00:00
Bjørn Erik Pedersen e5b6e2085a resources: Fix test on Windows 2019-07-25 16:54:05 +02:00
Bjørn Erik Pedersen 77bf2991b1 docs: Add Hugo Modules docs 2019-07-25 13:21:30 +02:00
Bjørn Erik Pedersen e5f2299741 Block symlink dir traversal for /static
This is in line with how it behaved before, but it was lifted a little for the project mount for Hugo Modules,
but that could create hard-to-detect loops.
2019-07-25 11:27:25 +02:00
Bjørn Erik Pedersen 87a07282a2 modules: Gofmt 2019-07-24 23:31:30 +02:00
Bjørn Erik Pedersen 882d678bbf modules: Rename disabled => disable in config 2019-07-24 21:46:24 +02:00
Bjørn Erik Pedersen fa28df1058 hugolib: Fix broken test 2019-07-24 19:50:34 +02:00
Bjørn Erik Pedersen 072aa7f110 hugolib: Add a symdiff test 2019-07-24 10:05:09 +02:00
Bjørn Erik Pedersen 215d2ed883 docs: Regenerate CLI docs 2019-07-24 09:40:41 +02:00
Bjørn Erik Pedersen 23adc0c2d9 docs: Regenerate data helpers 2019-07-24 09:39:12 +02:00
Bjørn Erik Pedersen 461b0e066f Merge commit '5cb4e46cfa65bddae8ac5344540e3dd1e4c266b2' 2019-07-24 09:36:50 +02:00
Bjørn Erik Pedersen 5cb4e46cfa Squashed 'docs/' changes from 540aeddc7..41aae7abb
41aae7abb Better deploy script example

git-subtree-dir: docs
git-subtree-split: 41aae7abb3
2019-07-24 09:36:50 +02:00
Bjørn Erik Pedersen 9f5a92078a Add Hugo Modules
This commit implements Hugo Modules.

This is a broad subject, but some keywords include:

* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`,  `hugo mod get`,  `hugo mod graph`,  `hugo mod tidy`, and  `hugo mod vendor`.

All of the above is backed by Go Modules.

Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-07-24 09:35:53 +02:00
Bjørn Erik Pedersen 47953148b6 deps: Tidy 2019-07-23 00:13:46 +02:00
Bjørn Erik Pedersen 2fc0abd22a Fix livereload for @import case
Fixes #6106
2019-07-22 13:54:24 +02:00
peaceiris 53da3881de releaser: Remove unused function
gitLog function is not used
2019-07-20 12:33:30 +02:00
Bjørn Erik Pedersen ac101aba4f deps: Update xerrors
To get it to build on Go 1.13.
2019-07-19 09:09:04 +02:00
Bjørn Erik Pedersen 58a47ccde0 travis: Ignore errors in go mod download
It sometimes fails with 502 errors, but the dependency download later when tests are run.
2019-07-17 15:35:31 +02:00
Bjørn Erik Pedersen 95b1d3013b deps: Update Chroma
Fixes #6088
2019-07-16 21:08:18 +02:00
Eric Selin a5604e18b0 resource/postcss: Change postcss to check for local installation under node_modules/.bin
Fixes #5091
2019-07-16 10:02:20 +02:00
Bjørn Erik Pedersen 05d0eddd2b Merge commit '35febb2e2a3780c3338a2665fddea7dda28a17f4' 2019-07-15 23:50:56 +02:00
Bjørn Erik Pedersen 35febb2e2a Squashed 'docs/' changes from 0c3c04fd6..540aeddc7
540aeddc7 Small fixes for Open Graph internal template
47bbb3fd7 Bump lodash.template from 4.4.0 to 4.5.0 in /themes/gohugoioTheme
64c1cc3db Update title.md
36c27be37 Update configuration.md
4627cfe9a added commento.io to the list
341d9d945 Fix link to font assets
4a6876dec Small typo fix in configuration.md
736d6ddd7 Add bypasscensorship.org showcase.
de7ab636b Use actual width in image processing examples
6c88ab2da Update directory-structure.md
88f559e81 Fix spelling mistakes
7bd427141 Rephrase four points from Hosting on Github docs
bce1b1832 Fix typos for absLangURL and relLangURL functions
abab57335 Update directory-structure.md
a6716f2ed Fix metadata list
5ef61d912 Fix typo
d9e467b8b Actuall show how to generate pages in quickstart
0aadc92e7 Update link to issue theme submission
b1902faaa Remove incorrect note about Hugo snap --classic use.
d451e7362 Update documentation on page variables
ab2233c39 Update publish_to_ghpages.sh
7c120346b Fix typo in syntax highlighting page.
f01dc555d Correct some typos
be825ade9 Videos plural produces og:video
bc962fbdf Updated installing.md file to include linuxbrew installation
08c9f8fc8 Mention 1 MB file size limit in readFile doc
7145e29e2 Fixes bad URL in menus.md for .hasChildren * part of issue #814
0edbd59c4 add warning about .Hugo variable being deprecated
77f74ced5 fix: typo in output-formats.md
f71b67f34 Correct typo "RFC339" to "RFC1123Z" (#837)
424c0207a baseurl -> baseURL
f4e24a03e Render launched; no invite code needed
37e1101d3 Add Render hosting guide
01d0a6481 Bump js-yaml from 3.12.0 to 3.13.1 in /themes/gohugoioTheme
edb7b36b0 Link site hierarchy schema to larger version
af72acda0 Fixes typo in fingerprint.md
0a738467b Adding required XML tag to sample templates
52211f656 Remove note that XML declaration is not needed
a39b9ac87 Adding required XML tag to sample templates
1a44d8a50 Add configuration information for Azure
5b7c6b5a1 remove google plus
5a64301ba HTTPS link to yaml.org/spec/

git-subtree-dir: docs
git-subtree-split: 540aeddc79
2019-07-15 23:49:41 +02:00
Bjørn Erik Pedersen c624a77992 tpl/collections: Add Merge function
Merges two maps recursively and returns a new one. Merge is case-insensitive.

Fixes #5992
2019-07-15 20:47:35 +02:00
Niklas Fasching 020086cb2b Add org to front matter formats
actually it's 5, there's also csv. Afaict it's not meant to be used in that way
though so let's just add org.
2019-07-10 11:14:37 +02:00
Niklas Fasching 8524baee16 deps: Update go-org
- added support for anonymous footnotes
- changed source block html output to more closely resemble emacs org-export
  output
2019-07-10 11:14:37 +02:00
Kaushal Modi 90b0127f63 Fix typo s/Meny/Menu/ 2019-07-09 17:28:53 +02:00
Bjørn Erik Pedersen 7611078dae hugolib: Add testfile to .gitignore 2019-07-07 13:01:30 +02:00
Bjørn Erik Pedersen b2a3d4644b tpl/tplimpl: Regenerate templates 2019-06-26 22:39:32 +02:00
Mark Mandel 88c8a15be1 Pagination - do not render href if no next item
When using a html link checker with Hugo, this template consistently causes errors, as it renders `href=""` attributes when next/previous is disabled.

This change makes it so that the `href` attribute is not rendered at all if `HasNext` is false - which is better semantically, and makes link checking far easier.
2019-06-26 22:38:30 +02:00
Justin Van Patten 59c4bc52ed Include path to source page in non-relative ref/relref warning
We occasionally see warnings when building our site:

```
WARN 2019/06/25 23:07:08 make non-relative ref/relref page reference(s) in page %q absolute, e.g. {{< ref "/blog/my-post.md" >}}
```

But the `%q` value is missing, making it difficult to track down the source of the warning.

This change addresses that, by including the source path in the warning:

```
WARN 2019/06/25 23:07:31 make non-relative ref/relref page reference(s) in page "blog/my-post/index.md" absolute, e.g. {{< ref "/blog/my-post.md" >}}
```
2019-06-26 09:25:12 +02:00
Bjørn Erik Pedersen dc1d4a9200 hugolib: Add another site benchmark
Also rework test test setup so the benchmarks can also be run as tests, which
is useful when creating new benchmarks an make sure they ... work.
2019-06-26 09:09:40 +02:00
Joshua Arnott de7b9475c0 commands: Remove comma after URL in new site output
Some terminals include the comma in the URL when hyperlinking, resulting in a 404
2019-06-19 23:03:30 +02:00
Bjørn Erik Pedersen d6ca728ff3 deps: Revert to an older version of Blackfriday
See #6040
2019-06-16 22:13:23 +02:00
Christian Oliff ff10aa522d examples: Update link to prevent redirect 2019-06-12 13:56:05 +02:00
Christian Oliff 9f258d2b8f examples: Update URLs 2019-06-12 12:29:19 +02:00
Bjørn Erik Pedersen 31c9c690fd releaser: Update Go Releaser and consolidate the 2 configs
Fixes #5949
2019-06-11 00:02:06 +02:00
Bjørn Erik Pedersen e8a716b23a tpl/collections: Fix slice type handling in sort
The `sort` template func was producing a `[]page.Page` which did not work in `.Paginate`.

Fixes #6023
2019-06-10 08:32:44 +02:00
Bjørn Erik Pedersen 3e6cb2cb77 hugolib: Fix bundle path when slug is set
Fixes #4870
2019-06-09 16:55:08 +02:00
Bjørn Erik Pedersen 8d898ad667 tpl/collections: Unwrap any interface value in sort and where
Hugo `0.55.0` introduced some new interface types for `Page` etc.

This worked great in general, but there were cases where this would fail in `where` and `sort`.

One such example would be sorting by `MenuItem.Page.Date` where `Page` on `MenuItem` was a small subset of the bigger `page.Page` interface.

This commit fixes that by unwrapping such interface values.

Fixes #5989
2019-06-09 16:54:36 +02:00
Niklas Fasching fad183c4ae Refactor Org mode front matter: Introduce '#+KEY[]:' array notation
Hugo requires some front matter values to be arrays (e.g. for taxonomies).
Org mode front matter syntax (`#+KEY: VALUE`) does however not support anything
but string values normally - which is why goorgeous hardcoded the values for
the keys tags, categories & aliases to be parsed as string arrays. This causes
problems with custom taxonomies.

A simple thing we can do instead is make keywords ending in '[]' be parsed as
string arrays.
2019-06-08 10:13:00 +02:00
Niklas Fasching b6867bf806 Improve Org mode support: Replace goorgeous with go-org
Sadly, goorgeous has not been updated in over a year and still has a lot of
open issues (e.g. no support for nested lists).

go-org fixes most of those issues and supports a larger subset of Org mode
syntax.
2019-06-08 10:13:00 +02:00
Robert van Gent 9df57154ee deploy: Default --target to the first deployment target 2019-06-08 00:41:59 +02:00
Vincent Fiduccia 35abce27ca Add safety barrier between concatenated javascript resources 2019-06-02 10:23:48 +02:00
Robert van Gent 8914fe7ed7 Update CLI doc for "long" form 2019-05-31 22:08:12 +02:00
Robert van Gent b0f536fb27 Drop dashes in http header matcher attributes; other changes from code review 2019-05-31 22:08:12 +02:00
Robert van Gent 1384d77a04 docs: Add documentation for "hugo deploy" 2019-05-31 22:08:12 +02:00
Robert van Gent 5e83f42562 deploy: remove TODO comment about subfolders; handled by GoCDK blob URLs 2019-05-30 22:42:44 +02:00
Robert van Gent b376b2685a deps: Update gocloud.dev to v0.15.0. 2019-05-30 22:07:04 +02:00
Anton Harniakou fb007e9ae5 tpl/collections: Convert numeric values to float64 and compare them
Fixes #5685
2019-05-30 11:32:58 +02:00
Bjørn Erik Pedersen 4c560020bc resources: Return nil when not found in resources.Get
Fixes #5999
2019-05-29 22:33:03 +02:00
Bjørn Erik Pedersen d44d3ea898 deps: Update Viper
This will hopefully improve the dependency/install problems we have seen lately.

See #5954
2019-05-28 16:11:09 +02:00
Bruno Amaral d1cf53f5f4 Remove references to Google+
According to google, this is no longer supported and structured data should be used instead: https://support.google.com/webmasters/answer/6083347?hl=en
2019-05-26 19:24:45 +02:00
Bjørn Erik Pedersen 811ee996a6 Update gitmap to get CommitDate field 2019-05-25 10:43:09 +02:00
Bjørn Erik Pedersen 4f61a926f6 Merge commit 'be04ece8590f775a52ea167fbe4555753e8c5211' 2019-05-25 10:41:51 +02:00
Bjørn Erik Pedersen be04ece859 Squashed 'docs/' changes from 50c02516c..0c3c04fd6
0c3c04fd6 Merge pull request #827 from BCNelson/range-patch
b14dd3505 Updated link to Go Docs to more helpful page
c3d83149a Boolean Values in the Where Function
56d4cea3c hugo-extended no longer the default
e9b15c698 Update index.md
11de98e0d Release 0.55.6
d2def17f4 Merge branch 'release-0.55.6'
115457b70 releaser: Add release notes to /docs for release of 0.55.6
25855690d Fix misspelling
fc5e43db2 Update 404.md with Netlify Instructions
9f684318f Removed mentioning of removed --stepAnalysis command line option
86ba9071c Related md5 and aliases for sha1/sha256
15f48966a Added related sha function into the See Also
5e08b6930 Fix date description
908e87ab2 Revert docs/config.toml changes
c925646cf Add a "deploy" command
e765084dd Update sectionvars.md
e08be4d81 Update sectionvars.md
7c9653cbe Hugo 0.55.5
1035ff028 releaser: Add release notes to /docs for release of 0.55.5
cda21f9d4 docs: Regenerate docs helper

git-subtree-dir: docs
git-subtree-split: 0c3c04fd63
2019-05-25 10:41:23 +02:00
Ruslan Nasonov 5b4b8bb3c1 commands: Create new 'hugo list all' command
New:
- command `hugo list all`, return all posts meta in csv format

Refactoring:
- move common parts in commands/list.go to function `buildSites`
- change way to detect path to content

See #5904
2019-05-25 00:09:51 +02:00
Brice BERDAH 2278b0eb02 Medium -> Hugo exporting tool
Suggesting a simple yet powerful tool for people looking to export their Medium blog to Hugo
2019-05-24 15:35:41 +02:00
Brian 'Redbeard' Harrington 41974303f3 dockerfile: Switch base image for final build
Switching the base image for the final build to alpine as it still
provides a minimal interface, but has a mechanism for easily including
relevant CA certificates.  This is currently pinned to a tagged version,
though since none of the underlying mechanisms are used this should
balance both remaining stable, supported for a period of time, and
providing usable functionality.

Resolves #5970
Affects #5056
2019-05-23 12:49:13 -06:00
Bjørn Erik Pedersen 6b3f1a1002 Merge branch 'release-0.55.6' 2019-05-18 10:18:23 +02:00
hugoreleaser fa8e334dae releaser: Prepare repository for 0.56.0-DEV
[ci skip]
2019-05-18 07:57:50 +00:00
hugoreleaser a5d4c82d2f releaser: Add release notes to /docs for release of 0.55.6
[ci skip]
2019-05-18 07:55:28 +00:00
hugoreleaser 32f4b38338 releaser: Bump versions for release of 0.55.6
[ci skip]
2019-05-18 07:55:28 +00:00
Bjørn Erik Pedersen 9b48c5d6bd Release 0.55.6 2019-05-18 09:50:50 +02:00
hugoreleaser 8a1873a2d5 releaser: Add release notes draft for 0.55.6
Rename to *-ready.md to continue. [ci skip]
2019-05-18 07:39:23 +00:00
Bjørn Erik Pedersen 95ce2a40e7 hugolib: Prevent parallel server rebuilds
There have been reports about infrequent paginator crashes when running the Hugo server since 0.55.0.

The reason have been narrowed down to that of parallel rebuilds.

This isn't a new thing, but the changes in 0.55.0 made it extra important to serialize the page initialization.

This commit fixes that by protecting the `Build` method with a lock when running in server mode.

Fixes #5885
Fixes #5968
2019-05-18 09:01:40 +02:00
Rodolfo Carvalho e22b3f54c3 tpl: Fix internal templates usage of safeHTMLAttr
The `safeHTMLAttr` function operates on a full attribute definition, not
just within the attribute value.

Docs: https://gohugo.io/functions/safehtmlattr/

For `opengraph.html`, run the whole `content` HTML attribute through
`safeHTMLAttr`. That will preserve `+` signs in formatted dates.

For `vimeo_simple.html`, `safeHTMLAttr` was in the context of an
attribute value, thus having no effect. In this case we could replace it
with `safeURL`, but since the code is coming from an API it is safer to
just let Go's template engine sanitize the value as it already does with
`provider_url`.

Fixes #5236 (no need to change Go upstream)
Related to #5246
2019-05-17 16:00:54 +02:00
Bjørn Erik Pedersen 71b8d8b6a4 Update to Go 1.12.5 and Go 1.11.10
Fixes #5944
2019-05-15 07:49:04 +02:00
Robert van Gent 5dc6d0df94 deploy: Add tests; fix Windows 2019-05-09 22:11:23 +02:00
Robert van Gent 527cf1ab03 deploy: Support configuration of upload order 2019-05-06 22:59:07 +02:00
Robert van Gent f4956d9aae deploy: Support invalidating a CloudFront CDN cache 2019-05-06 21:09:33 +02:00
Bjørn Erik Pedersen 2838d58b1d i18n: Move the package below /langs
To get fewer top level packages.
2019-05-04 18:25:56 +02:00
Robert van Gent f330e869e4 deploy: compute MD5 by reading if List didn't provide one 2019-05-04 09:31:34 +02:00
Robert van Gent f2b5d4de34 Revert docs/config.toml changes 2019-05-03 17:58:40 +02:00
Bjørn Erik Pedersen 0091b1f893 travis: Use proxy.golang.org 2019-05-03 17:58:40 +02:00
Robert van Gent c7165589b3 Add a "deploy" command 2019-05-03 17:58:40 +02:00
Bjørn Erik Pedersen ad5703a917 hugolib: Disable racy test
See #5926
2019-05-03 09:20:39 +02:00
hugoreleaser f94a388ad3 releaser: Prepare repository for 0.56.0-DEV
[ci skip]
2019-05-02 13:06:04 +00:00
hugoreleaser a83256b9cd releaser: Add release notes to /docs for release of 0.55.5
[ci skip]
2019-05-02 13:03:34 +00:00
hugoreleaser 77ad1336d2 releaser: Bump versions for release of 0.55.5
[ci skip]
2019-05-02 13:03:34 +00:00
Bjørn Erik Pedersen e33ed29b75 Release 0.55.5 2019-05-02 14:50:04 +02:00
hugoreleaser 2fb708d3d0 releaser: Add release notes draft for 0.55.5
Rename to *-ready.md to continue. [ci skip]
2019-05-02 12:36:11 +00:00
Bjørn Erik Pedersen cee181c3a6 docs: Regenerate docs helper 2019-05-02 14:26:02 +02:00
Bjørn Erik Pedersen b1d438ea28 Merge commit 'f147b5c53eda15982e0fe762847532eeddb7485f' 2019-05-02 14:24:13 +02:00
Bjørn Erik Pedersen f147b5c53e Squashed 'docs/' changes from 13097daf2..50c02516c
50c02516c resources: Clean
380554caf Added Pharmaseal case study
bd462671d Fix typo
0522a2595 no -> fr
f2c4671db Fix broken Netlify setup
056da25f2 Release 0.55.4
2ddca746e Merge branch 'temp554'
3d6cf9967 releaser: Add release notes to /docs for release of 0.55.4
9dc637cab Minor link fix
95186103c Release 0.55.3
b2449cd25 releaser: Add release notes to /docs for release of 0.55.3
55934c3a2 docs: Regenerate docs helper

git-subtree-dir: docs
git-subtree-split: 50c02516cb
2019-05-02 14:23:40 +02:00
Bjørn Erik Pedersen 6b76841b05 output: Fix permalink in sitemap etc. when multiple permalinkable output formats
In Hugo 0.55.0 we made AMP `permalinkable`. We also render the output formats in their natural sort order, meaning `AMP` will be rendered before `HTML`. References in the sitemap would then point to the AMP version, and this is normally not what you'd want.

This commit fixes that by making `HTML` by default sort before the others.

If this is not you want, you can set `weight` on the output format configuration.

Fixes #5910
2019-05-02 14:23:16 +02:00
Bjørn Erik Pedersen bcbed4ebda hugolib: Fix PrevInSection/NextInSection for nested sections
This was broken in Hugo 0.55.0.

Fixes #5883
2019-05-01 19:34:28 +02:00
Bjørn Erik Pedersen 009076e5ee lazy: Fix concurrent initialization order
Fixes #5901
2019-05-01 16:00:31 +02:00
David Birks 1cbb501be8 Update blackfriday to v1.5.2 2019-05-01 11:56:53 +02:00
Bjørn Erik Pedersen 66b143a01d tpl/compare: Fix nil compare in eq/ne for interface values
Fixes #5905
2019-04-29 18:43:44 +02:00
Cameron Moore 4f93f8c670 tpl: Fix hugo package name and add godocs 2019-04-27 22:44:57 +02:00
Cameron Moore f76e50118b tpl: Provide more detailed errors in Where 2019-04-27 09:54:22 +02:00
hugoreleaser f84df16fea releaser: Prepare repository for 0.56.0-DEV
[ci skip]
2019-04-25 07:41:16 +00:00
hugoreleaser 579004178b releaser: Add release notes to /docs for release of 0.55.4
[ci skip]
2019-04-25 07:38:48 +00:00
hugoreleaser f2fbca23aa releaser: Bump versions for release of 0.55.4
[ci skip]
2019-04-25 07:38:48 +00:00
Bjørn Erik Pedersen 1707f1a5f5 Release 0.55.4 2019-04-25 09:28:17 +02:00
hugoreleaser 211d667979 releaser: Add release notes draft for 0.55.4
Rename to *-ready.md to continue. [ci skip]
2019-04-25 07:26:35 +00:00
Bjørn Erik Pedersen 33c738116c hugolib: Fix shortcode version=1 logic
Fixes #5831
2019-04-24 15:35:04 +02:00
Bjørn Erik Pedersen 69a56420ae hugolib: Avoid recloning of shortcode templates
```bash
benchmark                                    old ns/op     new ns/op     delta
BenchmarkSiteNew/Bundle_with_image-4         14572242      14382188      -1.30%
BenchmarkSiteNew/Bundle_with_JSON_file-4     13683922      13738196      +0.40%
BenchmarkSiteNew/Multiple_languages-4        41912231      25192494      -39.89%

benchmark                                    old allocs     new allocs     delta
BenchmarkSiteNew/Bundle_with_image-4         57496          57493          -0.01%
BenchmarkSiteNew/Bundle_with_JSON_file-4     57492          57501          +0.02%
BenchmarkSiteNew/Multiple_languages-4        242422         118809         -50.99%

benchmark                                    old bytes     new bytes     delta
BenchmarkSiteNew/Bundle_with_image-4         3845077       3844065       -0.03%
BenchmarkSiteNew/Bundle_with_JSON_file-4     3627442       3627798       +0.01%
BenchmarkSiteNew/Multiple_languages-4        13963502      7543885       -45.97%
```

Fixes #5890
2019-04-24 12:37:57 +02:00
Bjørn Erik Pedersen 4756ec3cd8 i18n: Avoid rebuilding the Translations map for every lookup
```bash
benchmark                                                    old ns/op     new ns/op     delta
BenchmarkI18nTranslate/all-present-4                         764           757           -0.92%
BenchmarkI18nTranslate/present-in-default-4                  2578          1457          -43.48%
BenchmarkI18nTranslate/present-in-current-4                  764           766           +0.26%
BenchmarkI18nTranslate/missing-4                             3362          1103          -67.19%
BenchmarkI18nTranslate/file-missing-4                        4646          3611          -22.28%
BenchmarkI18nTranslate/context-provided-4                    2013          2014          +0.05%
BenchmarkI18nTranslate/same-id-and-translation-4             1961          784           -60.02%
BenchmarkI18nTranslate/same-id-and-translation-default-4     3717          1405          -62.20%
BenchmarkI18nTranslate/unknown-language-code-4               1775          1787          +0.68%

benchmark                                                    old allocs     new allocs     delta
BenchmarkI18nTranslate/all-present-4                         6              6              +0.00%
BenchmarkI18nTranslate/present-in-default-4                  16             10             -37.50%
BenchmarkI18nTranslate/present-in-current-4                  6              6              +0.00%
BenchmarkI18nTranslate/missing-4                             20             8              -60.00%
BenchmarkI18nTranslate/file-missing-4                        27             21             -22.22%
BenchmarkI18nTranslate/context-provided-4                    15             15             +0.00%
BenchmarkI18nTranslate/same-id-and-translation-4             12             6              -50.00%
BenchmarkI18nTranslate/same-id-and-translation-default-4     22             10             -54.55%
BenchmarkI18nTranslate/unknown-language-code-4               13             13             +0.00%

benchmark                                                    old bytes     new bytes     delta
BenchmarkI18nTranslate/all-present-4                         152           152           +0.00%
BenchmarkI18nTranslate/present-in-default-4                  1144          216           -81.12%
BenchmarkI18nTranslate/present-in-current-4                  152           152           +0.00%
BenchmarkI18nTranslate/missing-4                             2008          152           -92.43%
BenchmarkI18nTranslate/file-missing-4                        1208          600           -50.33%
BenchmarkI18nTranslate/context-provided-4                    704           704           +0.00%
BenchmarkI18nTranslate/same-id-and-translation-4             1080          152           -85.93%
BenchmarkI18nTranslate/same-id-and-translation-default-4     2073          216           -89.58%
BenchmarkI18nTranslate/unknown-language-code-4               696           696           +0.00%
```

Fixes #5892
2019-04-23 21:40:50 +02:00
Bjørn Erik Pedersen 4c3c512038 commands: Init mem profile at the end
Much more useful ...
2019-04-23 17:14:02 +02:00
Bjørn Erik Pedersen 0775c98e6c hugolib: No links for bundled pages
This fixes a bug introduced in Hugo 0.55.

Fixes #5882
2019-04-22 13:22:01 +02:00
hugoreleaser 1477fb33c9 releaser: Prepare repository for 0.56.0-DEV
[ci skip]
2019-04-20 14:25:57 +00:00
hugoreleaser 993b84333c releaser: Add release notes to /docs for release of 0.55.3
[ci skip]
2019-04-20 14:23:12 +00:00
hugoreleaser a9ee2ab58c releaser: Bump versions for release of 0.55.3
[ci skip]
2019-04-20 14:23:12 +00:00
Bjørn Erik Pedersen c85b726f8a Release 0.55.3 2019-04-20 16:12:42 +02:00
hugoreleaser 89cf7a3f4b releaser: Add release notes draft for 0.55.3
Rename to *-ready.md to continue. [ci skip]
2019-04-20 14:08:54 +00:00
Bjørn Erik Pedersen 75b16e30ec docs: Regenerate docs helper 2019-04-20 15:20:08 +02:00
Bjørn Erik Pedersen 0508ca1856 Merge commit 'a0c28c943c2f4714fa340b22a583b96f5013090b' 2019-04-20 15:19:38 +02:00
Bjørn Erik Pedersen a0c28c943c Squashed 'docs/' changes from 0f2bf195e..13097daf2
13097daf2 Update shortcode docs vs 0.55
9a7e19231 Update URL docs for relative URLs etc
bd58dd877 Adjust Output Formats docs
f3e9fbc00 Document output format `permalinkable`
3778ce689 Update partials.md
7b207a404 Partial: Update variable name in example
7d7b1f03c Document partials returning a value.
7ae93b7ca Merge branch 'temp552'
81910d266 releaser: Add release notes to /docs for release of 0.55.2
c166cef47 Fix typo
23adeb672 Point mmark links to its new repository
369a87339 Merge branch 'temp551'
eb6097e9f Bump to 0.55.1
766ee61a8 releaser: Add release notes to /docs for release of 0.55.1
a5a5f5d75 Start of taxonomy docs update for Hugo 0.55
fb5f75e9a Remove the space in `. RelPermalink`

git-subtree-dir: docs
git-subtree-split: 13097daf2e
2019-04-20 15:18:59 +02:00
Bjørn Erik Pedersen c7dd66bfe2 Fix links for non-HTML output formats
They were not correct for regular pages.

Fixes #5877
2019-04-20 15:01:20 +02:00
Bjørn Erik Pedersen 7aeeb60d7e hugolib: Add some OutputFormats.Get tests
See #5877
2019-04-19 10:52:31 +02:00
Bjørn Erik Pedersen ea529c847e Fix menu URL when multiple permalinkable output formats
In Hugo `0.55` we introduced the `permalinkable` config attribute on Output Format, default enabled for `AMP` and `HTML`.

This meant that a Page could have different `RelPermalink` and `Permalink` depending on the rendering format.

The menu `URL` did not reflect that fact.

Fixes #5849
2019-04-19 10:29:52 +02:00
Bjørn Erik Pedersen 6c80acbd5e hugolib: Add some integration tests for in/uniq using Pages
See #5875
See #5852
2019-04-19 09:07:21 +02:00
Bjørn Erik Pedersen 7fbfedf013 tpl/collections: Return error on invalid input in in
See #5875
2019-04-19 08:58:12 +02:00
Bjørn Erik Pedersen 06f56fc983 tpl/collections: Make Pages etc. work with the in func
Fixes #5875
2019-04-18 23:42:01 +02:00
Bjørn Erik Pedersen d7a67dcb51 tpl/collections: Make Pages etc. work in uniq
Fixes #5852
2019-04-18 16:50:13 +02:00
Bjørn Erik Pedersen 3e421bd47c commands: Replace IsDraft with Draft in list command
Fixes #5873
2019-04-18 09:25:40 +02:00
hugoreleaser 1028760331 releaser: Prepare repository for 0.56.0-DEV
[ci skip]
2019-04-17 12:22:55 +00:00
hugoreleaser 9d02034881 releaser: Add release notes to /docs for release of 0.55.2
[ci skip]
2019-04-17 12:20:37 +00:00
hugoreleaser ccfbb63d17 releaser: Bump versions for release of 0.55.2
[ci skip]
2019-04-17 12:20:37 +00:00
Bjørn Erik Pedersen fcd63a865e Release 0.55.2 2019-04-17 14:13:46 +02:00
hugoreleaser 7ace59d5bf releaser: Add release notes draft for 0.55.2
Rename to *-ready.md to continue. [ci skip]
2019-04-17 12:10:37 +00:00
Bjørn Erik Pedersen 35f41834ea hugolib: Add more tests for Permalinkable
See #5849
2019-04-17 13:26:27 +02:00
Bjørn Erik Pedersen 9b17cbb62a hugolib: Fix Pages reinitialization on rebuilds
Which had some unpredictable behaviour when using `.Pages` on home page etc. that had a content page.

Fixes #5833
2019-04-17 12:56:46 +02:00
Bjørn Erik Pedersen 2957795f52 tpl/tplimpl: Handle late transformation of templates
Fixes #5865
2019-04-16 21:24:09 +02:00
Bjørn Erik Pedersen 56550d1e44 hugolib: Fix shortcode namespace issue
Fixes #5863
2019-04-15 18:31:56 +02:00
Bjørn Erik Pedersen 7881b0965f hugolib: Fix false WARNINGs in lang prefix check
Add a slash to the check to make it less likely to match a valid value.

Fixes #5860
2019-04-15 17:12:29 +02:00
Bjørn Erik Pedersen 49d0a82641 hugolib: Fix bundle resource publishing when multiple output formats
The faulty logic published the bundled resources for the "first output" format.

This worked most of the time, but since the output formats list is sorted,
any output format only used for some of the pages (e.g. CSS) would not work properly.

Fixes #5858
2019-04-15 17:01:39 +02:00
Bjørn Erik Pedersen b799b12f4a hugolib: Fix panic for unused taxonomy content files
In Hugo 0.55 we connected the taxonomy nodes with their owning Page.

This failed if you had, say, a content file for a author that did not author anything in the site:

```
content/authors/silent-persin/_index.md
```

Fixes #5847
2019-04-15 13:36:05 +02:00
Bjørn Erik Pedersen 701486728e hugolib: Fix dates for sections with dates in front matter
Fixes #5854
2019-04-13 20:01:43 +02:00
Bjørn Erik Pedersen f2795d4d2c Fix WeightedPages in union etc.
We introduced a callback func() to get the owner Page in 0.55.0.

Sadly, funcs is  not comparable type in Go.

This commit replaces the func with a struct pointer that wraps the Page.

Fixes #5850
2019-04-13 18:52:38 +02:00
hugoreleaser e85c057f99 releaser: Prepare repository for 0.56.0-DEV
[ci skip]
2019-04-12 09:58:35 +00:00
hugoreleaser 223b3c2eec releaser: Add release notes to /docs for release of 0.55.1
[ci skip]
2019-04-12 09:56:13 +00:00
hugoreleaser 7ca15c7ddb releaser: Bump versions for release of 0.55.1
[ci skip]
2019-04-12 09:56:13 +00:00
Bjørn Erik Pedersen adb776b22b Release 0.55.1 2019-04-12 11:30:04 +02:00
hugoreleaser 5efdd14ebd releaser: Add release notes draft for 0.55.1
Rename to *-ready.md to continue. [ci skip]
2019-04-12 09:29:27 +00:00
Bjørn Erik Pedersen 8d7607aed1 hugolib: Add a test for parent's resources in shortcode
See #5833
2019-04-12 10:44:21 +02:00
Bjørn Erik Pedersen 4d425a86f5 Fix 2019-04-12 10:26:10 +02:00
Bjørn Erik Pedersen 9e9a1f92ba hugolib: Fix simple menu config
This stopped working in Hugo 0.55:

```bash
---
menu: "main"
---
```

This was also the case for using a slice of menu entries.

This still worked:

---
menu:
  main:
    weight: 30
---
2019-04-12 10:04:17 +02:00
Bjørn Erik Pedersen f7375c4972 Fix paginator refresh on server change
Fixes #5838
2019-04-12 09:18:59 +02:00
Yihui Xie 7966c0b5b7 Remove the space in . RelPermalink
The same fix as 3b86b4a9f5, applied to doc.
2019-04-10 22:45:20 +02:00
Bjørn Erik Pedersen cc98fc8ad2 Merge commit '8b73644d81a81e82851b7f7c90aa8ab5524fbe93' 2019-04-09 23:59:59 +02:00
Bjørn Erik Pedersen 8b73644d81 Squashed 'docs/' changes from acf70cdd9..0f2bf195e
0f2bf195e Adjust shortcodes for 0.55
48c577121 Fix deprecation warnings
ed95a341a Update index.md
e4bc8981f Release 0.55.0
25acacb91 Merge branch 'temp55'
b240e321a releaser: Add release notes to /docs for release of 0.55.0
86a190c92 docs: Add information about summary front matter variable
9d94f4340 integrity: Add support for sha384
dd3fe9f92 Add HUGO_NUMWORKERMULTIPLIER
968372d86 Add trace.out to .gitignore
660772713 Add the Fireship images to cache
41a3e19cb hugolib: Allow page-relative aliases
4497e4b12 Update faq.md
b0ee3dccc output: Add missing JSON tag
173dac0b7 docs: Regenerate docshelper data
e30473062 docs: Regenerate CLI docs
8cb775be2 Merge commit 'c2037f0c9a3a35b9db9c404f6b5f94ec8b690a53'
5bc64bf44 Make Page an interface
371ff6c12 Add skipHTML option to blackfriday config

git-subtree-dir: docs
git-subtree-split: 0f2bf195ef
2019-04-09 23:59:13 +02:00
Bjørn Erik Pedersen 3b86b4a9f5 resources/page: Fix .RSSLinke deprecation message
Closes #4427
2019-04-09 16:47:29 +02:00
Bjørn Erik Pedersen 27a8049da7 tpl/tplimpl: Replace deprecated .GetParam usage
Fixes #5834
2019-04-09 16:39:12 +02:00
hugoreleaser ee4274244b releaser: Prepare repository for 0.56.0-DEV
[ci skip]
2019-04-08 16:42:12 +00:00
hugoreleaser 4333cc77fe releaser: Add release notes to /docs for release of 0.55.0
[ci skip]
2019-04-08 16:39:45 +00:00
hugoreleaser 452cdcd7c8 releaser: Bump versions for release of 0.55.0
[ci skip]
2019-04-08 16:39:45 +00:00
Bjørn Erik Pedersen 05d614e13b Release 0.55.0 2019-04-08 18:34:48 +02:00
hugoreleaser 018cd0c9da releaser: Add release notes draft for 0.55.0
Rename to *-ready.md to continue. [ci skip]
2019-04-08 18:33:35 +02:00
Bjørn Erik Pedersen 612a06f067 Misc paginator adjustments
* Rewind paginator for server mode
* Add some more related tests.
* Replace the clumsy scratch constructs in internal paginator template with variables

See #5825
2019-04-08 11:02:12 +02:00
Bjørn Erik Pedersen 3db4a1cf7a Update to Go 1.12.2 and Go 1.11.7
Fixes #5819
2019-04-07 18:54:53 +02:00
Bjørn Erik Pedersen f34e6172cf hugolib: Log warning on relative front matter url with lang
Will do this for one version only, as there may be situations where this is the correct thing.

Also add some more related test cases.

Fixes #5818
2019-04-07 18:54:18 +02:00
Bjørn Erik Pedersen 708d4ceebd Adjust rlimit logic
Closes #5821
2019-04-07 00:53:55 +02:00
Jim McDonald ed65bda3b4 docs: Add information about summary front matter variable 2019-04-06 00:17:54 +02:00
Jim McDonald 3a62d54745 hugolib: Consider summary in front matter for .Summary
Add the ability to have a `summary` page variable that overrides
the auto-generated summary.  Logic for obtaining summary becomes:

  * if summary divider is present in content, use the text above it
  * if summary variables is present in page metadata, use that
  * auto-generate summary from first _x_ words of the content

Fixes #5800
2019-04-05 19:11:04 +02:00
Bjørn Erik Pedersen ebab291c0e resources/page: Regenerate JSON wrapper 2019-04-05 16:58:52 +02:00
Bjørn Erik Pedersen 75467cd785 resources/page: Add missing GitInfo to Page 2019-04-05 16:52:37 +02:00
Bjørn Erik Pedersen d1553b4b0f integrity: Add support for sha384
Fixes #5815
2019-04-05 16:35:07 +02:00
Bjørn Erik Pedersen 1d9dde82a0 hugolib: Fix default date assignment for sections
See #5784
2019-04-05 11:20:09 +02:00
Bjørn Erik Pedersen 87b16abd93 Add HUGO_NUMWORKERMULTIPLIER
And use that to calculate number of workers, if set, else fall back to number of logical CPUs.

Also tweak the relevant related settings to match the new setup.

Also remove the setting of `runtime.GOMAXPROCS` as this has been the default behaviour since Go 1.5.

Fixes #5814
2019-04-05 10:21:25 +02:00
Bjørn Erik Pedersen 415ca9673d hugolib: Fix the GOMAXPROCS env get
Fixes #5813
2019-04-05 09:57:43 +02:00
Bjørn Erik Pedersen 8559f5c29f Use YAML for the benchmark compare 2019-04-05 08:55:39 +02:00
Bjørn Erik Pedersen e2dc432fe2 hugolib: Fix benchmark for YAML front matter 2019-04-05 08:52:58 +02:00
Bjørn Erik Pedersen 950295516d hugolib: Buffer the render pages chan 2019-04-04 16:50:10 +02:00
Bjørn Erik Pedersen 032e6802d1 deps: Update to imaging v1.6.0
Closes #5812
2019-04-04 14:39:39 +02:00
Bjørn Erik Pedersen d0d661dffd hugolib: Re-work "fast render" logic in the new flow
Note that this fixes some "live reload" issues recently introduced in non-released code.

Closes #5811
See #5784
2019-04-04 13:51:22 +02:00
Bjørn Erik Pedersen 4494a01b79 metrics: Adjust the howSimilar logic vs strings
Also add a test.
2019-04-02 21:00:42 +02:00
Bjørn Erik Pedersen e91e222cd2 resources/page: Implement compare.ProbablyEqer for the core slices
Fixes #5808
2019-04-02 16:10:13 +02:00
Bjørn Erik Pedersen 5185fb065b hugolib: Allow relative URLs in front matter
Before this commit you would have to do this in multilingual setups:

```
---
title: "Custom!"
url: "/jp/custom/foo"
---
```

This commit allows for relative URLs, e.g:

```
---
title: "Custom!"
url: "custom/foo"
---
```

Which is obviously easier and more portable.

The meaning of relative may change to include more in the future (e.g. role based access).

Fixes #5704
2019-04-02 10:33:15 +02:00
Bjørn Erik Pedersen 92baa14fd3 hugolib: Allow page-relative aliases
Fixes #5757
2019-04-02 10:32:47 +02:00
Bjørn Erik Pedersen a55640de8e tpl: Allow the partial template func to return any type
This commit adds support for return values in partials.

This means that you can now do this and similar:

    {{ $v := add . 42 }}
    {{ return $v }}

Partials without a `return` statement will be rendered as before.

This works for both `partial` and `partialCached`.

Fixes #5783
2019-04-02 10:30:24 +02:00
Bjørn Erik Pedersen 9225db636e releaser: Remove version replacement in docs config
Fixes #5665
2019-04-01 09:11:36 +02:00
Bjørn Erik Pedersen f7ef7d3761 releaser: Adjust patch vs images logic
Fixes #5664
2019-04-01 09:07:19 +02:00
Bjørn Erik Pedersen f9d6feca08 hugolib: Fix alias path for AMP and similar
Fixes #5760
2019-03-30 16:46:51 +01:00
Bjørn Erik Pedersen 439ab0339d resources: Fix image publish ordering issue
Fixes #5730
2019-03-30 10:17:25 +01:00
Bjørn Erik Pedersen b6a60f718e output: Add missing JSON tag 2019-03-28 20:59:09 +01:00
Bjørn Erik Pedersen bfdc44964a docs: Regenerate docshelper data
Closes #5799
2019-03-28 09:49:54 +01:00
Bjørn Erik Pedersen cc8515f187 deps: Update Chroma
Closes #5780
2019-03-28 09:46:55 +01:00
Bjørn Erik Pedersen 8bfd3a54a4 hugolib: Add a simple test for jsonify of Site
Closes #5780
2019-03-28 09:45:25 +01:00
Bjørn Erik Pedersen bb533ca5e1 docs: Regenerate CLI docs
Fixes #5779
2019-03-26 18:46:01 +01:00
Bjørn Erik Pedersen 876e5f67b1 Merge commit 'c2037f0c9a3a35b9db9c404f6b5f94ec8b690a53' 2019-03-26 18:41:36 +01:00
Bjørn Erik Pedersen c2037f0c9a Squashed 'docs/' changes from 4f4d1f48c..acf70cdd9
acf70cdd9 Update CSS after removing Purge
74c0bb7f2 Remove purge from Webpack, temporarily
397b7284f Merge commit 'ccb1e38f3822e9b5e4fb89a296324daf3400f23b'
ccb1e38f3 Squashed 'themes/gohugoioTheme/' changes from 042112e2d..b7853ae70
bca84e914 Fix search box text being invisible in Safari
3f21d0957 FAQ: "this feature is not available in your current Hugo version"
d8b318f90 Remove Gulp from Victor Hugo description
09d9b4c24 Update contribute/development.md
4d0f6ba47 Theme Components Support on the Hugo Themes Site (#769)
f2ec3f2a6 Fix broken link 404
af82c56c5 config: Remove superflous param
8dc14f563 Update theme total on homepage (#765)
7838fd7e2 Update description of Atlas to reflect new changes
6abab23c6 update: total of hugo themes
1dba24fde Clarify: summaryLength uses words not characters
8c54f45d6 Add missing punctuation
d17000481 Remove Hugo Frontend caddy-plugin
a7094ae62 remove unneeded meta tags
f8b0f31c6 Fix typo in cross references
61781bab9 Fix: use gh shortcode correctly
357bfca43 Update files.md
d1d2406cc Updated Hugo convert to clarify for and not ..
86850f3c3 Fix typos in multilingual.md
b68d0d892 Fix typo
8cba70e28 Document disableAliases
00e440260 Remove extra whitespace
212d63e4c Update with latest Theme Submission Guidelines (#744)
c24ea638f Update frontends.md
942bc1972 Add one more video
2e1e1091d Update the rest of the videos
a7dc70f2b Add new installation video
1a78f8487 Hosting on AWS amplify
112420c46 Fix typo
f723425e4 Add fireship.io bio to showcase
574f43503 Fixed typo
88e0e0cb7 Release 0.54.0
303edf19e Merge branch 'temp54'
c38debebd releaser: Prepare repository for 0.55.0-DEV
5c6c56fa1 releaser: Add release notes to /docs for release of 0.54.0
f86e05950 releaser: Bump versions for release of 0.54.0
6a2684fe4 Add the default cache configuration
f75c0125a Merge commit 'f27faf9afd0a8db768a21954b8755f1bf1a14f1b'
e440dc6a4 Merge commit '5e078383a787e8b5ec3ba73f05ea4130840afbe2'
981bf53f8 Update _index.md
b54aea066 tpl: Fix reflect
41f8af5a6 Merge commit '978856e2ad12d2bcaf37bb9e31f806b30a4c42f4'

git-subtree-dir: docs
git-subtree-split: acf70cdd9f
2019-03-26 18:41:09 +01:00
Bjørn Erik Pedersen 9bc6187b83 hugolib: Do not fall back to site title if not set in content file
See #5784
2019-03-26 15:49:32 +01:00
Bjørn Erik Pedersen 10bb614a70 deps: Update Afero
Closes #5673
2019-03-26 13:12:58 +01:00
Bjørn Erik Pedersen bceda1b288 hugolib: Add a test for home page with no title
See #5784
2019-03-26 10:28:02 +01:00
Bjørn Erik Pedersen 4dae52af68 Avoid nilpointer on no File on Page
Fixes #5781
2019-03-26 10:20:40 +01:00
Bjørn Erik Pedersen 794d4052b8 herrors/errors: Improve the "feature not available" error 2019-03-26 10:15:57 +01:00
Bjørn Erik Pedersen a7ee9b0bb9 hugolib: Add String() to fileInfo
See #5784
2019-03-25 08:29:29 +01:00
Bjørn Erik Pedersen 91ef9655aa resources/page: Re-introduce .Page.Page
It was removed in 597e418cb0 -- it's not documented, but it's used in too many real sites on the web.

See #5784
2019-03-25 07:55:46 +01:00
Bjørn Erik Pedersen b5f39d23b8 all: Apply staticcheck recommendations 2019-03-24 16:14:51 +01:00
Bjørn Erik Pedersen 3011f36c27 hugolib: Remove unused slice 2019-03-24 16:14:51 +01:00
Bjørn Erik Pedersen d30e845485 Run gofmt -s 2019-03-23 20:15:06 +01:00
Bjørn Erik Pedersen 597e418cb0 Make Page an interface
The main motivation of this commit is to add a `page.Page` interface to replace the very file-oriented `hugolib.Page` struct.
This is all a preparation step for issue  #5074, "pages from other data sources".

But this also fixes a set of annoying limitations, especially related to custom output formats, and shortcodes.

Most notable changes:

* The inner content of shortcodes using the `{{%` as the outer-most delimiter will now be sent to the content renderer, e.g. Blackfriday.
  This means that any markdown will partake in the global ToC and footnote context etc.
* The Custom Output formats are now "fully virtualized". This removes many of the current limitations.
* The taxonomy list type now has a reference to the `Page` object.
  This improves the taxonomy template `.Title` situation and make common template constructs much simpler.

See #5074
Fixes #5763
Fixes #5758
Fixes #5090
Fixes #5204
Fixes #4695
Fixes #5607
Fixes #5707
Fixes #5719
Fixes #3113
Fixes #5706
Fixes #5767
Fixes #5723
Fixes #5769
Fixes #5770
Fixes #5771
Fixes #5759
Fixes #5776
Fixes #5777
Fixes #5778
2019-03-23 18:51:22 +01:00
Daniel Compton 44f5c1c14c List future and expired dates in CSV format
It is useful to see the date that a post will be published, or the date
that it has expired, to build tooling around it. This commit writes
posts and their publish/expired date as CSV.

Fixes #5610
2019-03-19 00:33:02 +01:00
Bjørn Erik Pedersen 984a73af9e Update to Go 1.12.1 and Go 1.11.6
Fixes #5755
2019-03-17 08:37:42 +01:00
Bjørn Erik Pedersen e54213f525 tpl/tplimpl: Fix mutex unlock 2019-03-16 09:40:27 +01:00
Bjørn Erik Pedersen 4a2a8afff2 commands: Fix doLiveReload logic
Fixes #5754
2019-03-14 21:39:00 +01:00
Bjørn Erik Pedersen 79d517d86c deps: Update Viper 2019-03-13 10:42:43 +01:00
Bjørn Erik Pedersen 34c49d788c hugolib: Adjust site benchmark
Having all the pages with shortcodes isn't realistic.
2019-03-12 20:27:50 +01:00
Bjørn Erik Pedersen b9e75afd6c Update to Go 1.12
Fixes #5716
2019-03-07 10:26:26 +01:00
Bjørn Erik Pedersen dfc72d61a5 Remove Gitter dev chat link
Almost every question we get there belong on https://discourse.gohugo.io/
2019-03-07 00:37:50 +01:00
Bjørn Erik Pedersen 02eaddc2fb tpl/tplimpl: Fix template truth logic
Before this commit, due to a bug in Go's `text/template` package, this would print different output for typed nil interface values:

```
{{ if .AuthenticatedUser }}User is authenticated!{{ else }}{{ end }}
{{ if not .AuthenticatedUser }}{{ else }}}User is authenticated!{{ end }}
```

This commit works around this by wrapping every `if` and `with` with a custom `getif` template func with truth logic that matches `not`, `and` and `or`.

Those 3 template funcs from Go's stdlib are now pulled into Hugo's source tree and adjusted to support custom zero values, e.g. types that implement `IsZero`.

This means that you can now do:

```
{{ with .Date }}{{ . }}{{ end }}
```

And it would work as expected.

Fixes #5738
2019-03-06 22:52:38 +01:00
grahamjamesaddis bdf47e8da8 Update Travis config to work for forked builds 2019-03-05 14:26:49 +01:00
arrtchiu 75904332f3 Add skipHTML option to blackfriday config 2019-03-04 11:27:18 +01:00
Elliott Sales de Andrade 60c0eb4e89 Update stretchr/testify to 1.3.0. 2019-03-02 10:24:21 +01:00
Berin Larson c154c2f7b2 Rewrite relative action URLS
Fixes #5701
2019-02-26 11:31:34 +01:00
Anthony Metzidis 075b17ee1d Support Docker args TAGS, WORKDIR, CGO; speed up repetitive builds 2019-02-22 11:53:17 -08:00
Bjørn Erik Pedersen b4148cd1d9 hugolib: Adjust test for Go 1.12 2019-02-19 21:47:38 +01:00
Anton Harniakou 908692fae5 Support nested keys/fields with missing values with the where function
Before this commit `where` would produce an error and bail building the
site. Now, `where` simply skips an element of a collection and does not
add it to the final result.

Closes #5637
Closes #5416
2019-02-06 19:53:34 +01:00
Bjørn Erik Pedersen 7e4b18c5ae commands: Update debouncer version 2019-02-02 14:05:28 +01:00
Iskander (Alex) Sharipov 483cf19d5d common/herrors: Fix args order in strings.TrimPrefix
Old code always returned "." or "" (if filepath.Ext(filename) returned ".").
Now it properly trims the prefix.

Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
2019-02-02 09:55:31 +01:00
Iskander (Alex) Sharipov 7201042946 tpl: Fix strings.HasPrefix args order 2019-02-02 01:26:05 +01:00
hugoreleaser 5383fe458c releaser: Prepare repository for 0.55.0-DEV
[ci skip]
2019-02-01 09:42:55 +00:00
hugoreleaser b1a82c61ab releaser: Add release notes to /docs for release of 0.54.0
[ci skip]
2019-02-01 09:40:32 +00:00
hugoreleaser 6fe6b9c17f releaser: Bump versions for release of 0.54.0
[ci skip]
2019-02-01 09:40:32 +00:00
Bjørn Erik Pedersen 52cec0fb2d Release 0.54.0 2019-02-01 10:34:37 +01:00
hugoreleaser 23e52ea4c8 releaser: Add release notes draft for 0.54.0
Rename to *-ready.md to continue. [ci skip]
2019-02-01 09:31:43 +00:00
Bjørn Erik Pedersen 9b619dc023 releaser: Adjust patch logic
See #5639
2019-02-01 10:09:14 +01:00
Bjørn Erik Pedersen fab41f42d3 common/hugo: Use official semver even for main releases
Closes #5639
2019-02-01 09:44:12 +01:00
Bjørn Erik Pedersen f27faf9afd Squashed 'docs/' changes from 49809a038..4f4d1f48c
4f4d1f48c Merge commit 'ccb3ee5c57a00d5d32c53c882cf9893181a6ec10'
ccb3ee5c5 Squashed 'themes/gohugoioTheme/' changes from dafc91ff1..042112e2d

git-subtree-dir: docs
git-subtree-split: 4f4d1f48cd
2019-02-01 09:08:24 +01:00
Bjørn Erik Pedersen c7c66e664a Merge commit 'f27faf9afd0a8db768a21954b8755f1bf1a14f1b' 2019-02-01 09:08:24 +01:00
Bjørn Erik Pedersen 5e078383a7 Squashed 'docs/' changes from 785e375f..49809a03
49809a03 Merge commit '20a631b4964fc0ab9137cce1e41774cbc17de044'
20a631b4 Squashed 'themes/gohugoioTheme/' changes from b8202f539..dafc91ff1
8b58f565 Re-generate CLI docs
4653a724 Add Netlify deployment badge
2d6246bc Remove some deprecated site variables
e6777153 Improve Algolia Search Display Styling
1570999f Add missing "." in front of gitlab-ci.yaml example
b922ae7d This adds documentation to the new configDir/Environment logic from .53 (#729)
7cff379f Correctly escape multi-word taxonomy terms in example
2dfeeda4 fix typo by removing stray paren
0870bd9a Fix typo in `paginate` description
91e8be85 Fixes https://github.com/gohugoio/hugo/issues/5609
c1db65ec Make the dummy URL more obvious
b4589ff0 Fix a link
b73dcb9a Consistently use "posts" as section name in examples
7a56abbc Format definitions
a9c6fd9b Minor clarification over the last commit
5c86bdc8 Add alternative instructions for Quick Start for non-git users
dafe7ee9 Add Visual Studio Code plug-ins
110ed19e Update HUGO_VERSION
2abd031a Update page.md
b332f7b9 Update page.md
f5a8c9d4 Update static-files.md
6d0c155c Add note about relative protocol URLs
a13751ac Theme Warning: Remove note about unquoted URLs
4c8f7d68 Incorporate feedback
6f2b9cf0 Update Creating Themes Warning
40d88d98 Fix ToC example to use binary true/false
4a11f3f1 Fix typo
2dbfc0a4 Fix a typo in taxonomies
d63790ef Do not mark UndocumentedFeature issues as stale
d7aff095 Regenerate docs.json
71c0826f Update transform.Unmarshal.md

git-subtree-dir: docs
git-subtree-split: 49809a038b
2019-02-01 09:01:04 +01:00
Bjørn Erik Pedersen ddc15ed41b Merge commit '5e078383a787e8b5ec3ba73f05ea4130840afbe2' 2019-02-01 09:01:04 +01:00
Bjørn Erik Pedersen ddc6d4e30f tpl/data: Adjust tests
See #5643
2019-02-01 08:54:30 +01:00
Anthony Fok 6a2bfcbec8 tpl/data: Prevent getJSON and getCSV fetch failure from aborting build
Fixes #5643
2019-02-01 08:52:29 +01:00
Bjørn Erik Pedersen 59d87044a4 commands: Add test for --configDir
See #5662
2019-02-01 08:40:53 +01:00
Bjørn Erik Pedersen 3244cb3b31 Ignore unknown config files in config dir
Swap files etc.

Fixes #5646
2019-02-01 07:47:40 +01:00
Anton Harniakou d9282cf98a Store supported config formats in a variable 2019-02-01 07:17:37 +01:00
Bjørn Erik Pedersen c52045bbb3 Fix some inline shortcode issues
Fixes #5645
Fixes #5653
2019-01-31 19:08:19 +01:00
Bjørn Erik Pedersen 8ed2a1caa9 Bump to Go 1.11.5
Fixes #5654
2019-01-31 13:23:55 +01:00
Bjørn Erik Pedersen e85961390a Update Afero
Fixes #5650
2019-01-30 09:35:55 +01:00
Anthony Fok 2a9060a85c hugolib: Expand TestPageWithEmoji to cover '+', '-' and '_' too
See #5635 and commit 3038464e
2019-01-29 13:03:42 -07:00
Anthony Fok 3038464ea6 Accept hyphen and plus sign in emoji detection
Fixes #5635
2019-01-29 05:38:36 -07:00
Elliot Murphy 526b5b1c49 Fix OpenGraph image fallback to site params
Signed-off-by: Elliot Murphy <statik@users.noreply.github.com>
2019-01-25 18:14:10 +01:00
Anton Harniakou 26f75edb7a Support numeric sort in ByParam
With this commit ByParam takes into account a type of a value under a
key. If both values are numeric then they're coerced into float64 and
then get compared.
If any value isn't numeric, for example it's nil or string, then both
values coerced into string and get compared as strings
(lexicographicaly)

Nil values are always sent to the end.

Numeric values confirm to any type listed below:
uint8, uint16, uint32, uint64, int, int8, int16, int32, int64, float32, float64

Closes #5305
2019-01-20 13:05:20 +00:00
Bjørn Erik Pedersen e1a66c7343 Fix Params case handling in the new site global
Fixes #5615
2019-01-20 12:42:24 +00:00
Anton Harniakou db3c49d049 Make hugo server -t work again
This commit solves an issue where hugo would ignore the cli -t flag
and only use a theme defined in config.toml.

Also allow -t flag to accept a string slice.

Closes #5569
Closes #5061
Related #4868
2019-01-13 20:13:59 +00:00
Anthony Fok e3cb8e6c78 Add configFile(s) back to the watch list after RENAME event too
Alleviates #5205
2019-01-10 15:57:30 -07:00
mywaiting 55251aa890 Remove historical rssURI config 2019-01-10 18:24:38 +01:00
Anton Harniakou 843fcd19d4 Use subtests with server_test.go
Use Golang's subtests to provide a convenient way
to run specific tests.
Example:
go test -run=TestFixURL/Basic_production
2019-01-08 14:54:11 +01:00
Bjørn Erik Pedersen ce8a09a4c0 resources: Move resource interfaces into its own package 2019-01-02 14:25:37 +01:00
Bjørn Erik Pedersen 669ada4367 resource: Move resource processors into sub-packages 2019-01-02 14:25:37 +01:00
Marc Robinson 507451229c Update _index.md
Corrects misspelling of sync (synch)
2019-01-02 09:58:39 +01:00
Bjørn Erik Pedersen 40ffb0484b hugolib: Restore 0.48 slash handling in taxonomies
Fixes #5571
2018-12-30 18:50:09 +01:00
Bjørn Erik Pedersen 4bae8b04aa Revert " Fix handling of taxonomy terms containing slashes"
See #4090
See #5571

This reverts commit fff132537b.
2018-12-30 18:50:09 +01:00
Bjørn Erik Pedersen 0584432b07 Update go.sum 2018-12-30 17:07:31 +01:00
Bjørn Erik Pedersen 65fa069271 Revert "hugolib: Restore taxonomy term path separation"
See #5571

This reverts commit 9ce0a1fb70.
2018-12-29 10:00:17 +01:00
Cameron Moore 9e4f9e0bb6 tpl: Fix reflect
Fixes #5564
2018-12-28 10:41:46 +01:00
Bjørn Erik Pedersen 3f3187de0f cache/namedmemcache: Fix data race 2018-12-27 12:05:42 +01:00
Bjørn Erik Pedersen cc351958e1 Update Chroma
Fixes #4993
2018-12-27 10:58:34 +01:00
Bjørn Erik Pedersen c24f3ae22b Make docshelper run again
Fixes #5568
2018-12-27 10:08:44 +01:00
Bjørn Erik Pedersen 214e9745b6 releaser: Use Git short commit in release binaries
Fixes #5562
2018-12-26 11:31:58 +01:00
Bjørn Erik Pedersen ecc8922752 releaser: Bump Goreleaser version 2018-12-26 11:30:05 +01:00
Bjørn Erik Pedersen 22afe28047 Merge commit '978856e2ad12d2bcaf37bb9e31f806b30a4c42f4' 2018-12-26 10:27:54 +01:00
Bjørn Erik Pedersen 978856e2ad Squashed 'docs/' changes from bd91d1cfd..785e375f5
785e375f5 Change 'my-another-post' to 'my-other-post'
ba9a69d25 Update reflect.IsSlice.md
806344258 Update reflect.IsMap.md
757c0dafa Update index.md
d3f20a2d5 Update index.md
9952e72a0 Formatting
70458ccf2 Formatting
7e0dd3969 Merge branch 'config-dir'
06a5c11fc Release 0.53
01c00229f releaser: Prepare repository for 0.54-DEV
29b223f78 releaser: Add release notes to /docs for release of 0.53
4f61d1194 releaser: Bump versions for release of 0.53
320a0ac68 Refactor config below /config
ec16b611e docs: Adjust CSV example
cecf97dfc Rename CSV option from comma to delimiter
18d06df58 docs: Document transform.Unmarshal
fdace78b5 docs: Regenerate CLI docs
b8f84ac59 hugolib: Add .Name as a shortcode variable
6612dd1b8 Merge commit '5a83bf314f4c0ce1d61341e0a1df21c9998e8154'
9b211089f docs: Regenerate CLI docs
9af46af3c Merge commit 'eb16165694f868d73e57b6aed5c26ba5e98229de'
12f46f356 tpl: Add reflect namespace

git-subtree-dir: docs
git-subtree-split: 785e375f57
2018-12-26 10:27:12 +01:00
hugoreleaser 8431871201 releaser: Prepare repository for 0.54-DEV
[ci skip]
2018-12-24 08:26:54 +00:00
hugoreleaser 8fc339dc25 releaser: Add release notes to /docs for release of 0.53
[ci skip]
2018-12-24 08:24:42 +00:00
hugoreleaser 5236cb8e9a releaser: Bump versions for release of 0.53
[ci skip]
2018-12-24 08:24:42 +00:00
Bjørn Erik Pedersen a28865cfc3 release: Fix goreleaser config 2018-12-24 09:20:09 +01:00
hugoreleaser cb6c77b813 Release 0.53 2018-12-24 09:05:26 +01:00
Bjørn Erik Pedersen be58c7b9c8 tpl/transform: Include options in cache key
See #5555
2018-12-23 21:34:17 +01:00
Bjørn Erik Pedersen 62d031aedf docs: Adjust CSV example
See #5555
2018-12-23 21:12:41 +01:00
Bjørn Erik Pedersen ce06bdb16a Rename CSV option from comma to delimiter
See #5555
2018-12-23 21:09:09 +01:00
Bjørn Erik Pedersen 2efc1a64c3 docs: Document transform.Unmarshal
Fixes #5556
2018-12-23 19:43:17 +01:00
Bjørn Erik Pedersen 25ddbb09fe hugolib: Adjust test
See #5544
2018-12-23 19:42:51 +01:00
Bjørn Erik Pedersen e691c48a5a docs: Regenerate CLI docs
Fixes #5544
2018-12-23 19:05:40 +01:00
Bjørn Erik Pedersen 094709e105 tpl/transform: Simplify transform.Unmarshal func
See #5428
2018-12-23 16:43:04 +01:00
Bjørn Erik Pedersen a574469797 Add CSV support to transform.Unmarshal
Fixes #5555
2018-12-23 16:33:21 +01:00
Bjørn Erik Pedersen 822dc627a1 tpl/transform: Add transform.Unmarshal func
Fixes #5428
2018-12-23 10:02:42 +01:00
Bjørn Erik Pedersen 43f9df0194 Prevent resource publishing for transformed inline resources
That is, if only `.Content` is accessed.

This means that, for a transformed resource to be published to `/public`, you need to access either `.RelPermalink` or `Permalink`.

Fixes #4944
2018-12-21 13:41:46 +01:00
Bjørn Erik Pedersen 1021714449 hugolib: Add .Name as a shortcode variable
Fixes #5546
2018-12-21 09:51:15 +01:00
Bjørn Erik Pedersen 5a83bf314f Squashed 'docs/' changes from d1cf9adc4..bd91d1cfd
bd91d1cfd Fix typo
0d45ea9cf Fix order of arguments in another strings.TrimLeft example
0982f65c1 Fix the order of arguments to strings.TrimRight
f1f9b7cd6 Arguments in example
5d9c7327f Fix shortcode example escape chars

git-subtree-dir: docs
git-subtree-split: bd91d1cfdd
2018-12-21 09:45:41 +01:00
Bjørn Erik Pedersen 6f069e549b Merge commit '5a83bf314f4c0ce1d61341e0a1df21c9998e8154' 2018-12-21 09:45:41 +01:00
Cameron Moore 0483299bc0 hugolib: Improve logic of output path trimming
Fixes #4666
2018-12-21 09:42:37 +01:00
Anthony Fok 27b62a546c snap: Revert build-snap to 1.11/stable channel for go
This is to fix the following snap build error:

    Failed to install or refresh a snap: 'go' does not exist
    or is not available on the desired channel '1.11.4/stable'.
    Use `snap info go` to get a list of channels the snap is available on.

`snap info go` reveals that the '1.11/stable' channel automatically
follows the latest minor point release as it becomes available.
2018-12-20 21:46:47 -07:00
Bjørn Erik Pedersen 35bfca3b14 commands: Remove the benchmark command
It's not particulary useful, and when we start to get bug reports about it, it is easier to remove it.

Closes #5543
2018-12-20 20:55:26 +01:00
Bjørn Erik Pedersen 9cd54cab20 Move the emoji parsing to pageparser
This avoids double parsing the page content when `enableEmoji=true`.

This commit also adds some general improvements to the parser, making it in general much faster:

```bash
benchmark                     old ns/op     new ns/op     delta
BenchmarkShortcodeLexer-4     90258         101730        +12.71%
BenchmarkParse-4              148940        15037         -89.90%

benchmark                     old allocs     new allocs     delta
BenchmarkShortcodeLexer-4     456            700            +53.51%
BenchmarkParse-4              28             33             +17.86%

benchmark                     old bytes     new bytes     delta
BenchmarkShortcodeLexer-4     69875         81014         +15.94%
BenchmarkParse-4              8128          8304          +2.17%
```

Running some site benchmarks with Emoji support turned on:

```bash
benchmark                                                                                     old ns/op     new ns/op     delta
BenchmarkSiteBuilding/TOML,num_langs=3,num_pages=5000,tags_per_page=5,shortcodes,render-4     924556797     818115620     -11.51%

benchmark                                                                                     old allocs     new allocs     delta
BenchmarkSiteBuilding/TOML,num_langs=3,num_pages=5000,tags_per_page=5,shortcodes,render-4     4112613        4133787        +0.51%

benchmark                                                                                     old bytes     new bytes     delta
BenchmarkSiteBuilding/TOML,num_langs=3,num_pages=5000,tags_per_page=5,shortcodes,render-4     426982864     424363832     -0.61%
```

Fixes #5534
2018-12-20 20:08:01 +01:00
Bjørn Erik Pedersen a8853f1c5a parser/pageparser: Split the page lexer into some more files
See #5534
2018-12-20 20:08:01 +01:00
Bjørn Erik Pedersen 4d93aca27d hugolib: Enable Emoji in site benchmark 2018-12-20 17:24:51 +01:00
Bjørn Erik Pedersen f2167de834 parser/pageparser: Add a benchmark 2018-12-19 20:08:22 +01:00
Bjørn Erik Pedersen 64b6b29075 tpl: Fix case handling in cast params
Fixes #5538
2018-12-19 13:19:22 +01:00
Bjørn Erik Pedersen bb9c2988f8 Update to Go 1.11.4
Fixes #5524
2018-12-19 11:48:17 +01:00
Bjørn Erik Pedersen c04030b14c releaser: Get ldflags for build date etc. in line for all builds
Closes #5539
Closes ##5388
2018-12-19 10:01:26 +01:00
Bjørn Erik Pedersen f7691fe965 transform/urlreplacers: Simplify implementation 2018-12-17 19:17:56 +01:00
Bjørn Erik Pedersen efe0b4e5c0 transform/urlreplacers: Support unquoted URLs in canonifyURLs replacer
Fixes #5529
2018-12-17 19:17:56 +01:00
Bjørn Erik Pedersen d5a0b6bbbc hugolib: Remove "double layout" lookup
Fixes #5390
2018-12-17 11:34:32 +01:00
Bjørn Erik Pedersen 5178cd13a7 Fix "failed to create file caches from configuration: file exists" on Windows
Fixes #5497
2018-12-17 10:36:52 +01:00
Bjørn Erik Pedersen 9ce0a1fb70 hugolib: Restore taxonomy term path separation
Fixes #5513
2018-12-14 10:29:32 +01:00
Jean-François YUEN ab9214768d importer: fix jekyll import highlight options 2018-12-12 19:12:12 +01:00
Bjørn Erik Pedersen 5068681707 docs: Regenerate CLI docs
Fixes #5507
2018-12-12 09:09:45 +01:00
Bjørn Erik Pedersen b17a61a605 Merge commit 'eb16165694f868d73e57b6aed5c26ba5e98229de' 2018-12-12 09:06:42 +01:00
Bjørn Erik Pedersen eb16165694 Squashed 'docs/' changes from 37095d540..d1cf9adc4
d1cf9adc4 Fix typo
26e10a690 Fix the name and arg mismatch between partial defn and call
2db0e53cd Merge commit '9c36cff15224f6cbd19058ad61311229b7a23c83'
9c36cff15 Squashed 'themes/gohugoioTheme/' changes from 68ddff44..b8202f53
4b021eff8 Update lang.Merge.md
b37af2916 Add title to yaml
a9a281233 Fixed incorrect usage of the code-toggle shortcode
4560a0169 Update Warning for Theme Links (#676)
0305e3c6b Document .File.ContentBaseName
6d30c5aa1 Update configuration.md
158df174a Document .Sites and .Sites.First
0c0f583b8 Add stale config
e2531afd8 Document path template functions
4dd779057 Clarify that partialCached is per site/language
19e5bbe0c Update index.md
44b000857 Add missing dot
a41300cf9 Release 0.52
2d1d92b88 Merge branch 'temp52'
c5925250d releaser: Prepare repository for 0.53-DEV
d000b04a2 releaser: Add release notes to /docs for release of 0.52
4bb983a0a releaser: Bump versions for release of 0.52
36736ca28 tpl: Add "param" shortcode
378677aa6 Add Elasticsearch/bonsai.io to services doc.
4c3fd4fa4 docs: Document inline shortcodes
6c64c374c Whitelist CSS modules from purge
817a872b9 Improve search icon position
cf86ff1c7 Add minification and resource cache clear to build command
fd77e8df3 Update asset dependencies and adopt Hugo Pipes
cdbe97e8c Update render.md
b0e279220 git command to update submodule to latest
a1cb98c12 cache/filecache: Add a :project placeholder
07c1b2b46 cache/filecache: Use time.Duration for maxAge
ffa9b165e Add AND as a title
6e7733b40 Add OR as a sub title to make it easier to find in search
72b6791a1 docs: Document the new file cache
714d3ca91 Fix minification issues
cd1e961da Revert "Add Elasticsearch/bonsai.io to services doc."
15a0cda6e Add Elasticsearch/bonsai.io to services doc.
f931d86de Release 0.51
e2ffe867a Merge branch 'temp51'
423e7f5c8 releaser: Prepare repository for 0.52-DEV
c6f2d6ae1 releaser: Add release notes to /docs for release of 0.51
5bbb556dc releaser: Bump versions for release of 0.51
3b2b172b9 docs: Document shortcode error handling
b8672f3d4 docs: Document symdiff
4bc6071e6 docs: Document complement
d1baab752 docs: Re-generate CLI docs
9ea667e24 Revert "tpl: Update Jsonify to return pretty-print output"
ce5a1403d docs: Regenerate the docs helper
99a1f4a94 Fix note for reserved partial name(starting with -> including).
eba3cbc42 fix accidentally modification on paragraph.
3eebd98c3 Add note for reserved partial name.
40b881cc2 Document templates.Exists
b5c3bcd3b Update multilingual.md
61c59c67e Fix misspelling (#648)
f21d8c4a4 Correct minor typo (#5372)
e967001b9 Release 0.50
685fd6b08 releaser: Prepare repository for 0.51-DEV
f245a9faa releaser: Add release notes to /docs for release of 0.50
4354da30d releaser: Bump versions for release of 0.50
feaa05469 docs: Regenerate CLI docs
5c724200c Merge commit 'd6a4af7018e8618944a6471ceeb7aae1d4df6afa'
2ddab36c2 Merge commit '74309fe5699a595080fdb3a14711e0869babce99'
8cf296a7c docs: Regenerate CLI docs
9097683dd tpl: Update Jsonify to return pretty-print output

git-subtree-dir: docs
git-subtree-split: d1cf9adc41
2018-12-12 09:05:31 +01:00
Bjørn Erik Pedersen 7829474088 Add /config dir support
This commit adds support for a configuration directory (default `config`). The different pieces in this puzzle are:

* A new `--environment` (or `-e`) flag. This can also be set with the `HUGO_ENVIRONMENT` OS environment variable. The value for `environment` defaults to `production` when running `hugo` and `development` when running `hugo server`. You can set it to any value you want (e.g. `hugo server -e "Sensible Environment"`), but as it is used to load configuration from the file system, the letter case may be important. You can get this value in your templates with `{{ hugo.Environment }}`.
* A new `--configDir` flag (defaults to `config` below your project). This can also be set with `HUGO_CONFIGDIR` OS environment variable.

If the `configDir` exists, the configuration files will be read and merged on top of each other from left to right; the right-most value will win on duplicates.

Given the example tree below:

If `environment` is `production`, the left-most `config.toml` would be the one directly below the project (this can now be omitted if you want), and then `_default/config.toml` and finally `production/config.toml`. And since these will be merged, you can just provide the environment specific configuration setting in you production config, e.g. `enableGitInfo = true`. The order within the directories will be lexical (`config.toml` and then `params.toml`).

```bash
config
├── _default
│   ├── config.toml
│   ├── languages.toml
│   ├── menus
│   │   ├── menus.en.toml
│   │   └── menus.zh.toml
│   └── params.toml
├── development
│   └── params.toml
└── production
    ├── config.toml
    └── params.toml
```

Some configuration maps support the language code in the filename (e.g. `menus.en.toml`): `menus` (`menu` also works) and `params`.

Also note that the only folders with "a meaning" in the above listing is the top level directories below `config`. The `menus` sub folder is just added for better organization.

We use `TOML` in the example above, but Hugo also supports `JSON` and `YAML` as configuration formats. These can be mixed.

Fixes #5422
2018-12-11 13:08:36 +01:00
Iskander (Alex) Sharipov 256418917c resource/image: Fix "always false" condition
Found using gocritic linter.
2018-12-10 15:31:44 +01:00
Cameron Moore c84f506f8e tpl: Add reflect namespace
Add a reflect namespace that offers a two boolean functions for
testing if a value is a map or slice.

Fixes #4081
2018-12-07 23:29:37 +01:00
Bjørn Erik Pedersen 4b5f743959 minifiers: Fixx CSS2 color code handling
Fixes #5506
2018-12-07 07:49:26 +01:00
Bjørn Erik Pedersen 931a132450 tpl/hugo: Use the correct Hugo var
See #5467
2018-12-06 14:57:56 +01:00
Bjørn Erik Pedersen 8378358857 hugolib: Add .Site.Sites
Fixes #5504
2018-12-06 14:37:25 +01:00
Bjørn Erik Pedersen 831d23cb4d Add tpl/site and tpl/hugo
This means that the current `.Site` and ´.Hugo` is available as a globals, so you can do `site.IsServer`, `hugo.Version` etc.

Fixes #5470
Fixes #5467
Fixes #5503
2018-12-06 14:37:25 +01:00
Bjørn Erik Pedersen 514e18dc27 cache/filecache: Simplify test
See #5497
2018-12-04 19:19:20 +01:00
Bjørn Erik Pedersen b804a70881 cache/filecache: Use OS fs for test
See #5497
2018-12-04 18:03:49 +01:00
Cameron Moore 30a7c9ea37 tpl: Add godoc packages comments
Also fix package name in tpl/templates.
2018-11-30 08:56:30 +01:00
Christian Oliff 8346848109 common/collections: Fix defines typo 2018-11-29 09:57:51 +01:00
hugoreleaser 54ecade02f releaser: Prepare repository for 0.53-DEV
[ci skip]
2018-11-28 14:08:36 +00:00
hugoreleaser 9433cf5a92 releaser: Add release notes to /docs for release of 0.52
[ci skip]
2018-11-28 14:06:31 +00:00
hugoreleaser 3c909eb3f3 releaser: Bump versions for release of 0.52
[ci skip]
2018-11-28 14:06:31 +00:00
Bjørn Erik Pedersen 724b3e673b Release 0.52 2018-11-28 14:59:48 +01:00
hugoreleaser 056c754771 releaser: Add release notes draft for 0.52
Rename to *-ready.md to continue. [ci skip]
2018-11-28 13:14:49 +00:00
Bjørn Erik Pedersen a9a93d082d hugolib: Fall back to title in ByLinkTitle sort
Fixes #4953
2018-11-28 13:52:26 +01:00
Bjørn Erik Pedersen b09a40333f hugolib: Improve nil handling in IsDescendant and IsAncestor
Fixes #5461
2018-11-28 12:36:59 +01:00
Bjørn Erik Pedersen 7540a62834 parser/pageparser: Fix handling of commented out front matter
When the page parser was rewritten in 0.51, this was interpreted literally, but commented out front matter is used in the wild to "hide it from GitHub", e.g:

```
<!--
+++
title = "hello"
+++
-->
```

Fixes #5478
2018-11-28 10:28:50 +01:00
Bjørn Erik Pedersen 7e75aeca80 Remove duplicate mapstructure depdendency 2018-11-28 00:17:43 +01:00
Bjørn Erik Pedersen e14e0b192f Add dependency list to README 2018-11-28 00:08:27 +01:00
Cameron Moore ed698e94c1 tpl/path: Add tests 2018-11-27 19:17:35 +01:00
Bjørn Erik Pedersen 89e2716d29 tpl: Regenerate templates 2018-11-27 18:15:55 +01:00
Max Arnold aba2647c15 tpl: Fix whitespace issue
Introduced  in #5276.
2018-11-27 18:15:10 +01:00
Bjørn Erik Pedersen f37c5a2567 tpl: Add "param" shortcode
Fixes #4010
2018-11-27 17:34:03 +01:00
Bjørn Erik Pedersen aded0f25fd docs: Document inline shortcodes
See #4011
2018-11-27 16:14:09 +01:00
Bjørn Erik Pedersen bc337e6ab5 Add inline shortcode support
An inline shortcode's name must end with `.inline`, all lowercase.

E.g.:

```bash
{{< time.inline >}}{{ now }}{{< /time.inline >}}
```

The above will print the current date and time.

Note that an inline shortcode's inner content is parsed and executed as a Go text template with the same context as a regular shortcode template.

This means that the current page can be accessed via `.Page.Title` etc. This also means that there are no concept of "nested inline shortcodes".

The same inline shortcode can be reused later in the same content file, with different params if needed, using the self-closing syntax:

```
{{< time.inline />}}
```

Fixes #4011
2018-11-27 16:14:09 +01:00
Cameron Moore 112461fded tpl/collections: Add float64 support to where
Fixes #5466
2018-11-27 09:04:02 +01:00
Bjørn Erik Pedersen 94ab125b27 parser/pageparser: Fix when only shortcode and then summary
Fixes #5464
2018-11-24 18:23:23 +01:00
Bjørn Erik Pedersen dcfeed35c6 commands: Include drafts in convert command
Fixes #5457
2018-11-24 13:11:14 +01:00
Bjørn Erik Pedersen f9b4eb4f39 Handle themes in the new file cache (for images, assets)
In the newly consolidated file cache implementation, we forgot that we also look in the theme(s) for assets (SCSS transformations etc.), which is not good for Netlify and the demo sites.

Fixes #5460
2018-11-23 21:09:00 +01:00
Kris Budhram e82b2dc8c1 Fix ignored --config flag with 'new' command 2018-11-18 19:09:28 +01:00
Bjørn Erik Pedersen 5df2b79dd2 Fix Permalink for resource, baseURL with path and canonifyURLs set
Fixes #5226
2018-11-15 16:37:11 +01:00
Bjørn Erik Pedersen 12742bac71 Add tests for permalink on Resource with baseURL with path
See #5226
2018-11-15 08:45:15 +01:00
Bjørn Erik Pedersen fabf026f49 helpers: Add a comment about file mode for new files
See #5434
2018-11-14 23:14:51 +01:00
Bjørn Erik Pedersen 94f0f7e597 cache/filecache: Add a :project placeholder
This allows for "cache per Hugo project", making `hugo --gc` work as expected, even if you have several Hugo projects running on the same PC.

See #5439
2018-11-14 23:14:51 +01:00
Bjørn Erik Pedersen 3c29c5af8e cache/filecache: Add a cache prune func
Fixes #5439
2018-11-14 23:14:51 +01:00
Bjørn Erik Pedersen 33502667fb cache/filecache: Add a filecache root dir
This is just a safe guard to make sure we don't evict/remove files that do not belong to the cache.
2018-11-14 23:14:51 +01:00
Bjørn Erik Pedersen d3489eba5d cache/filecache: Use time.Duration for maxAge
Fixes #5438
2018-11-14 23:14:50 +01:00
Bjørn Erik Pedersen 17d7ecde2b cache/filecache: Split implementation and config into separate files 2018-11-14 23:14:50 +01:00
Bjørn Erik Pedersen e4b2572880 Update to LibSASS 3.5.5
Fixes #5432
See #5435
2018-11-14 17:47:08 +01:00
Bjørn Erik Pedersen 782dd15858 More spelling corrections 2018-11-13 18:28:40 +01:00
Bjørn Erik Pedersen aff9c09166 cache/filecache: Spelling corrections 2018-11-13 18:16:53 +01:00
Bjørn Erik Pedersen fdd4a768f0 Remove appveyor
We now build on Travis for all platforms.
2018-11-13 14:36:17 +01:00
Bjørn Erik Pedersen abeeff1325 docs: Document the new file cache
See #5404
2018-11-13 14:29:45 +01:00
Bjørn Erik Pedersen f7aeaa6129 Add a consolidated file cache
This commits reworks how file caching is performed in Hugo. Now there is only one way, and it can be configured.

This is the default configuration:

```toml
[caches]
[caches.getjson]
dir = ":cacheDir"
maxAge = -1
[caches.getcsv]
dir = ":cacheDir"
maxAge = -1
[caches.images]
dir = ":resourceDir/_gen"
maxAge = -1
[caches.assets]
dir = ":resourceDir/_gen"
maxAge = -1
```

You can override any of these cache setting in your own `config.toml`.

The placeholders explained:

`:cacheDir`: This is the value of the `cacheDir` config option if set (can also be set via OS env variable `HUGO_CACHEDIR`). It will fall back to `/opt/build/cache/hugo_cache/` on Netlify, or a `hugo_cache` directory below the OS temp dir for the others.
`:resourceDir`: This is the value of the `resourceDir` config option.

`maxAge` is the time in seconds before a cache entry will be evicted, -1 means forever and 0 effectively turns that particular cache off.

This means that if you run your builds on Netlify, all caches configured with `:cacheDir` will be saved and restored on the next build. For other CI vendors, please read their documentation. For an CircleCI example, see https://github.com/bep/hugo-sass-test/blob/6c3960a8f4b90e8938228688bc49bdcdd6b2d99e/.circleci/config.yml

Fixes #5404
2018-11-13 14:19:42 +01:00
Emir Beganović 7d78a2afd3 Add Windows build config to Travis 2018-11-13 11:39:54 +01:00
Bjørn Erik Pedersen 5570a6e478 Revert "Add Elasticsearch/bonsai.io to services doc."
This reverts commit c0b3a1af03.
2018-11-09 23:12:27 +01:00
Allison Zadrozny c0b3a1af03 Add Elasticsearch/bonsai.io to services doc.
Hip hip for OSS! 🙌
2018-11-09 22:56:38 +01:00
Ian Lance Taylor a8cb1b07b4 tpl: Fix test to pass with gccgo
When run under gccgo, the test looks for the name that gccgo gives to
a thunk method.  This name is not normally visible, but can be seen
when using reflect.FuncForPC as this code does.  That name changed in
https://golang.org/cl/89555.  Change the test to work with both the
old name "$thunk0" and the new name "thunk0".

Fixes golang/go#28669
2018-11-09 08:54:08 +01:00
hugoreleaser 2900801acf releaser: Prepare repository for 0.52-DEV
[ci skip]
2018-11-07 10:11:48 +00:00
hugoreleaser f3d5190793 releaser: Add release notes to /docs for release of 0.51
[ci skip]
2018-11-07 10:09:43 +00:00
hugoreleaser 1ccc0b79a2 releaser: Bump versions for release of 0.51
[ci skip]
2018-11-07 10:09:43 +00:00
Bjørn Erik Pedersen cbed50e22b Release 0.51 2018-11-07 11:00:25 +01:00
hugoreleaser 05ecd8111c releaser: Add release notes draft for 0.51
Rename to *-ready.md to continue. [ci skip]
2018-11-07 09:48:47 +00:00
Bjørn Erik Pedersen e456e34bdb docs: Document shortcode error handling
Closes https://github.com/gohugoio/hugoDocs/issues/660
2018-11-07 10:38:58 +01:00
Bjørn Erik Pedersen 5d14d04ac6 docs: Document symdiff
Closes https://github.com/gohugoio/hugoDocs/issues/659
2018-11-07 10:38:58 +01:00
Bjørn Erik Pedersen ddcb402859 docs: Document complement
Closes https://github.com/gohugoio/hugoDocs/issues/658
2018-11-07 10:38:58 +01:00
Bjørn Erik Pedersen 3a44920e79 hugolib: Improve error message on duplicate menu items 2018-11-07 10:38:58 +01:00
Bjørn Erik Pedersen 79a06aa4b6 tpl/collections: Properly handle pointer types in complement/symdiff
We cannot compare them by values, because that gets `hash of unhashable type` for the prime use case.
2018-11-07 09:29:13 +01:00
Bjørn Erik Pedersen d212f60949 deps: Update minify
No functional changes, just support for Go Modules.
2018-11-07 00:23:08 +01:00
Bjørn Erik Pedersen 488776b649 tpl/collections: Add collections.SymDiff
Fixes #5410
2018-11-06 16:51:49 +01:00
Bjørn Erik Pedersen b8b8436fcc hugolib: Fix changing paginators in lazy render
Fixes #5406
2018-11-06 11:04:10 +01:00
Bjørn Erik Pedersen 42d8dfc8c8 tpl/collections: Add collections.Complement
Fixes #5400
2018-11-06 08:48:58 +01:00
秦世成 47506d1644 commands: Fix spelling 2018-11-06 08:45:19 +01:00
Bjørn Erik Pedersen 2998fa0cd5 docs: Re-generate CLI docs 2018-11-05 14:18:45 +01:00
Bjørn Erik Pedersen d16a7a33ff Fix shortcode directly following a shortcode delimiter
Fixes #5402
2018-11-05 14:14:28 +01:00
Bjørn Erik Pedersen 5b1edd281a commands: Add --minify to hugo server 2018-11-04 18:39:14 +01:00
Bjørn Erik Pedersen 2bd9d9099d commands: Fix recently broken error template
We need a test for this ...
2018-11-03 16:55:45 +01:00
Bjørn Erik Pedersen 4b7d3e57a4 Make WARN the new default log log level
This commit also pulls down the log level for a set of WARN statements to INFO. There should be no ERRORs or WARNINGs in a regular Hugo build. That is the story about the Boy Who Cried Wolf.

Since the WARN log is now more visible, this commit also improves on some of them, most notable the "layout not found", which now would look something like this:

```bash
WARN 2018/11/02 09:02:18 Found no layout for "home", language "en", output format "CSS": create a template below /layouts with one of these filenames: index.en.css.css, home.en.css.css, list.en.css.css, index.css.css, home.css.css, list.css.css, index.en.css, home.en.css, list.en.css, index.css, home.css, list.css, _default/index.en.css.css, _default/home.en.css.css, _default/list.en.css.css, _default/index.css.css, _default/home.css.css, _default/list.css.css, _default/index.en.css, _default/home.en.css, _default/list.en.css, _default/index.css, _default/home.css, _default/list.css
```

Fixes #5203
2018-11-03 12:06:23 +01:00
Bjørn Erik Pedersen 4f3c095963 Revert "tpl: Update Jsonify to return pretty-print output"
This reverts commit 5a52cd5f92.

Closes #5394
2018-11-02 19:03:48 +01:00
Bjørn Erik Pedersen 486bc46a52 docs: Regenerate the docs helper 2018-11-02 13:36:09 +01:00
Bjørn Erik Pedersen 61f210dd7a tpl: Fix the docshelper 2018-11-02 13:36:09 +01:00
Kris Budhram f8446188db Skip watcher event files if matched in ignoreFiles 2018-11-02 09:50:31 +01:00
Bjørn Erik Pedersen d523aa4bb0 deps: Update Chroma
Fixes #5392
2018-11-02 09:31:51 +01:00
Lorenz Cuno Klopfenstein b8725f5181 Fix ANSI character output regression on Windows
Fixes #5377
2018-11-02 09:09:02 +01:00
Bjørn Erik Pedersen 0bc4b0246d hugolib: Remove deprecated useModTimeAsFallback 2018-11-01 21:14:30 +01:00
Bjørn Erik Pedersen faeb55c1d8 hugolib: Bump to ERROR for the deprecated Pages.Sort 2018-11-01 21:11:45 +01:00
Bjørn Erik Pedersen 6c6a6c87ec hugolib: Deprecate .Site.Ref and .Site.RelRef
Fixes #5386
2018-11-01 21:08:12 +01:00
Bjørn Erik Pedersen 1d18eb0574 Add file (line/col) info to ref/relref errors
See #5371
2018-11-01 21:06:35 +01:00
Bjørn Erik Pedersen 33a7b36fd4 hugolib: Add .Position to shortcode
To allow for better error logging in shortcodes. Note that this may be expensive to calculate, so this is primarily for error situations.

See #5371
2018-11-01 21:06:35 +01:00
Bjørn Erik Pedersen 6180c85fb8 hugolib: Fix REF_NOT_FOUND logging to include page path
Fixes #5371
2018-11-01 21:06:35 +01:00
Bjørn Erik Pedersen d3a98325c3 common/loggers: Improve log color regexp
To avoid coloring WARNING inside log errors.
2018-11-01 09:33:32 +01:00
Bjørn Erik Pedersen b2a676f5f0 hugolib: Fix broken manual summary handling
Fixes #5381
2018-10-31 23:14:37 +01:00
Bjørn Erik Pedersen 3a786a248d tpl: Fix BOM issue in templates
Fixes #4895
2018-10-30 18:12:14 +01:00
Bjørn Erik Pedersen 729593c842 hugolib: Fix deadlock when content building times out
Fixes #5375
2018-10-30 12:18:29 +01:00
Christian Oliff e65268f2c2 Correct minor typo (#5372)
> Errors will no show up

should be:

> Errors will now show up
2018-10-29 12:09:19 +01:00
hugoreleaser f863b6a07e releaser: Prepare repository for 0.51-DEV
[ci skip]
2018-10-29 09:54:42 +00:00
hugoreleaser f5be599204 releaser: Add release notes to /docs for release of 0.50
[ci skip]
2018-10-29 09:51:50 +00:00
hugoreleaser b14c11b0e1 releaser: Bump versions for release of 0.50
[ci skip]
2018-10-29 09:51:50 +00:00
Bjørn Erik Pedersen 0addb2add6 Release 0.50 2018-10-29 10:39:51 +01:00
hugoreleaser 8bba85601f releaser: Add release notes draft for 0.50
Rename to *-ready.md to continue. [ci skip]
2018-10-29 10:39:51 +01:00
Bjørn Erik Pedersen 7082a5d143 Update go.sum 2018-10-29 09:42:53 +01:00
Bjørn Erik Pedersen aa281b5135 mod: Update minify
Closes #5261
2018-10-29 09:35:14 +01:00
Bjørn Erik Pedersen 3250198724 docs: Regenerate CLI docs 2018-10-29 09:29:27 +01:00
Bjørn Erik Pedersen d6a4af7018 Squashed 'docs/' changes from 084804447..37095d540
37095d540 Fix shortcode example

git-subtree-dir: docs
git-subtree-split: 37095d5403
2018-10-29 09:28:01 +01:00
Bjørn Erik Pedersen 27569275b1 Merge commit 'd6a4af7018e8618944a6471ceeb7aae1d4df6afa' 2018-10-29 09:28:01 +01:00
Bjørn Erik Pedersen 4b2738d871 Merge commit '74309fe5699a595080fdb3a14711e0869babce99' 2018-10-29 09:23:25 +01:00
Bjørn Erik Pedersen 74309fe569 Squashed 'docs/' changes from e5e98b950..084804447
084804447 Update shortcode-templates.md
c01b02434 Correct misspelling of 'default'
52a831cca Added missing parenthesis
59e8e660a Fix spelling typos
29ad53c9c Yes, HTML is a valid content format
c6b193c6f Update shortcode-templates.md
1f2846e6d Fix typo in output format README
5882f7a4c Fix typo
a90a00bb0 Update multilingual.md
62bf0f184 Documentation for Open Graph & Twitter Cards
f4d624da3 Document "images", "videos", etc. in front-matter
6a85b5df1 Document anchorize and Resources.Content
04c8a5b0e Fix minor typo in 0.49.2 release note
dbe77e948 Release 0.49.2
ea6c9658e Merge branch 'temp492'
85c45b725 Merge branch 'release-0.49.2'
7ad1fba29 releaser: Prepare repository for 0.50-DEV
b25bcc3f2 releaser: Add release notes to /docs for release of 0.49.2
78b751b91 releaser: Bump versions for release of 0.49.2
e3f09762c Release 0.49.1
bd5b94558 Merge branch 'temp491'
0007e0661 Merge branch 'release-0.49.1'
74d2f3a6f releaser: Prepare repository for 0.50-DEV
bbee7e9d3 releaser: Add release notes to /docs for release of 0.49.1
ae40c89c7 releaser: Bump versions for release of 0.49.1
11079fb48 Add draft statement to FAQ
069b9472f Addin Hokus CMS to frontends list.
6e8850670 Add MediaType docs
f3ca6209a Add `languageName` to configuration
fd1cde5ea tpl: Add a delimiter parameter to lang.NumFmt
c620ff78a Update doc to use proper variable
7317c339a add tools->hugo-elasticsearch description to docs
d758ef94a hugolib: Introduce Page.NextPage and Page.PrevPage
9c93ac031 Update installing.md
7c0b5b7f5 Use ISO 639-1 code for examples
9a9e40ba8 Fix spelling
9a6216c18 Hugo 0.49
55aa91185 Merge branch 'temp49'
e0a36421e releaser: Prepare repository for 0.50-DEV
c07b3b385 releaser: Add release notes to /docs for release of 0.49
c1175a12a releaser: Bump versions for release of 0.49
2966f6254 docs: Document directory based archetypes
73dcd02ed Add showcase archetype folder
0a55ad11b docs: Regenerate CLI docs
e09866c2d docs: Document group
ef986358a Merge commit '807c551922707fc5ae0eb26e8f01638c0c63fdb3'
681f14fc9 tpl/collections: Allow first function to return an empty slice
f6dcc93bc docs: Add docs for append
aae528ca3 Merge commit '13e64d72763bf8d6d92d4cdfc15ed45ee9debfab'
02b62294c tpl/strings: Add strings.FirstUpper
bf3e61ba3 hugolib: Do not FirstUpper taxonomy titles

git-subtree-dir: docs
git-subtree-split: 0848044474
2018-10-29 09:19:20 +01:00
Bjørn Erik Pedersen 9c88a8a55a common/loggers: Make sure the global logger also gets colored labels
See #4414
2018-10-28 16:06:50 +01:00
Bjørn Erik Pedersen 95e72f5e8e i18n: Avoid using the global logger
See #4414
2018-10-28 14:42:41 +01:00
Bjørn Erik Pedersen 1c7b7b4ef2 common/loggers: Add color to ERROR and WARN
Fixes #4414
2018-10-28 14:16:23 +01:00
Bjørn Erik Pedersen 1ad117cbe2 common/herrors: Make the file error log format configurable
Will check for an OS environment variable named `HUGO_FILE_LOG_FORMAT`.

The tokens available are `:file` (absolute filename), `:line` (line number) and `:col` (column number).

The default format is: \":file::line::col\"`

How to set OS environment variables is OS specific, but an example on Unix setting an alternative format when running Hugo:

```bash
env HUGO_FILE_LOG_FORMAT="\":file::line\"" hugo
```

The above will include filename and line number quoted.

Fixes #5352
2018-10-27 19:14:16 +02:00
Bjørn Erik Pedersen dac7092a9c common/collections: Allow a mix of slice types in append/Scratch.Add
The type handling in these was improved in Hugo 0.49, but this also meant that it was no longer possible to start out with a string slice and later append `Page` etc. to it.

This commit makes sure that the old behaviour is now possible again by falling back to a `[]interface{}` as a last resort.

Fixes #5361
2018-10-27 15:05:40 +02:00
Bjørn Erik Pedersen b27ccf34bf resource: Allow .Data.Integrity to be accessed on its own
Fixes #5296
2018-10-27 11:34:15 +02:00
Bjørn Erik Pedersen 286d0b7dc3 Revert "mod: Update minify"
This reverts commit 83c873ff37.
2018-10-26 19:30:01 +02:00
Bjørn Erik Pedersen 83c873ff37 mod: Update minify
Closes #5261
2018-10-26 17:16:01 +02:00
Bjørn Erik Pedersen a2440dc0e2 mod: Update cast
Closes #5340
2018-10-26 17:13:22 +02:00
Bjørn Erik Pedersen 1e9ac3dcc2 commands: Truncate the error log on repeated config errors 2018-10-26 17:02:53 +02:00
Bjørn Erik Pedersen 40e99672b6 docs: Regenerate CLI docs
Closes #5354
2018-10-26 15:10:43 +02:00
Bjørn Erik Pedersen 3a3badfd1d resource: Serialize image processing
Fixes #5220
2018-10-26 14:40:05 +02:00
Bjørn Erik Pedersen df021317a9 commands: Only show Ansi escape codes if in a terminal 2018-10-26 14:33:44 +02:00
Bjørn Erik Pedersen 78578632f5 Fix archetype handling of directories in theme
Fixes #5318
2018-10-26 12:16:28 +02:00
Bjørn Erik Pedersen 6b78b3810a Revert "commands: Read disableFastRender from flag even if it's not changed"
On second thought, removing this isn't worth it.

This reverts commit 78a4c2e32e.
2018-10-24 22:15:57 +02:00
Bjørn Erik Pedersen 78a4c2e32e commands: Read disableFastRender from flag even if it's not changed
Fixes #5353
2018-10-24 20:33:07 +02:00
Bjørn Erik Pedersen d4ebfea1ff comamnds: Use overflow-x: auto; for browser errors 2018-10-24 19:20:37 +02:00
Bjørn Erik Pedersen 93aa6261b4 common/loggers: Remove the ANSI color for the browser error version 2018-10-24 17:22:07 +02:00
Bjørn Erik Pedersen acc14b4646 hugolib: Adjust error test to make it pass on Go tip 2018-10-24 15:19:49 +02:00
Bjørn Erik Pedersen 2d7709d155 tpl: Handle truncated identifiers in Go template errors
Long identifiers will give errors on the format:

```bash
 _default/single.html:5:14: executing "main" at <.ThisIsAVeryLongTitl...>: can't evaluate field ThisIsAVeryLongTitle
```

Hugo use this value to match the "base template or not", so we need to strip the "...".

Fixes #5346
2018-10-24 13:54:04 +02:00
Bjørn Erik Pedersen deff9e154b Add some color to the relevant filenames in terminal log
Fixes #5344
2018-10-24 13:02:18 +02:00
Bjørn Erik Pedersen 889aca054a Run gofmt -s 2018-10-24 00:12:32 +02:00
Bjørn Erik Pedersen e3ed4a83b8 hugolib: Rename some page_* files
To make it easier to see/work with the source files that is about the `Page` struct.
2018-10-23 22:21:21 +02:00
Bjørn Erik Pedersen 6636cf1bea Resolve error handling/parser related TODOs
See #5324
2018-10-23 19:41:22 +02:00
Bjørn Erik Pedersen f669ef6bec herrors: Improve handling of JSON errors
`*json.UnmarshalTypeError` and `*json.SyntaxError` has a byte `Offset`, so use that.

This commit also reworks/simplifies the errror line matching logic. This also makes the file reading unbuffered, but that should be fine in this error case.

See #5324
2018-10-23 14:35:43 +02:00
Bjørn Erik Pedersen ed7b3e2619 commands, hugolib: Get file context in "config parse failed" errors
Fixes #5325
2018-10-23 08:09:41 +02:00
Bjørn Erik Pedersen 2bf686ee21 hugolib: Improve errors in /i18n handlling
See #5324
2018-10-22 20:46:14 +02:00
Bjørn Erik Pedersen 9f74dc2a52 hugolib: Improve errors in /data handlling
See #5324
2018-10-22 20:46:14 +02:00
Bjørn Erik Pedersen d1661b823a hugolib: Continue the file context/line number errors work
See #5324
2018-10-22 20:46:14 +02:00
Bjørn Erik Pedersen 7930d2132a hugolib: Remove the now superflous Source struct
See #5324
2018-10-22 20:46:14 +02:00
Bjørn Erik Pedersen eb038cfa0a Convert the rest to new page parser code paths
And remove some now unused code.

See #5324
2018-10-22 20:46:14 +02:00
Bjørn Erik Pedersen 129c27ee6e parser/metadecoders: Consolidate the metadata decoders
See #5324
2018-10-22 20:46:13 +02:00
Bjørn Erik Pedersen 44da60d869 hugolib: Redo the summary delimiter logic
Now that we have a proper page parse tree, this can be greatly simplified.

See #5324
2018-10-22 20:46:13 +02:00
Bjørn Erik Pedersen 1e3e34002d hugolib: Integrate new page parser
See #5324
2018-10-22 20:46:13 +02:00
Bjørn Erik Pedersen 1b7ecfc2e1 hugolib: Use []byte in shortcode parsing
See #5324
2018-10-22 19:57:44 +02:00
Bjørn Erik Pedersen 27f5a906a2 parser/pageparser: Use []byte in page lexer
See #5324
2018-10-22 19:57:44 +02:00
Bjørn Erik Pedersen 2fdc4a24d5 parser/pageparser: Add front matter etc. support
See #5324
2018-10-22 19:57:43 +02:00
Bjørn Erik Pedersen f6863e1ef7 parser/pageparser: File renames and splitting
See #5324
2018-10-22 19:57:43 +02:00
Bjørn Erik Pedersen d6c16afde0 Move the shortcode parser to the new pageparser package
See #5324
2018-10-22 19:57:43 +02:00
Bjørn Erik Pedersen 6f3716dc22 commands: Avoid panic in error handler on config errors 2018-10-22 19:51:59 +02:00
Sean Prashad 5a52cd5f92 tpl: Update Jsonify to return pretty-print output
Fixes #5040
2018-10-21 23:36:35 +02:00
Bjørn Erik Pedersen 4a366fcfee Prevent stale content in Fast Render Mode
We do that by re-render visited pages that is not already in the stack. This may potentially do some double work, but that small penalty should be well worth it.

Fixes #5281
2018-10-17 10:15:22 +02:00
Bjørn Erik Pedersen 083311d033 hugolib: Fix test on Windows 2018-10-17 08:37:02 +02:00
Bjørn Erik Pedersen 0fe4ff1875 tpl: Improve the Execute panic error message
See #5327
2018-10-17 08:25:57 +02:00
Janus 1f42e47e47 Allow date and slug from filename for leaf bundles
Fixes #4558
2018-10-16 23:51:48 +02:00
Bjørn Erik Pedersen 35fbfb19a1 commands: Show server error info in browser
The main item in this commit is showing of errors with a file context when running `hugo server`.

This can be turned off: `hugo server --disableBrowserError` (can also be set in `config.toml`).

But to get there, the error handling in Hugo needed a revision. There are some items left TODO for commits soon to follow, most notable errors in content and config files.

Fixes #5284
Fixes #5290
See #5325
See #5324
2018-10-16 22:10:56 +02:00
Kris Budhram 3a3089121b Simple doc fix in CONTRIBUTING.md 2018-10-16 13:30:00 +02:00
Akshay Raj Gollahalli c21e5179ce tpl: Use .Lastmod in embedded schema template
Fixes #5320
2018-10-16 11:52:32 +02:00
Bjørn Erik Pedersen a205f24ba5 Revert "commands: Add .gitignore "hugo new site""
This fails on Windows, so it needs to be reconsidered.

This reverts commit 92979d9288.
2018-10-16 08:43:38 +02:00
Nathaniel Peiffer 92979d9288 commands: Add .gitignore "hugo new site" 2018-10-16 08:36:27 +02:00
Cameron Moore 0a3340e952 resource: Optimize integrity string generation
Remove use of fmt.Sprintf for simple string concatenation.  A simple
change for a small perf boost.

```
name         old time/op    new time/op    delta
Integrity-4     525ns ± 2%     268ns ± 2%  -48.92%  (p=0.000 n=10+10)

name         old alloc/op   new alloc/op   delta
Integrity-4      144B ± 0%      112B ± 0%  -22.22%  (p=0.000 n=10+10)

name         old allocs/op  new allocs/op  delta
Integrity-4      5.00 ± 0%      3.00 ± 0%  -40.00%  (p=0.000 n=10+10)
```
2018-10-16 08:33:38 +02:00
Elliot Forbes 6b21ac3e67 commands: Add help text to "hugo new" 2018-10-15 17:48:19 +02:00
Anthony Fok d14420539a snap: Set "extended" tag based on build_url on Launchpad
Read build_url from $SNAPCRAFT_IMAGE_INFO to determine whether
to add the "extended" build tag or not.  This allows us to do away
with the extended-snap-master and extended-snap-stable branches.
2018-10-12 11:10:38 +08:00
Shreyansh Khajanchi 3d4a9882bf helpers: Call rst2html directly on *nix
Initially, rst2html was called via the python interpreter which would
fail if the script was wrapped in a launcher as on NixOS.
Ideally, on *nix, binaries should be invoked directly to ensure that
shebangs work properly as is being done now.
Handle the case of windows as it doesn't do shebangs.
2018-10-11 22:46:10 +02:00
Ben Abbott bdca972794 Update URLs to stop 301 redirects 2018-10-11 22:44:06 +02:00
Bjørn Erik Pedersen 604ddb90c5 Merge branch 'release-0.49.2' 2018-10-11 12:01:51 +02:00
hugoreleaser b09e495a71 releaser: Prepare repository for 0.50-DEV
[ci skip]
2018-10-11 09:49:59 +00:00
hugoreleaser 42cde66663 releaser: Add release notes to /docs for release of 0.49.2
[ci skip]
2018-10-11 09:47:57 +00:00
hugoreleaser ad60948c46 releaser: Bump versions for release of 0.49.2
[ci skip]
2018-10-11 09:47:57 +00:00
Bjørn Erik Pedersen c397f2c080 Release 0.49.2 2018-10-11 11:41:46 +02:00
hugoreleaser b9e18e20c8 releaser: Add release notes draft for 0.49.2
Rename to *-ready.md to continue. [ci skip]
2018-10-11 09:39:29 +00:00
Bjørn Erik Pedersen 2159d77f36 common/collections: Fix type checking in Append
The fix introduced in Hugo `0.49.1` had an unintended side-effect in the `Append` func used in both `append` and `.Scratch.Add`.

This commit fixes that by loosen/fixing the type checking so concrete types can be appended to interface slices.

Fixes #5303
2018-10-11 11:30:17 +02:00
Bjørn Erik Pedersen 535755e4f8 common/collections: Fix type checking in Append
The fix introduced in Hugo `0.49.1` had an unintended side-effect in the `Append` func used in both `append` and `.Scratch.Add`.

This commit fixes that by loosen/fixing the type checking so concrete types can be appended to interface slices.

Fixes #5303
2018-10-11 11:24:10 +02:00
Bjørn Erik Pedersen 3583dd6d71 Merge branch 'release-0.49.1' 2018-10-10 13:00:01 +02:00
hugoreleaser e5b4cb2419 releaser: Prepare repository for 0.50-DEV
[ci skip]
2018-10-10 10:38:45 +00:00
hugoreleaser 821adf3ae8 releaser: Add release notes to /docs for release of 0.49.1
[ci skip]
2018-10-10 10:36:37 +00:00
hugoreleaser 8ba9a27366 releaser: Bump versions for release of 0.49.1
[ci skip]
2018-10-10 10:36:37 +00:00
Bjørn Erik Pedersen 235acf2232 Relase 0.49.1 2018-10-10 12:31:46 +02:00
hugoreleaser ac0fac9347 releaser: Add release notes draft for 0.49.1
Rename to *-ready.md to continue. [ci skip]
2018-10-10 10:28:25 +00:00
Bjørn Erik Pedersen 23f48c300c common/maps: Improve append in Scratch
This commit consolidates the reflective collections handling in `.Scratch` vs the `tpl` package so they use the same code paths.

This commit also adds support for a corner case where a typed slice is appended to a nil or empty `[]interface{}`.

Fixes #5275
2018-10-10 12:21:51 +02:00
Bjørn Erik Pedersen e2201ef15f tpl/collections: Fix handling of different interface types in Slice
In Hugo `0.49` we improved type support in `slice`. This has an unfortunate side effect in that `resources.Concat` now expects something that can resolve to `resource.Resources`.

This worked for most situations, but when you try to `slice` different `Resource` objects, you would be getting `[]interface {}` and not `resource.Resources`. And `concat` would fail:

```bash
error calling Concat: slice []interface {} not supported in concat.
```

This commit fixes that by simplifying the type checking logic in `Slice`:

* If the first item implements the `Slicer` interface, we try that
* If the above fails or the first item does not implement `Slicer`, we just return the `[]interface {}`

Fixes #5269
2018-10-10 12:21:42 +02:00
Bjørn Erik Pedersen b5e17f7c83 Add GOPATH Hugo building tip 2018-10-09 11:09:00 +02:00
Bjørn Erik Pedersen 31a8bb8c07 common/maps: Improve append in Scratch
This commit consolidates the reflective collections handling in `.Scratch` vs the `tpl` package so they use the same code paths.

This commit also adds support for a corner case where a typed slice is appended to a nil or empty `[]interface{}`.

Fixes #5275
2018-10-08 12:30:50 +02:00
Bjørn Erik Pedersen 8e825ddf5b Revert "tpl: Fix baseof.html in error message"
I need to rethink this.

This reverts commit 646a52a5c5.
2018-10-07 21:08:41 +02:00
Bjørn Erik Pedersen 646a52a5c5 tpl: Fix baseof.html in error message
This fix should also make the template loadin slightly faster, as we avoid to reparse the baseof.html files more than one time.

Fixes #5288
2018-10-06 12:04:29 +02:00
Bjørn Erik Pedersen e421696d02 helpers: Consolidate MakeSegment vs MakePathSanitized
In short:

* Avoid double tolower in MakeSegment
* Use MakePathSanitized for taxonomies in pageToPermalinkTitle; this matches what MakeSegment does.
* Move the "double hyphen and space" logic into UnicodeSanitize

The last bullet may be slightly breaking for some that now does not get the "--" in some URLs, but we need to reduce the amount of URL logic.

See #4926
2018-10-03 15:55:25 +02:00
Gregorio Martinez 4b4af2c52e hugolib: Use stdlib context package 2018-10-03 14:59:35 +02:00
Cameron Moore fae48d7457 hugolib: Normalize permalink path segments
When constructing permalinks, ensure that most inputs used as path
segments are normalized with PathSpec.MakeSegment instead of
PathSpec.URLize.

The primary exception to that rule is with taxonomy titles in
pageToPermalinkTitle(). The approach taken here is to use URLize for
taxonomy pages. Everything else will use MakeSegment. The reason for
this exception is that people use taxonomies such as "s1/p1" to generate
URLs precisely they way they wish (see #5223). Tests have been added to
check for this case.

Fixes #4926
2018-10-03 11:02:15 +03:00
Gregorio Martinez 06d28a464d hugolib: Fix FuzzyWordCount test error message 2018-10-03 10:01:30 +03:00
Kaushal Modi 6818170308 Render Markdown in figure shortcode "caption" and "attr" params
Fixes https://github.com/gohugoio/hugo/issues/4406.
2018-10-03 09:55:53 +03:00
Kaushal Modi c5279064df Re-organize the figure shortcode for better readability 2018-10-03 09:55:53 +03:00
Gregorio Martinez 152cffb13a Update README & CONTRIBUTING
Fix broken links for Dev Chat that point to broken gitter.im room.
Remove lines about `mage vendor` target that is no longer available.
Remove broken table of contents links for headings in CONTRIBUTING.md
Fix typo
2018-10-03 09:50:02 +03:00
Cameron Moore 0d5110d033 tpl: Cast IsSet key to int for indexed types
Don't assume that the user sends an int as the key when checking against
indexed types.

Fixes #3681
2018-10-03 09:36:27 +03:00
Cameron Moore d3b81ee58e hugolib: Improve error message for bad taxonomy weights
Error is now "Unable to convert taxonomy weight []string{"40"} to int
for variables/files.md"
2018-10-03 09:34:45 +03:00
Cameron Moore 1fd30d462e hugolib: Cast taxonomy weight parameters to int
Fixes #4628
2018-10-03 09:34:45 +03:00
Cameron Moore 498d629958 hugolib: Allow nil to be unwrapped as *Page
Previously, calls to *Page.Eq(nil) would always return false because the
unwrapPage func didn't support the nil case.  Add support for unwrapping
nil to a *Page.

Fixes #5043
2018-10-03 09:33:42 +03:00
Bjørn Erik Pedersen 10ac2ec446 tpl/collections: Fix handling of different interface types in Slice
In Hugo `0.49` we improved type support in `slice`. This has an unfortunate side effect in that `resources.Concat` now expects something that can resolve to `resource.Resources`.

This worked for most situations, but when you try to `slice` different `Resource` objects, you would be getting `[]interface {}` and not `resource.Resources`. And `concat` would fail:

```bash
error calling Concat: slice []interface {} not supported in concat.
```

This commit fixes that by simplifying the type checking logic in `Slice`:

* If the first item implements the `Slicer` interface, we try that
* If the above fails or the first item does not implement `Slicer`, we just return the `[]interface {}`

Fixes #5269
2018-10-02 23:54:16 +03:00
Cameron Moore ce264b936c tpl: Add a delimiter parameter to lang.NumFmt
The original implementation of NumFmt did not take into account that the
options delimiter (a space) could be a valid option.  Adding a delim
parameter seems like the simplest, safest, and most flexible way to
solve this oversight in a backwards-compatible way.

Fixes #5260
2018-10-02 17:41:48 +03:00
Anthony Fok 91f49c0700 snap: Add custom x-nodejs plugin to support ppc64el and s390x 2018-09-30 23:03:05 -06:00
Anthony Fok a475bf125c snap: Fetch mage with GO111MODULE=off 2018-09-30 23:03:01 -06:00
Anthony Fok f1dede3708 snap: Revert 'Skip "mage -v test" due to build failure on Launchpad'
This reverts commit 52ac85fbc4.
2018-09-30 23:02:58 -06:00
Anthony Fok fa873a6cb3 snap: Use build-snaps instead of building go from source
See https://forum.snapcraft.io/t/go-part-fails-with-go1-11-if-go-mod-exists-in-the-top-level-directory/7546/11
2018-09-30 23:02:34 -06:00
Bjørn Erik Pedersen fb732d5322 hugolib: Be a litle more specific in NextPage TODO 2018-09-26 09:26:53 +02:00
Ricardo N Feliciano ad705aac06 hugolib: Introduce Page.NextPage and Page.PrevPage
Introduce new page position variables in order to fix the ordering issue
of `.Next` and `.Prev` while also allowing an upgrade path via
deprecation.

`.NextInSection` becomes `.NextPageInSection`.
`.PrevInSection` becomes `.PrevPageInSection`.

`.Next` becomes a function returning `.PrevPage`.
`.Prev` becomes a function returning `.NextPage`.

Fixes #1061
2018-09-26 09:22:43 +02:00
Anthony Fok 52ac85fbc4 snap: Skip "mage -v test" due to build failure on Launchpad
The run "go test ./... -tags none" fails with multiple errors of

    use of internal package github.com/gohugoio/hugo/tpl/internal not allowed

See https://launchpadlibrarian.net/390252700/buildlog_snap_ubuntu_xenial_amd64_hugo-dev_BUILDING.txt.gz

I was unable to reproduce it with snapcraft in LXD
on my local Debian laptop, so this error is still a mystery to me.
2018-09-25 16:08:22 -06:00
Anthony Fok 048a64be1c releaser: Update path to snap/snapcraft.yaml 2018-09-25 07:21:09 -06:00
Anthony Fok 3033a9a37e snap: Fix go plugin build failure by renaming go.mod
as a temporary workaround.

See https://forum.snapcraft.io/t/go-plugin-go1-11-fails-if-go-mod-exists-in-the-top-level-directory/7546
and https://discourse.gohugo.io/t/hugo-0-48-released/13908/12
2018-09-25 07:05:55 -06:00
Anthony Fok 27d4211187 snap: Move snapcraft.yaml to snap/snapcraft.yaml 2018-09-25 07:03:51 -06:00
Anthony Fok 4730a78a76 snapcraft: Try installing postcss again
Revert "snap: Skip installing postcss due to failure on build server"

This reverts commit 66f688f712.
2018-09-24 22:20:45 -06:00
Anthony Fok b7706d6aec snapcraft: Set GO111MODULE=on in override-build script
Apparently, snapcraft's yet-to-be-documented environment declaration
feature is for run-time only.

See https://discourse.gohugo.io/t/hugo-0-48-released/13908/9
and https://forum.snapcraft.io/t/declaratively-defining-environment-variables/175/29
2018-09-24 22:15:42 -06:00
Bjørn Erik Pedersen 48413d76f4 build: Update the temp docker script 2018-09-24 12:41:12 +02:00
hugoreleaser 66b9e2bff2 releaser: Prepare repository for 0.50-DEV
[ci skip]
2018-09-24 10:04:24 +00:00
hugoreleaser 398996e8b0 releaser: Add release notes to /docs for release of 0.49
[ci skip]
2018-09-24 10:01:04 +00:00
hugoreleaser 7f005f5e98 releaser: Bump versions for release of 0.49
[ci skip]
2018-09-24 10:01:04 +00:00
Bjørn Erik Pedersen 011e3aaa9e Release 0.49 2018-09-24 11:52:47 +02:00
Bjørn Erik Pedersen 3697448450 docs: Document directory based archetypes
See #4535
2018-09-24 11:52:25 +02:00
hugoreleaser 2638b04c62 releaser: Add release notes draft for 0.49
Rename to *-ready.md to continue. [ci skip]
2018-09-24 11:49:07 +02:00
Bjørn Erik Pedersen cf47f43ff1 ci: Add "go mod download" to CI scripts
To hopefully make them less flaky.
2018-09-24 10:31:59 +02:00
Bjørn Erik Pedersen 3b6bd1210a docs: Regenerate CLI docs 2018-09-24 10:11:41 +02:00
Bjørn Erik Pedersen 8388cd90e8 docs: Document group
Fixes https://github.com/gohugoio/hugoDocs/issues/597
2018-09-24 10:07:50 +02:00
Bjørn Erik Pedersen 807c551922 Squashed 'docs/' changes from 6b00298bb..e5e98b950
e5e98b950 Update code-toggle.md
340c9c623 Update 'Fetch from Github' installation instructions in line with Github README
d9f06c23c Add tip about clearing browser cache (#608)
7c9df4731 Adding Remark as additional Comments Alternatives for hugo (#607)
b1ce8bf02 Revert "Temp change of baseURL"
fdbc582ff Temp change of baseURL
5ec663bd6 Fix wrong date in frontmatter config example (#602)
0b3022eb1 Fix broken link to https://www.wercker.com (#603)
b4a7e31a6 Turn off minification
bfcc1ac21 Add a Tweet
8be09c0b4 Remove unused data file

git-subtree-dir: docs
git-subtree-split: e5e98b950c
2018-09-23 23:48:53 +02:00
Bjørn Erik Pedersen bc57f5c36e Merge commit '807c551922707fc5ae0eb26e8f01638c0c63fdb3' 2018-09-23 23:48:53 +02:00
Bjørn Erik Pedersen fe6a6f2737 resource/integrity: Make Data.Integrity be of type template.HTMLAttr 2018-09-23 23:40:35 +02:00
Bjørn Erik Pedersen 2650fa772b Add directory based archetypes
Given this content:

```bash
archetypes
├── default.md
└── post-bundle
    ├── bio.md
    ├── images
    │   └── featured.jpg
    └── index.md
```

```bash
hugo new --kind post-bundle post/my-post
```

Will create a new folder in `/content/post/my-post` with the same set of files as in the `post-bundle` archetypes folder.

This commit also improves the archetype language detection, so, if you use template code in your content files, the `.Site` you get is for the correct language. This also means that it is now possible to translate strings defined in  the `i18n` bundles,  e.g. `{{ i18n "hello" }}`.

Fixes #4535
2018-09-23 19:27:23 +02:00
Ricardo N Feliciano ef525b15d4 Build on CircleCI outside of GOPATH
Fixes #5135
2018-09-23 18:50:26 +02:00
Bjørn Erik Pedersen f916814697 Prevent symbolic links from themes 2018-09-23 17:18:35 +02:00
Ricardo N Feliciano cae07ce84b tpl/collections: Allow first function to return an empty slice
Fixes #5235
2018-09-22 20:58:46 +02:00
Ricardo N Feliciano 4f9c109dc5 tpl/opengraph: Use safeHTMLAttr instead of safeHTML for HTML attributes
Fixes #5236
2018-09-22 00:36:15 +02:00
Bjørn Erik Pedersen f1a00b2069 hugolib: Remove deprecated rssURI 2018-09-21 14:30:57 +02:00
Bjørn Erik Pedersen df4cbbd3bd commands: Remove deprecated flags 2018-09-21 14:27:35 +02:00
Bjørn Erik Pedersen 2e2e34a935 hugolib: Deprecate Pages.Sort
In favour of ByWeight.
2018-09-21 14:23:00 +02:00
Bjørn Erik Pedersen 2eed35c826 hugolib: Minor cleaning in the sorting code 2018-09-21 14:13:45 +02:00
Bjørn Erik Pedersen dd692c710a hugolib: Clear the page cache per render
This is a slight performance optimization with no functional effect.

See #5239
2018-09-21 11:21:15 +02:00
Bjørn Erik Pedersen ed4f1edbd7 hugolib: Compare every element in pages cache
It is slightly slower, but correctnes is, of course, more important:

```bash
benchmark                             old ns/op     new ns/op     delta
BenchmarkSortByWeightAndReverse-4     367           645           +75.75%

benchmark                             old allocs     new allocs     delta
BenchmarkSortByWeightAndReverse-4     2              2              +0.00%

benchmark                             old bytes     new bytes     delta
BenchmarkSortByWeightAndReverse-4     64            64            +0.00%
```

Running the same benchmark without any cache (i.e. resorting the slice on every iteration) and then compare it to the current version shows that it still is plenty worth it:

```bash
▶ benchcmp 2.bench 1.bench
benchmark                             old ns/op     new ns/op     delta
BenchmarkSortByWeightAndReverse-4     1358757       645           -99.95%

benchmark                             old allocs     new allocs     delta
BenchmarkSortByWeightAndReverse-4     17159          2              -99.99%

benchmark                             old bytes     new bytes     delta
BenchmarkSortByWeightAndReverse-4     274573        64            -99.98%
```

Closes #5239
2018-09-21 11:21:15 +02:00
Bjørn Erik Pedersen 058cc6c2c3 Revert "hugolib: Normalize permalink path segments"
This reverts commit 06976ebb87.

Fixes #5223
2018-09-18 09:27:49 +02:00
Bjørn Erik Pedersen 4b82f74848 Update releasenotes_writer.go
Add @onedrawingperday to the release credit list. The activity on the theme repo is increasing and the work he and @digitalcraftsman 
 is doing is very much appreciated.
2018-09-14 23:25:54 +02:00
Cameron Moore 06976ebb87 hugolib: Normalize permalink path segments
When constructing permalinks, ensure that path segments are normalized
with PathSpec.MakeSegment instead of PathSpec.URLize.

Fixes #4926
2018-09-14 11:35:26 +02:00
Bjørn Erik Pedersen 555a5612b2 hugolib: Do not set RSS as Kind in RSS output
Before Hugo this commit  we set the pseudo page kind RSS on the page when output to RSS. This had some unintended side effects, esp. when the only output format for that page  was RSS.

For the page kinds that can have multiple output formats, the Kind should be one of the standard home, page etc.

Fixes #5138
2018-09-14 11:33:02 +02:00
Bjørn Erik Pedersen 75e54345f9 hugolib: Make sure ambiguous lookups in GetPage gets an error
See #5138
2018-09-14 11:33:02 +02:00
Bjørn Erik Pedersen df50c108ba docs: Add docs for append
See #5190
2018-09-14 10:12:08 +02:00
Bjørn Erik Pedersen e27fd4c1b8 tpl/collections: Add collections.Append
Before this commit you would typically use `.Scratch.Add` to manually create slices in a loop.

With variable overwrite in Go 1.11, we can do better. This commit adds the `append` template func.

A made-up example:

```bash
{{ $p1 := index .Site.RegularPages 0 }}{{ $p2 := index .Site.RegularPages 1 }}
{{ $pages := slice }}
{{ if true }}
  {{ $pages = $pages | append $p2 $p1 }}
{{ end }}
```

Note that with 2 slices as arguments, the two examples below will give the same result:

```bash
{{ $s1 := slice "a" "b" | append (slice "c" "d") }}
{{ $s2 := slice "a" "b" | append "c" "d" }}
```

Both of the above will give `[]string{a, b, c, d}`.

This commit also improves the type handling in the `slice` template function. Now `slice "a" "b"` will give a `[]string` slice. The old behaviour was to return a `[]interface{}`.

Fixes #5190
2018-09-14 10:12:08 +02:00
Bjørn Erik Pedersen b7ca3e1b3a Merge commit '13e64d72763bf8d6d92d4cdfc15ed45ee9debfab' 2018-09-14 08:35:23 +02:00
Bjørn Erik Pedersen 13e64d7276 Squashed 'docs/' changes from 9b494a58c..6b00298bb
6b00298bb Remove outdated "related example"
987f1e1cd Fix dead links (#601)
96287a20a Add config option "summaryLength" (#600)
ced7f2085 Adjust Over showcase
e334a6354 Add new showcase: over
10435b502 Add warning about privacy options only work with internal templates (#525)
48c6b0e4d Minor grammatical fix
684670ebc Add quote
0e9fada52 Improvements to taxonomy template examples
e06c4bf73 Add syntax highlighting; consistent 4-space indentation
c1cb3f081 Remove dead links for custom permalinks
3e3aefd04 Fix 0a671bc375
d65888685 fix file name in 'Add Non-content Entries to a Menu' code toggle (#547)
1a0563857 Add Solus install guide (#590)
8a0d65b0d Update Windows Installation instructions (#564)
c4348636a Fix typo
0a671bc37 Add post to menu example
af14497c6 Add notes for `os.Stat` (Hugo 0.47) (#557)
e49f65bb3 Singular to plural
cb5608dbf Update introduction.md
30b060dff Add variable re-definition example (Hugo v0.48+)
21123967e Minor edits
fac3df043 Refresh the Go Templates introduction
4a9600e92 Updating URL to how-to-guide for hosting hugo site on firebase
bfaa7779c add missing word
c2cb5d09b Tweak 'name: weight' to 'name: date' in example (#582)
5ea938ad6 Remove some Scratch
2708dcd57 Release 0.48
e375d0f05 Merge branch 'temp48'
75e36c160 releaser: Prepare repository for 0.49-DEV
a6102f253 releaser: Add release notes to /docs for release of 0.48
41fc35db4 releaser: Bump versions for release of 0.48
64b9ecc74 Spell out the npm command for installing PostCSS
19e900a17 Improved Related Content doc
fe21600e7 Merge commit '844aef544c19e9d8f529b4f8144e089d0982bb34'
844aef544 Squashed 'themes/gohugoioTheme/' changes from 66249819..68ddff44
069828db8 Update git.md
d881d1433 Make default "related" behavior more explicit
60b9160eb Add docs for displaying 404 page on CloudFront
b72ebc760 Add .gitattributes to /resources
000cf85f4 Make the pros/cons styling consistent for summaries; use desc list
ebf1da97a Add note about outputStyle compressed
e3338ee91 Triple backquote syntax fix
361962a7c Add one more Blogger to Hugo tool for Windows (.NET Framework 4.5) (#540)
066606a21 Fix wrong link about Mmark Syntax Document
faee70757 Added exitwp-for-hugo
6b4108051 Add hugo-wrapper to starter-kits
4695dfba2 Added Utterances as Comments Alternatives.
c7ba9e3e1 Correct typo
beb850d9f Release 0.47.1
1cf417c8a Merge branch 'temp471'
0843bc46c releaser: Prepare repository for 0.48-DEV
8ff5c8b70 releaser: Add release notes to /docs for release of 0.47.1
e2353434d releaser: Bump versions for release of 0.47.1
ffb1300af Update development.md
c22234ea5 netlify: Minify output
5b9191c56 Release 0.47
bfd92cf52 releaser: Prepare repository for 0.48-DEV
ac7acf730 releaser: Add release notes to /docs for release of 0.47
b0096099d releaser: Bump versions for release of 0.47
86a7ae459 docs: Regenerate CLI docs
d2c8b72bc Merge commit 'a95896878f4b4a79448b39ce93a4e0d3258b4a43'
84de7ef59 Merge commit '3a44bf182fed5f34621f450114083a6dd7e88a07'

git-subtree-dir: docs
git-subtree-split: 6b00298bb2
2018-09-14 08:34:58 +02:00
Alexandros 9b26b5487b minifiers: Set minifier to KeepEndTags
See: https://github.com/tdewolff/minify/blob/948b6490cf3cacab5f4d7474104c3d21bf6eda46/README.md#L171
2018-09-13 08:16:20 +02:00
James Kiefer 3dafe206e3 minifiers: Make JSON minification more generic
Add a regex matcher for json types. Specifically support LD+JSON which
allows for google seo minification out of the box. Expanded JS/JSON
minification testing.
2018-09-12 19:33:14 +02:00
Bjørn Erik Pedersen 37d6463479 Update Mage 2018-09-12 09:01:36 +02:00
Bjørn Erik Pedersen 43d446522a tpl/data: Revise error handling in getJSON and getCSV
The most important part being: Log ERROR, but do not stop the build on remote errors.

Fixes #5076
2018-09-11 16:46:25 +02:00
Cameron Moore 4f72e79120 tpl: Show error on union or intersect of uncomparable types
Fixes #3820
2018-09-11 14:09:29 +02:00
Bjørn Erik Pedersen fe6676c775 tpl/collections: Improve type handling in collections.Slice
Fixes #5188
2018-09-10 09:19:01 +02:00
Bjørn Erik Pedersen 7a97d3e6bc tpl/collections: Allow pointer receiver in Group
See #4865
2018-09-08 21:56:36 +02:00
Bjørn Erik Pedersen 6667c6d743 tpl/collections: Add group template func
This extends the page grouping in Hugo with a template function that allows for ad-hoc grouping.

A made-up example:

```
{{ $cool := where .Site.RegularPages "Params.cool" true | group "cool" }}
{{ $blue := where .Site.RegularPages "Params.blue" true | group "blue" }}
{{ $paginator := .Paginate (slice $cool $blue) }}
```

Closes #4865
2018-09-08 20:20:26 +02:00
Vincent Danjean cfda13b363 hugolib: Allow creating page groups from any page collection
This also adjusts the pagination logic to allow for these new collections.

Note that we will follow up with a template function named `group` that will be the end user API. The `.Group` method on `Page` should be considered as internal.

Updates #4865
2018-09-08 11:14:09 +02:00
Bjørn Erik Pedersen bb2fe814c2 Update dependencies 2018-09-07 16:06:34 +02:00
Bjørn Erik Pedersen e5d66074ce tpl/strings: Add strings.FirstUpper
Fixes #5174
2018-09-07 09:08:14 +02:00
Cameron Moore d970327d7b hugofs: Fix filepath issue in test 2018-09-07 08:25:51 +02:00
Cameron Moore 0013bea901 resource: Fix golint issues
Fix godoc comments and the following:

resource/image.go:33:2: a blank import should be only in a main or test package, or have a comment justifying it
resource/image.go:35:2: a blank import should be only in a main or test package, or have a comment justifying it
resource/image.go:41:2: a blank import should be only in a main or test package, or have a comment justifying it
resource/image.go:538:10: if block ends with a return statement, so drop this else and outdent its block
resource/resource.go:54:7: exported const DefaultResourceType should have comment or be unexported
resource/resource.go:233:1: receiver name r1 should be consistent with previous receiver name r for Resources
resource/resource.go:254:1: receiver name r1 should be consistent with previous receiver name r for Resources
2018-09-07 08:25:51 +02:00
Cameron Moore 30bc4ed0a0 Improve some godoc comments 2018-09-07 08:25:51 +02:00
Cameron Moore f6f22ad944 tpl: Fix golint godoc issues 2018-09-07 08:25:51 +02:00
Cameron Moore 400fe96aee media: Fix golint issues
Fix godoc issues and the following:

media/mediaType.go:228:1: receiver name t should be consistent with previous receiver name m for Type
2018-09-07 08:25:51 +02:00
Cameron Moore 3f45e729f4 output: Fix golint godoc issues 2018-09-07 08:25:51 +02:00
Cameron Moore ffaa73dc8a publisher: Fix golint godoc issue 2018-09-07 08:25:51 +02:00
Cameron Moore f8d8c85428 langs: Fix golint godoc issue 2018-09-07 08:25:51 +02:00
Cameron Moore 10dc87bf86 i18n: Fix golint issue
i18n/translationProvider.go:48:21: error strings should not be capitalized or end with punctuation or a newline
2018-09-07 08:25:51 +02:00
Cameron Moore 7231869ba8 related: Fix golint issues
related/inverted_index.go:76:1: exported method Config.Add should have comment or be unexported
related/inverted_index.go:255:1: exported method IndexConfig.ToKeywords should have comment or be unexported
2018-09-07 08:25:51 +02:00
Cameron Moore ccd3285484 releaser: Fix golint issues
struct field HtmlURL should be HTMLURL
2018-09-07 08:25:51 +02:00
Cameron Moore 600047ff1c source: Fix golint godoc issues 2018-09-07 08:25:51 +02:00
Cameron Moore 5f2e1cb896 hugofs: Fix golint issues
Fix godoc issues and the following:

hugofs/noop_fs.go:25:2: error var noOpErr should have name of the form errFoo
2018-09-07 08:25:51 +02:00
Cameron Moore c8ce65046d helpers: Fix golint issues
helpers/general.go:448:1: comment on exported function DiffStrings should be of the form "DiffStrings ..."
helpers/hugo.go:42:6: exported type HugoVersionString should have comment or be unexported
helpers/hugo.go:48:1: exported method HugoVersion.Version should have comment or be unexported
helpers/hugo.go:56:1: comment on exported method HugoVersionString.Compare should be of the form "Compare ..."
helpers/hugo.go:62:1: comment on exported method HugoVersionString.Eq should be of the form "Eq ..."
helpers/path.go:548:1: comment on exported function OpenFilesForWriting should be of the form "OpenFilesForWriting ..."
helpers/processing_stats.go:24:6: exported type ProcessingStats should have comment or be unexported
helpers/processing_stats.go:55:1: exported function NewProcessingStats should have comment or be unexported
helpers/processing_stats.go:59:1: exported method ProcessingStats.Incr should have comment or be unexported
helpers/processing_stats.go:63:1: exported method ProcessingStats.Add should have comment or be unexported
helpers/processing_stats.go:67:1: exported method ProcessingStats.Table should have comment or be unexported
helpers/processing_stats.go:83:1: exported function ProcessingStatsTable should have comment or be unexported
2018-09-07 08:25:51 +02:00
Cameron Moore a53f962312 deps: Fix most golint issues
deps/deps.go:79:6: exported type Listeners should have comment or be unexported
deps/deps.go:86:1: exported method Listeners.Add should have comment or be unexported
deps/deps.go:92:1: exported method Listeners.Notify should have comment or be unexported
2018-09-07 08:25:51 +02:00
Cameron Moore daffeec30d config: Fix golint issues
config/configProvider.go:54:9: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
config/privacy/privacyConfig.go:99:1: exported function DecodeConfig should have comment or be unexported
config/services/servicesConfig.go:64:1: exported function DecodeConfig should have comment or be unexported
2018-09-07 08:25:51 +02:00
Cameron Moore b8b91f5506 common: Fix golint errors
common/errors/errors.go:21:1: comment on exported var FeatureNotAvailableErr should be of the form "FeatureNotAvailableErr ..."
common/errors/errors.go:23:5: error var FeatureNotAvailableErr should have name of the form ErrFoo
common/maps/scratch.go:76:1: comment on exported method Scratch.Delete should be of the form "Delete ..."
common/maps/scratch.go:133:1: exported function NewScratch should have comment or be unexported
common/types/types.go:44:1: exported function NewKeyValuesStrings should have comment or be unexported
2018-09-07 08:25:51 +02:00
Cameron Moore f0effac804 commands: Fix golint issues
commands/hugo.go:65:1: exported method Response.IsUserError should have comment or be unexported
commands/import_jekyll.go:100:21: error strings should not be capitalized or end with punctuation or a newline
commands/server.go:417:1: receiver name sc should be consistent with previous receiver name s for serverCmd
2018-09-07 08:25:51 +02:00
Thomas Jost be3ae3ec92 hugolib: Do not FirstUpper taxonomy titles
Doing so was probably a mistake. This may be a breaking change for some people,
but it's easy to restore the previous behaviour in the layouts.

Fixes #5172
2018-09-06 20:29:21 +02:00
Bjørn Erik Pedersen 2cf8fe2ea2 Fix broken Travis config
See https://github.com/magefile/mage/issues/79
2018-09-06 13:42:41 +02:00
Bjørn Erik Pedersen 3b103cb7b7 Update to latest Mage
And run the Appveyor tests without GOPATH.

Fixes https://github.com/magefile/mage/issues/79
2018-09-03 10:18:59 +02:00
Bjørn Erik Pedersen 0cc936583b resource: Fix broken build 2018-09-03 09:22:42 +02:00
Bjørn Erik Pedersen c15c7da42a resource: Remove some duplicate code 2018-09-02 23:57:42 +02:00
zyfdegh bcbe57c6e9 Update Dockerfile to Go 1.11
Fixes #5145
2018-08-31 09:05:52 +02:00
Cameron Moore e38e881248 hugolib: Simplify some code 2018-08-30 22:31:29 +02:00
Cameron Moore 0665a3951b hugolib: Add missing error checks 2018-08-30 22:31:29 +02:00
Cameron Moore 1ed8c36336 hugolib: Remove extraneous createStaticFs call
This looks like a copy+paste error.  We have the same line a few lines
below this call and we actually handle the err value there.
2018-08-30 22:31:29 +02:00
Cameron Moore e03eb90a36 hugolib: Fix godoc comment 2018-08-30 22:31:29 +02:00
Cameron Moore c915d0d325 hugolib: Fix typo in private func name 2018-08-30 22:31:29 +02:00
Michael Henderson 47d4edce60 Fix error message for go vet 2018-08-30 22:30:49 +02:00
Bjørn Erik Pedersen ea8ef573c6 mage: Init packages once
`go list ./...` fails when run in parallel on Windows. This also applies to running `go test ./...` and `go list/...` so we serialize tests.
2018-08-30 13:36:33 +02:00
Bjørn Erik Pedersen 293e12355d appveyor: Update script to Go 1.11
Fixes #5127
2018-08-30 13:36:33 +02:00
Bjørn Erik Pedersen fdf3c3b823 build: Remove the remains of Go Dep
Appveyor is now Go 1.11 ready, so we can go all "Go Modules".

Closes #5115
2018-08-30 13:36:33 +02:00
Bjørn Erik Pedersen 312d2252be Update CONTRIBUTING.md 2018-08-29 14:21:20 +02:00
Bjørn Erik Pedersen f627903efa Update README.md 2018-08-29 14:17:47 +02:00
Bjørn Erik Pedersen a2f0f9d475 snapcraft: Update to work with Go Modules 2018-08-29 09:37:26 +02:00
hugoreleaser 1ff54ab3d9 releaser: Prepare repository for 0.49-DEV
[ci skip]
2018-08-29 06:36:18 +00:00
hugoreleaser 456f5476cf releaser: Add release notes to /docs for release of 0.48
[ci skip]
2018-08-29 06:33:03 +00:00
hugoreleaser 09811d0bee releaser: Bump versions for release of 0.48
[ci skip]
2018-08-29 06:33:03 +00:00
Bjørn Erik Pedersen d351ac2e69 Release 0.48 2018-08-28 23:17:01 +02:00
hugoreleaser 59f57900a4 releaser: Add release notes draft for 0.48
Rename to *-ready.md to continue. [ci skip]
2018-08-28 20:26:28 +00:00
Bjørn Erik Pedersen 59cdad325a release: Fix CircleCI script 2018-08-28 22:17:35 +02:00
Bjørn Erik Pedersen 6022f219f1 hugolib: Only run variable variable overwrite test on Go 1.11 2018-08-28 18:00:19 +02:00
Bjørn Erik Pedersen 0c8a415483 hugolib: Add a test for template variable overwrite
New in Go 1.11.
2018-08-28 17:35:33 +02:00
Bjørn Erik Pedersen f4675fa0f0 helpers: Fix permissions when creating new folders
This was mistakingly changed from 07777 (rwx, rw, r before umask) to 0755 in Hugo 0.37. This commit reverts to the old value.

Fixes #5128
2018-08-28 17:14:56 +02:00
Bjørn Erik Pedersen ebb56e8bdb Improve minifier MIME type resolution
This commit also removes the deprecated `Suffix` from MediaType. Now use `Suffixes` and put the MIME type suffix in the type, e.g. `application/svg+xml`.

Fixes #5093
2018-08-28 17:00:53 +02:00
Bjørn Erik Pedersen 6b9934a266 circleci: Update to Go 1.11
See #5115
2018-08-28 11:22:50 +02:00
Bjørn Erik Pedersen c7f057797c travis: Set GO111MODULE=on for mage install
See #5115
2018-08-28 11:22:50 +02:00
Anthony Fok 08d14113b6 resource: Add instruction to install PostCSS when missing
Fixes #5111
2018-08-26 15:22:58 +02:00
Bjørn Erik Pedersen 94d6d6780f Update snapcraft build config to Go 1.11
See #5115
2018-08-26 10:43:53 +02:00
Bjørn Erik Pedersen 45c9c45d1d Use Go 1.11 modules with Mage
See #5115
2018-08-25 20:50:58 +02:00
Bjørn Erik Pedersen fce32c07fb Add go.mod
See #5115
2018-08-25 20:50:58 +02:00
Bjørn Erik Pedersen d32ff16fd6 Update Travis to Go 1.11 and Go 1.10.4
See #5115
2018-08-25 17:37:42 +02:00
vsopvsop e6eda2a370 minfiers: Keep end tags
Fixes  #5112
2018-08-25 10:49:15 +02:00
Anthony Fok 66f688f712 snap: Skip installing postcss due to failure on build server
npm running on fails to fetch postcss-cli on build.snapcraft.io
due to network proxy issue.

See https://forum.snapcraft.io/t/build-fails-behind-proxy-on-build-snapcraft-io/6951/3
2018-08-24 10:08:56 -06:00
Anthony Fok 2c934be8ab snap: Refactor, fix bin/node, and add bin/postcss 2018-08-24 09:35:06 -06:00
Bjørn Erik Pedersen 94d0e79d33 hugolib: Include language code in REF_NOT_FOUND errors
Fixes #5110
2018-08-24 09:23:01 +02:00
Bjørn Erik Pedersen b9a503febb tpl/tplimpl: Make the autogenerated templates collapsed in PRs 2018-08-23 22:03:43 +02:00
Cameron Moore fff132537b Fix handling of taxonomy terms containing slashes
Fixes #4090
2018-08-22 07:18:37 +02:00
Carlos Alexandro Becker 8999de193c Fix build on armv7
Closes #5101
2018-08-20 19:44:00 +02:00
hugoreleaser a81c64e43e releaser: Prepare repository for 0.48-DEV
[ci skip]
2018-08-20 08:19:37 +00:00
hugoreleaser 7ef5096257 releaser: Add release notes to /docs for release of 0.47.1
[ci skip]
2018-08-20 08:16:49 +00:00
hugoreleaser 16b691a875 releaser: Bump versions for release of 0.47.1
[ci skip]
2018-08-20 08:16:49 +00:00
Bjørn Erik Pedersen aefd9a80a6 Release 0.47.1 2018-08-20 10:10:38 +02:00
hugoreleaser 57ace857aa releaser: Add release notes draft for 0.47.1
Rename to *-ready.md to continue. [ci skip]
2018-08-20 08:06:27 +00:00
Bjørn Erik Pedersen fdff0d3af4 tpl/tplimpl: Fix .Site.Params case regression
Fixes #5094
2018-08-19 14:30:37 +02:00
Anthony Fok 834617f9f8 snap: Remove unused files from Git, Perl, etc.
Snap size reduced from 46MB to 26MB.
2018-08-18 06:26:54 -06:00
Anthony Fok ef20ec1fba snap: Add nodejs to allow PostCSS to work
See https://discourse.gohugo.io/t/snap-pipeline-error-with-postcss-environment-issue/13583
2018-08-18 05:04:52 -06:00
Bjørn Erik Pedersen 5a0ee2b934 minifiers: Do not strip IE conditional statements
Fixes #5089
2018-08-18 11:16:34 +02:00
hugoreleaser 6746826689 releaser: Prepare repository for 0.48-DEV
[ci skip]
2018-08-17 09:17:44 +00:00
hugoreleaser caf608d566 releaser: Add release notes to /docs for release of 0.47
[ci skip]
2018-08-17 09:15:18 +00:00
hugoreleaser 6711dacded releaser: Bump versions for release of 0.47
[ci skip]
2018-08-17 09:15:18 +00:00
Bjørn Erik Pedersen de23293486 releaser: Work around a Goreleaser bug
Closes #4918
2018-08-17 11:03:28 +02:00
Bjørn Erik Pedersen 918177ac25 Release 0.47 2018-08-17 10:38:31 +02:00
hugoreleaser 83a980d290 releaser: Add release notes draft for 0.47
Rename to *-ready.md to continue. [ci skip]
2018-08-17 08:19:47 +00:00
Bjørn Erik Pedersen 4a16b5f4b0 docs: Regenerate CLI docs 2018-08-17 10:12:19 +02:00
Bjørn Erik Pedersen a95896878f Squashed 'docs/' changes from d88477eb3..9b494a58c
9b494a58c Add comma in example config
1c24f672d Update multilingual.md
8bf85bfe4 Cosmetic change to test GitInfo
3b53b54f9 Update installing.md
e3b8eb941 Get arolla-cocoon showcase ready for publishing
7b7931e59 Add  "Cocoon Arolla showcase"
c9cc7852c Add "scoop install hugo" for quick install on Windows
3037527fe Update Directory Structure following Hugo Pipes
dbecb967d Add `assetDir` key to config list
488d1d034 Remove alias.txt

git-subtree-dir: docs
git-subtree-split: 9b494a58cd
2018-08-17 10:09:42 +02:00
Bjørn Erik Pedersen 873f8805cb Merge commit 'a95896878f4b4a79448b39ce93a4e0d3258b4a43' 2018-08-17 10:09:42 +02:00
Steven Allen 3743875778 tpl/tplimpl: Fix compiling Amber templates that import other templates
Without this patch, amber would try to load templates from the OS filesystem
instead of the layouts virtual filesystem.
2018-08-17 10:04:07 +02:00
Bjørn Erik Pedersen baa62d0abb hugolib: Adjust tests for shortcode p-issue
See #1642
2018-08-17 09:13:39 +02:00
gllera 78c99463fd hugolib: Fix shortcode output wrapped in p
Fixes #1642
2018-08-17 09:13:30 +02:00
Anthony Fok abc54080ec Add configFile(s) back to the watch list after REMOVE event
Fixes #4701
2018-08-16 16:11:57 +02:00
Bjørn Erik Pedersen a655e00d70 commands: Gracefully handle typos in server config when running the server
Fixes #5081
2018-08-16 12:54:59 +02:00
Bjørn Erik Pedersen 9d973004f5 hugolib: Fix image cache-clearing for sub-languages
Fixes #5084
2018-08-16 12:54:59 +02:00
Bjørn Erik Pedersen 2247546017 hugolib: Force render of any changed page, even in Fast Render Mode
Fixes #5083
2018-08-16 12:54:59 +02:00
Bjørn Erik Pedersen d139a037d9 hugoblib: Fix "adding a bundle" in server mode
Before this commit, the live reload logic in `hugo server` got confused when you dropped a new bundle into the project while the server was running. The workaround was to restart the server.

This commit fixes the "live reload bundle detection" in server mode, and also makes sure that the bundle headers are always processed first.

Fixes #5075
2018-08-16 12:54:59 +02:00
Bjørn Erik Pedersen 0a88741fe8 hugolib: Fix error when deleting a bundle in server mode
Fixes #5077
2018-08-16 12:54:59 +02:00
Bjørn Erik Pedersen d999b4e82b Revert "releaser: Revert to the old versions of the release pipeline"
This reverts commit 659917a002.
2018-08-15 09:34:36 +02:00
Carlos Alexandro Becker 20148345aa releaser: Fix goreleaser config
* fix: goreleaser nfpm artifact names
* fix: replacements
* fix: make both goreleaser yaml files more similar

Closes #5022
2018-08-15 09:31:56 +02:00
Bjørn Erik Pedersen e5052f4e09 commands: Include theme name in version mismatch error
Fixes #5044
2018-08-14 21:21:39 +02:00
Bjørn Erik Pedersen c81fbf4625 minifiers: Make the JS minifier matcher less specific
Fixes #5073
2018-08-14 19:24:33 +02:00
Bjørn Erik Pedersen a6f199f7a6 hugolib: Use the interface value when doing Related search
Currently it makes no practical difference, but this is more a protection if we in the future creates index from the content related fields. That will not work from a shortcode.

See #5071
2018-08-14 18:19:45 +02:00
Bjørn Erik Pedersen 0dd06bdac0 hugolib: Fix Related when called from shortcode
Fixes #5071
2018-08-14 18:11:36 +02:00
Bjørn Erik Pedersen 5c5384916e tpl/tplimpl: Reimplement the ".Params tolower" template transformer
All `.Params` are stored lowercase, but it should work to access them `.Page.camelCase` etc. There was, however, some holes in the logic with the old transformer.

This commit fixes that by applying a blacklist instead of the old whitelist logic. `.Param` is a very distinct key. The original case will be kept in `.Data.Params.myParam`, but other than that it will be lowercased.

Fixes #5068
2018-08-14 17:54:48 +02:00
Bjørn Erik Pedersen 56c61559b2 Only duplicate resource output in multihost mode
Yesterday's commit was a little too agressive.

This commit makes sure that the duplication of resources to public/en etc. is only performed in multihost mode.

See #5058
2018-08-14 12:04:17 +02:00
Bjørn Erik Pedersen 78f8475a05 Fix Resource output in multihost setups
In Hugo 0.46 we made the output of what you get from resources.Get and similar static, i.e. language agnostic. This makes total sense, as it is wasteful and time-consuming to do SASS/SCSS/PostCSS processing for lots of languages when the output is lots of duplicates with different filenames.

But since we now output the result once only, this had a negative side effect for multihost setups: We publish the resource once only to the root folder (i.e. not to the language "domain folder").

This commit removes the language code from the processed image keys. This creates less duplication in the file cache, but it means that you should do a `hugo --gc` to clean up stale files.

Fixes #5058
2018-08-13 19:00:51 +02:00
Anthony Fok c09ee78fd2 tpl: Suppress blank lines from opengraph internal template 2018-08-12 12:27:38 -06:00
Bjørn Erik Pedersen f6ae436c58 publisher: Close file when done
Fixes #5062
2018-08-11 20:19:07 +02:00
Bjørn Erik Pedersen 2182ecfd34 hugolib: Fix GitInfo when multiple content dirs
Fixes #5054
2018-08-11 19:51:19 +02:00
Bjørn Erik Pedersen e85833d868 hugolib: Add multiple content dirs to GitInfo test site
See #5054
2018-08-11 19:51:19 +02:00
Bjørn Erik Pedersen 43a5aaa778 Fix broken tests 2018-08-09 20:58:31 +02:00
Bjørn Erik Pedersen 1639fd20d8 Merge commit '3a44bf182fed5f34621f450114083a6dd7e88a07' 2018-08-08 13:54:42 +02:00
Bjørn Erik Pedersen 3a44bf182f Squashed 'docs/' changes from 81847981f..d88477eb3
d88477eb3 Fix some more redirect alias loops
209735670 Update features.md
d4ec6ef87 Remove redirect loop from functions/default
ce14da435 Fix the AlternativeOutputFormats/OutputFormats examples
f64a22469 Update cond.md
357a70a32 Remove redirect loop from templates/404
4ad7b01ba Remove some aliases that were causing infinite redirect loops
fd378e66a Fix alias redirect loop
ec3629f6f Revert "Set code background to white"
ffc56b880 Revert "Make inline code gray"
2a964e261 Make inline code gray
44069e09c Set code background to white
d39c790d0 Linked my own blog2md migration script
3e55267be Release 0.46
7b6cfdd8b releaser: Prepare repository for 0.47-DEV
d4cb54806 releaser: Add release notes to /docs for release of 0.46
6518ac7e7 releaser: Bump versions for release of 0.46
e54334d5c Merge commit '766085c2dc6fc95ac30fda2a9ebde2355fc12554'

git-subtree-dir: docs
git-subtree-split: d88477eb3a
2018-08-08 13:54:28 +02:00
Christian Oliff c2a6741394 readme: https links to 3rd party sites 2018-08-08 10:07:31 +02:00
Christian Oliff 06bd013641 Update alias.go
less markup :-)
2018-08-07 09:42:49 +02:00
Bjørn Erik Pedersen 755d1ffe7a tpl/tmplimpl: Add MIME type to embedded JS
So they get minified correctly.

See #5042
2018-08-06 23:11:53 +02:00
Bjørn Erik Pedersen fb3cb05cc3 resource: Remove test debug 2018-08-06 22:51:30 +02:00
Bjørn Erik Pedersen d07882dfb7 Update dependencies 2018-08-06 21:38:58 +02:00
Bjørn Erik Pedersen 7f5356717d Update Chroma
Fixes #5025
2018-08-06 21:21:32 +02:00
Bjørn Erik Pedersen 789ef8c639 Add support for minification of final output
Hugo Pipes added minification support for resources fetched via ´resources.Get` and similar.

This also adds support for minification of the final output for supported output formats: HTML, XML, SVG, CSS, JavaScript, JSON.

To enable, run Hugo with the `--minify` flag:

```bash
hugo --minify
```

This commit is also a major spring cleaning of the `transform` package to allow the new minification step fit into that processing chain.

Fixes #1251
2018-08-06 19:58:41 +02:00
satotake 71931b30b1 Remove alias of os.Stat 2018-08-06 09:54:26 +02:00
satotake d40116e5f9 Renmae FileStat Stat 2018-08-06 09:54:26 +02:00
satotake c362634b7d Fix typo 2018-08-06 09:54:26 +02:00
satotake d71120852a Add fileStat to tpl/os/os 2018-08-06 09:54:26 +02:00
Bjørn Erik Pedersen a6b1eb1e91 transform: Reduce allocation in the benchmark itself 2018-08-05 17:27:16 +02:00
Bjørn Erik Pedersen 27110133ff transform: Simplify the 0 transformer case 2018-08-05 11:24:16 +02:00
hugoreleaser 31faf98ce3 releaser: Prepare repository for 0.47-DEV
[ci skip]
2018-08-01 09:03:22 +00:00
hugoreleaser f14d773841 releaser: Add release notes to /docs for release of 0.46
[ci skip]
2018-08-01 09:00:52 +00:00
hugoreleaser 3aa838cf2b releaser: Bump versions for release of 0.46
[ci skip]
2018-08-01 09:00:52 +00:00
Bjørn Erik Pedersen a3a26597cf Release 0.46 2018-08-01 10:52:45 +02:00
hugoreleaser 92d776b0df releaser: Add release notes draft for 0.46
Rename to *-ready.md to continue. [ci skip]
2018-08-01 08:10:57 +00:00
Bjørn Erik Pedersen e6dd54943f Merge commit '766085c2dc6fc95ac30fda2a9ebde2355fc12554' 2018-08-01 10:01:49 +02:00
Bjørn Erik Pedersen 766085c2dc Squashed 'docs/' changes from a4fa0d1d6..81847981f
81847981f Add notes for installing "extended" Sass/SCSS version
02da3bb58 Include usage of disqus internal template
9b53380c4 Update sitemap-template.md
f3417dd52 Update sitemap-template.md
aae33d9a8 Update sitemap-template.md
834edc205 Release 0.45.1
fb93ab905 Merge branch 'temp451'
79f350906 releaser: Prepare repository for 0.46-DEV
25cd2352c releaser: Add release notes to /docs for release of 0.45.1
e60377c71 releaser: Bump versions for release of 0.45.1
873f6dce2 Update features.md
ecc116642 Update link for Azure
cb88c3185 Added .Site.Home to Site Variiables (#541)
975a88791 Document includePaths
56c4e332f Release Hugo 0.45
c22b25210 Merge branch 'temp45'
0ffad3ada releaser: Prepare repository for 0.46-DEV
08d494cc3 releaser: Add release notes to /docs for release of 0.45
ad546ba45 releaser: Bump versions for release of 0.45
971c46bb2 Fixed "Sratch" to become "Scratch" on line 44
a28255bf3 Clarify the meaning of .Pages vs .Site.Pages
127aeee09 docs: Update ref, relref, GetPage docs
350d674ec resources.Concat doesn't have an alias
1fd1219b0 docs: Document refLinksErrorLevel and refLinksNotFoundURL
af2252ff6 Merge commit 'a3535c8486b2ce762b1a8a9c30b03985c3e02cee'
a11486805 Merge commit 'b6b37a1f00f808f3c0d2715f65ca2d3091f36495'
1c8896cb1 Fix addkit link to account for i18n
468aef3fc releaser: Prepare repository for 0.45-DEV
c6f4b97a2 releaser: Add release notes to /docs for release of 0.44
d3985afb7 releaser: Bump versions for release of 0.44
2c59a330c Adjust release notes
83966769a releaser: Prepare repository for 0.44-DEV
e539613f7 releaser: Add release notes to /docs for release of 0.43
2bf648944 releaser: Bump versions for release of 0.43
d9d6e4bf7 Fix typos
d6798afda Merge commit '98293eaa1570b5aff4452021c8b6d6c8560b3f06'
37cc52261 Add a newScratch template func
1f7f09613 Merge branch 'release-0.42.2'
857b0b26a releaser: Prepare repository for 0.43-DEV

git-subtree-dir: docs
git-subtree-split: 81847981f1
2018-08-01 10:01:05 +02:00
Bjørn Erik Pedersen b5d13ca16b Update Chroma
And since I have updated Dep locally, I get a bunch of other totally unrelated diffs. Which looks innocent enough.

Fixes #5019
2018-08-01 09:34:28 +02:00
Bjørn Erik Pedersen 6b02f5c0f4 Make resources fetched via resources.Get and similar language agnostic
With the newly released Hugo Pipes, resources fetched and processed via `resources.Get` and similar was published to the relevant language sub folder when in multilingual mode.

The thought behind that was maximum flexibility with support for `assetDir` per language.

In practice this was a bad idea:

* You get duplication of identical content, with added processing time
* You end up with path issues that seem to be hard to find a way around (`@fa-font-path` is one example)

This commit changes that. Now there is only one `assetDir` and if you, as one example, need to generate a CSS per langugage, you need to set the paths yourself.

Fixes #5017
2018-07-31 23:33:04 +02:00
Bjørn Erik Pedersen 88e447c449 tocss/scss: Improve _ prefix handling in SCSS imports
See #5008
2018-07-31 16:53:03 +02:00
Rob Jackson b718d743b7 Fix file paths for uncached transformed images
This commit also fixes an existing test to work according to the correct logic. The test was written based on erroneous behavior. We resize the image to 300x200px, and are now trying to fit it within a 50px square. The longest edge is 300 pixels, so we need to divide it by 6 (300 / 50 == 6). And then scale the shortest edge with the same proportion (200 / 6 == 33.33).

The original test was transforming the original source image, hence the previous values:

900 x 562
900 / 50 == 18
562 / 18 == 31.22

Fixes #5012
2018-07-31 13:31:35 +02:00
Bjørn Erik Pedersen 0ba19c57f1 tpl/partials: Add templates.Exists
Fixes #5010
2018-07-31 13:28:15 +02:00
Bjørn Erik Pedersen 0afa2897a0 tpl/partials: Remove superflous loop
No need to check the themes template prefix.
2018-07-31 13:28:15 +02:00
Bjørn Erik Pedersen f219ac09f6 tocss/scss: Improve SCSS project vs themes import resolution
Before this commit, only SASS/SCSS  components imported from main.scss at first level can be overwritten by homonymous files in projects or over-preceding theme components.

This commit fixes that by implementing a custom import resolver which will be tried first. This resolver will make sure that the project/theme hierarchy is always respected.

Fixes #5008
2018-07-31 10:54:10 +02:00
Bjørn Erik Pedersen 786f72302f Fix image cache eviction for sites with subdir in baseURL
Fixes #5006
2018-07-29 14:26:45 +02:00
hugoreleaser 0cae1cf828 releaser: Prepare repository for 0.46-DEV
[ci skip]
2018-07-25 08:58:54 +00:00
hugoreleaser 3b18042ee6 releaser: Add release notes to /docs for release of 0.45.1
[ci skip]
2018-07-25 08:56:21 +00:00
hugoreleaser e38843f4bf releaser: Bump versions for release of 0.45.1
[ci skip]
2018-07-25 08:56:21 +00:00
Bjørn Erik Pedersen 87f0dc14ab Release 0.45.1 2018-07-25 10:51:27 +02:00
hugoreleaser b7d9ab136d releaser: Add release notes draft for 0.45.1
Rename to *-ready.md to continue. [ci skip]
2018-07-25 08:37:50 +00:00
Bjørn Erik Pedersen 04d4c08dbc hugolib: Fix .Site.GetPage regression
In Hugo 0.44 we simplified the `.Site.GetPage` API and added code to handle the old-style syntax in most cases.

This logic did not handle the lookup of the home page via `.Site.GetPage "section" ""` and similar. This commit fixes that.

Fixes #4989
2018-07-24 11:37:59 +02:00
Bjørn Erik Pedersen 016dd4a69a Add Page.FirstSection
It was added and then removed by accident some time ago. Let us add it again, as it is useful.
2018-07-23 20:20:19 +02:00
Bjørn Erik Pedersen c6b599a06d hugolib: Fix "borrow content from another language" issue
If a content file contains shortcode(s), we have logic in place to re-render it per output format.

We also have logic in place that avoids making a copy of the content used for this process if we don't need it.

This was before this commit limited to server mode and if the page should be output to multiple formats.

But there is a third case: If a site (language) borrows and renders `.Content` from another language. This would, before this commit, behave oddly for content with shortcodes.

Fixes #4986
2018-07-23 20:12:41 +02:00
hugoreleaser 3a6784b162 releaser: Prepare repository for 0.46-DEV
[ci skip]
2018-07-22 12:12:08 +00:00
2135 changed files with 160933 additions and 66417 deletions
+9 -7
View File
@@ -1,8 +1,9 @@
defaults: &defaults
working_directory: /go/src/github.com/gohugoio
docker:
- image: bepsays/ci-goreleaser:0.34.2-11
- image: bepsays/ci-goreleaser:1.17.2
environment:
CGO_ENABLED: "0"
version: 2
jobs:
build:
@@ -12,11 +13,12 @@ jobs:
path: hugo
- run:
command: |
go get -d github.com/magefile/mage/...
git clone git@github.com:gohugoio/hugoDocs.git
cd hugo
mage vendor
mage check
go mod download
sleep 5
go mod verify
go test -p 1 ./...
- persist_to_workspace:
root: .
paths: .
@@ -24,7 +26,7 @@ jobs:
<<: *defaults
steps:
- attach_workspace:
at: /go/src/github.com/gohugoio
at: /root/project
- run:
command: |
cd hugo
+1
View File
@@ -6,3 +6,4 @@
.circleci
docs
examples
Dockerfile
+18
View File
@@ -0,0 +1,18 @@
---
name: 'Bug report'
labels: 'bug'
assignees: ''
about: Create a report to help us improve
---
<!-- Please answer these questions before submitting your issue. Thanks! -->
### What version of Hugo are you using (`hugo version`)?
<pre>
$ hugo version
</pre>
### Does this issue reproduce with the latest release?
+5
View File
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: SUPPORT, ISSUES and TROUBLESHOOTING
url: https://discourse.gohugo.io/
about: Please DO NOT use Github for support requests. Please visit https://discourse.gohugo.io for support! You will be helped much faster there. If you ignore this request your issue might be closed with a discourse label.
@@ -0,0 +1,8 @@
---
name: Proposal
about: Suggest an idea for Hugo
title: ''
labels: 'Proposal'
assignees: ''
---
+7
View File
@@ -0,0 +1,7 @@
# See https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
+82
View File
@@ -0,0 +1,82 @@
on: [push, pull_request]
name: Test
jobs:
test:
env:
GOPROXY: https://proxy.golang.org
GO111MODULE: on
strategy:
matrix:
go-version: [1.16.x, 1.17.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@37335c7bb261b353407cff977110895fa0b4f7d8
with:
go-version: ${{ matrix.go-version }}
- name: Install Ruby
uses: actions/setup-ruby@5f29a1cd8dfebf420691c4c9a0e832e2fae5a526
with:
ruby-version: '2.7'
- name: Install Python
uses: actions/setup-python@3105fb18c05ddd93efea5f9e0bef7a03a6e9e7df
with:
python-version: '3.x'
- name: Install Mage
run: go get github.com/magefile/mage@07afc7d24f4d6d6442305d49552f04fbda5ccb3e
- name: Install asciidoctor
uses: reitzig/actions-asciidoctor@7570212ae20b63653481675fb1ff62d1073632b0
- name: Checkout code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Install docutils
run: |
pip install docutils
rst2html.py --version
- if: matrix.os == 'ubuntu-latest'
name: Install pandoc on Linux
run: |
sudo apt-get update -y
sudo apt-get install -y pandoc
- if: matrix.os == 'macos-latest'
run: |
brew install pandoc
- if: matrix.os == 'windows-latest'
run: |
choco install pandoc
- run: pandoc -v
- if: matrix.os == 'ubuntu-latest'
name: Install dart-sass-embedded Linux
run: |
curl -LJO https://github.com/sass/dart-sass-embedded/releases/download/1.0.0-beta.6/sass_embedded-1.0.0-beta.6-linux-x64.tar.gz;
echo "04fc1e5e28d29a4585a701941b6dace56771d94bfbe7f9e4db28d24417ceeec3 sass_embedded-1.0.0-beta.6-linux-x64.tar.gz" | sha256sum -c;
tar -xvf sass_embedded-1.0.0-beta.6-linux-x64.tar.gz;
echo "$GITHUB_WORKSPACE/sass_embedded/" >> $GITHUB_PATH
- if: matrix.os == 'macos-latest'
name: Install dart-sass-embedded MacOS
run: |
curl -LJO https://github.com/sass/dart-sass-embedded/releases/download/1.0.0-beta.6/sass_embedded-1.0.0-beta.6-macos-x64.tar.gz;
echo "b3b984675a9b04aa22f6f2302dda4191b507ac2ca124467db2dfe7e58e72fbad sass_embedded-1.0.0-beta.6-macos-x64.tar.gz" | shasum -a 256 -c;
tar -xvf sass_embedded-1.0.0-beta.6-macos-x64.tar.gz;
echo "$GITHUB_WORKSPACE/sass_embedded/" >> $GITHUB_PATH
- if: matrix.os == 'windows-latest'
name: Install dart-sass-embedded Windows
run: |
curl -LJO https://github.com/sass/dart-sass-embedded/releases/download/1.0.0-beta.6/sass_embedded-1.0.0-beta.6-windows-x64.zip;
echo "6ae442129dbb3334bc21ef851261da6c0c1b560da790ca2e1350871d00ab816d sass_embedded-1.0.0-beta.6-windows-x64.zip" | sha256sum -c;
unzip sass_embedded-1.0.0-beta.6-windows-x64.zip;
echo "$env:GITHUB_WORKSPACE/sass_embedded/" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf-8 -Append
- name: Test
run: |
mage -v test
mage -v check;
- name: Build Docs
env:
HUGO_BUILD_TAGS: extended
HUGO_TIMEOUT: 31000
HUGO_IGNOREERRORS: error-remote-getjson
HUGO_SERVICES_INSTAGRAM_ACCESSTOKEN: dummytoken
run: |
mage -v hugo
./hugo -s docs/
./hugo --renderToMemory -s docs/
+8 -1
View File
@@ -1,6 +1,7 @@
hugo
/hugo
docs/public*
/.idea
.vscode/*
hugo.exe
*.test
*.prof
@@ -19,3 +20,9 @@ dock.sh
GoBuilds
dist
hugolib/hugo_stats.json
resources/sunset.jpg
vendor
-30
View File
@@ -1,30 +0,0 @@
language: go
sudo: false
dist: trusty
env:
HUGO_BUILD_TAGS="extended"
git:
depth: false
go:
- 1.9.7
- "1.10.3"
- tip
os:
- linux
- osx
matrix:
allow_failures:
- go: tip
fast_finish: true
install:
- go get github.com/magefile/mage
- mage -v vendor
script:
- mage -v test
- mage -v check
- mage -v hugo
- ./hugo -s docs/
- ./hugo --renderToMemory -s docs/
before_install:
- gem install asciidoctor
- type asciidoctor
+29 -43
View File
@@ -18,11 +18,8 @@ The Hugo community and maintainers are [very active](https://github.com/gohugoio
* [Submitting Patches](#submitting-patches)
* [Code Contribution Guidelines](#code-contribution-guidelines)
* [Git Commit Message Guidelines](#git-commit-message-guidelines)
* [Vendored Dependencies](#vendored-dependencies)
* [Fetching the Sources From GitHub](#fetching-the-sources-from-github)
* [Using Git Remotes](#using-git-remotes)
* [Build Hugo with Your Changes](#build-hugo-with-your-changes)
* [Updating the Hugo Sources](#updating-the-hugo-sources)
* [Building Hugo with Your Changes](#building-hugo-with-your-changes)
## Asking Support Questions
@@ -32,12 +29,16 @@ Please don't use the GitHub issue tracker to ask questions.
## Reporting Issues
If you believe you have found a defect in Hugo or its documentation, use
the GitHub [issue tracker](https://github.com/gohugoio/hugo/issues) to report
the GitHub issue tracker to report
the problem to the Hugo maintainers. If you're not sure if it's a bug or not,
start by asking in the [discussion forum](https://discourse.gohugo.io).
When reporting the issue, please provide the version of Hugo in use (`hugo
version`) and your operating system.
- [Hugo Issues · gohugoio/hugo](https://github.com/gohugoio/hugo/issues)
- [Hugo Documentation Issues · gohugoio/hugoDocs](https://github.com/gohugoio/hugoDocs/issues)
- [Hugo Website Theme Issues · gohugoio/hugoThemesSite](https://github.com/gohugoio/hugoThemesSite/issues)
## Code Contribution
Hugo has become a fully featured static site generator, so any new functionality must:
@@ -47,15 +48,17 @@ Hugo has become a fully featured static site generator, so any new functionality
* strive not to break existing sites.
* close or update an open [Hugo issue](https://github.com/gohugoio/hugo/issues)
If it is of some complexity, the contributor is expected to maintain and support the new future (answer questions on the forum, fix any bugs etc.).
If it is of some complexity, the contributor is expected to maintain and support the new feature in the future (answer questions on the forum, fix any bugs etc.).
It is recommended to open up a discussion on the [Hugo Forum](https://discourse.gohugo.io/) to get feedback on your idea before you begin. If you are submitting a complex feature, create a small design proposal on the [Hugo issue tracker](https://github.com/gohugoio/hugo/issues) before you start.
It is recommended to open up a discussion on the [Hugo Forum](https://discourse.gohugo.io/) to get feedback on your idea before you begin.
Any non-trivial code change needs to update an open [issue](https://github.com/gohugoio/hugo/issues). A non-trivial code change without an issue reference with one of the labels `bug` or `enhancement` will not be merged.
Note that we do not accept new features that require [CGO](https://github.com/golang/go/wiki/cgo).
We have one exception to this rule which is LibSASS.
**Bug fixes are, of course, always welcome.**
## Submitting Patches
The Hugo project welcomes all contributors and contributions regardless of skill or experience level. If you are interested in helping with the project, we will help you with your contribution.
@@ -73,7 +76,7 @@ To make the contribution process as seamless as possible, we ask for the followi
* Run `go fmt`.
* Add documentation if you are adding new features or changing functionality. The docs site lives in `/docs`.
* Squash your commits into a single commit. `git rebase -i`. Its okay to force update your pull request with `git push -f`.
* Ensure that `mage check` succeeds. [Travis CI](https://travis-ci.org/gohugoio/hugo) (Linux and macOS) and [AppVeyor](https://ci.appveyor.com/project/gohugoio/hugo/branch/master) (Windows) will fail the build if `mage check` fails.
* Ensure that `mage check` succeeds. [Travis CI](https://travis-ci.org/gohugoio/hugo) (Windows, Linux and macOS) will fail the build if `mage check` fails.
* Follow the **Git Commit Message Guidelines** below.
### Git Commit Message Guidelines
@@ -106,30 +109,25 @@ Fixes #1949
### Fetching the Sources From GitHub
Due to the way Go handles package imports, the best approach for working on a
Hugo fork is to use Git Remotes. Here's a simple walk-through for getting
started:
Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build. The easiest is to clone Hugo in a directory outside of `GOPATH`, as in the following example:
1. Get the Hugo source:
```bash
mkdir $HOME/src
cd $HOME/src
git clone https://github.com/gohugoio/hugo.git
cd hugo
go install
```
```bash
go get -u -v -d github.com/gohugoio/hugo
```
>Note: Some Go tools may not be fully updated to support Go Modules yet. One example would be LiteIDE. Follow [this workaround](https://github.com/visualfc/liteide/issues/986#issuecomment-428117702) for how to continue to work with Hugo below `GOPATH`.
1. Install Mage:
For some convenient build and test targets, you also will want to install Mage:
```bash
go get github.com/magefile/mage
```
```bash
go get github.com/magefile/mage
```
1. Change to the Hugo source directory and fetch the dependencies:
```bash
cd $HOME/go/src/github.com/gohugoio/hugo
mage vendor
```
Note that Hugo uses [Go Dep](https://github.com/golang/dep) to vendor dependencies, rather than a simple `go get`. We don't commit the vendored packages themselves to the Hugo git repository. The call to `mage vendor` takes care of all this for you.
Now, to make a change to Hugo's source:
1. Create a new branch for your changes (the branch name is arbitrary):
@@ -148,7 +146,7 @@ started:
1. Add your fork as a new remote (the remote name, "fork" in this example, is arbitrary):
```bash
git remote add fork git://github.com/USERNAME/hugo.git
git remote add fork git@github.com:USERNAME/hugo.git
```
1. Push the changes to your new remote:
@@ -167,7 +165,7 @@ Hugo uses [mage](https://github.com/magefile/mage) to sync vendor dependencies,
cd $HOME/go/src/github.com/gohugoio/hugo
```
To build Hugo:
To build Hugo:
```bash
mage hugo
@@ -197,15 +195,3 @@ mage -l
```bash
HUGO_BUILD_TAGS=extended mage install
````
### Updating the Hugo Sources
If you want to stay in sync with the Hugo repository, you can easily pull down
the source changes, but you'll need to keep the vendored packages up-to-date as
well.
```bash
git pull
mage vendor
```
+32 -14
View File
@@ -2,26 +2,44 @@
# Twitter: https://twitter.com/gohugoio
# Website: https://gohugo.io/
FROM golang:1.10.3-alpine3.7 AS build
FROM golang:1.16-alpine AS build
ENV CGO_ENABLED=0
# Optionally set HUGO_BUILD_TAGS to "extended" or "nodeploy" when building like so:
# docker build --build-arg HUGO_BUILD_TAGS=extended .
ARG HUGO_BUILD_TAGS
ARG CGO=1
ENV CGO_ENABLED=${CGO}
ENV GOOS=linux
ENV GO111MODULE=on
WORKDIR /go/src/github.com/gohugoio/hugo
RUN apk add --no-cache \
git \
musl-dev && \
go get github.com/golang/dep/cmd/dep
COPY . /go/src/github.com/gohugoio/hugo/
RUN dep ensure -vendor-only && \
go install -ldflags '-s -w'
# gcc/g++ are required to build SASS libraries for extended version
RUN apk update && \
apk add --no-cache gcc g++ musl-dev && \
go get github.com/magefile/mage
RUN mage hugo && mage install
# ---
FROM scratch
COPY --from=build /go/bin/hugo /hugo
FROM alpine:3.12
COPY --from=build /go/bin/hugo /usr/bin/hugo
# libc6-compat & libstdc++ are required for extended SASS libraries
# ca-certificates are required to fetch outside resources (like Twitter oEmbeds)
RUN apk update && \
apk add --no-cache ca-certificates libc6-compat libstdc++ git
VOLUME /site
WORKDIR /site
VOLUME /site
EXPOSE 1313
ENTRYPOINT [ "/hugo" ]
CMD [ "--help" ]
# Expose port for live server
EXPOSE 1313
ENTRYPOINT ["hugo"]
CMD ["--help"]
Generated
-714
View File
@@ -1,714 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
branch = "master"
digest = "1:f6a10073544cc0bd1eb9fd9f8d9bf4644971910a0f8393d51b5b4d286e554849"
name = "github.com/BurntSushi/locker"
packages = ["."]
pruneopts = ""
revision = "a6e239ea1c69bff1cfdb20c4b73dadf52f784b6a"
[[projects]]
branch = "master"
digest = "1:af3600b068c8dd0e004122f154de7ece06b0b13376f79e976701aab4834c860a"
name = "github.com/BurntSushi/toml"
packages = ["."]
pruneopts = ""
revision = "a368813c5e648fee92e5f6c30e3944ff9d5e8895"
[[projects]]
digest = "1:1080c443bebc98b1c25665b46b321dc02f8a4d384fe544379dcba1e651f59321"
name = "github.com/PuerkitoBio/purell"
packages = ["."]
pruneopts = ""
revision = "0bcb03f4b4d0a9428594752bd2a3b9aa0a9d4bd4"
version = "v1.1.0"
[[projects]]
branch = "master"
digest = "1:331a419049c2be691e5ba1d24342fc77c7e767a80c666a18fd8a9f7b82419c1c"
name = "github.com/PuerkitoBio/urlesc"
packages = ["."]
pruneopts = ""
revision = "de5bf2ad457846296e2031421a34e2568e304e35"
[[projects]]
branch = "master"
digest = "1:60d5ffa86fb76749180841154b3714cde4771723b7e52329fb97ec916a6a68a6"
name = "github.com/alecthomas/assert"
packages = ["."]
pruneopts = ""
revision = "405dbfeb8e38effee6e723317226e93fff912d06"
[[projects]]
digest = "1:2d78d7ffff1988e613e4946d6a6914190db0b38d533e392208797d2f557c92b6"
name = "github.com/alecthomas/chroma"
packages = [
".",
"formatters",
"formatters/html",
"lexers",
"lexers/a",
"lexers/b",
"lexers/c",
"lexers/circular",
"lexers/d",
"lexers/e",
"lexers/f",
"lexers/g",
"lexers/h",
"lexers/i",
"lexers/internal",
"lexers/j",
"lexers/k",
"lexers/l",
"lexers/m",
"lexers/n",
"lexers/o",
"lexers/p",
"lexers/q",
"lexers/r",
"lexers/s",
"lexers/t",
"lexers/v",
"lexers/w",
"lexers/x",
"lexers/y",
"styles",
]
pruneopts = ""
revision = "1b755a90bd109f170385cb3964f0abdfd3451145"
[[projects]]
branch = "master"
digest = "1:ba0a389824c3c3d378f5f334370524b7d04b5a5ccedce7dd2da05ae8d3868609"
name = "github.com/alecthomas/colour"
packages = ["."]
pruneopts = ""
revision = "60882d9e27213e8552dcff6328914fe4c2b44bc9"
[[projects]]
branch = "master"
digest = "1:5723237c9114bb92b4571532d9580dd0ed885ec3eb371d58085c074895c04a51"
name = "github.com/alecthomas/repr"
packages = ["."]
pruneopts = ""
revision = "f49988b46e025398b9f834f7c726afe001ec481f"
[[projects]]
digest = "1:05d0e4ae6b8d0273647964fe26762e3345d5d196aaeb858838e75336703451ba"
name = "github.com/bep/debounce"
packages = ["."]
pruneopts = ""
revision = "844797fa1dd9ba969d71b62797ff19d1e49d4eac"
version = "v1.1.0"
[[projects]]
branch = "master"
digest = "1:88b2a2ccfbcf8aa697ec140e196c524f40bbdc8e6f6d03ff79354bc694cb677d"
name = "github.com/bep/gitmap"
packages = ["."]
pruneopts = ""
revision = "012701e8669671499fc43e9792335a1dcbfe2afb"
[[projects]]
branch = "master"
digest = "1:7337271448975bc9cf3deae77bb2d7f7fc937c60c59b606ffcd25bfc754dd2ec"
name = "github.com/bep/go-tocss"
packages = [
"scss",
"scss/libsass",
"tocss",
]
pruneopts = ""
revision = "2abb118dc8688b6c7df44e12f4152c2bded9b19c"
[[projects]]
digest = "1:e5ad472b763adca2591568384b8f07974d2da4a98b55ffb360e2cecc2a216bae"
name = "github.com/chaseadamsio/goorgeous"
packages = ["."]
pruneopts = ""
revision = "dcf1ef873b8987bf12596fe6951c48347986eb2f"
version = "v1.1.0"
[[projects]]
digest = "1:f30036d9c6eb2b9262edac69b5f6b59e25b25310ffee3035ab0e7c4b722a8552"
name = "github.com/cpuguy83/go-md2man"
packages = ["md2man"]
pruneopts = ""
revision = "a65d4d2de4d5f7c74868dfa9b202a3c8be315aaa"
version = "v1.0.6"
[[projects]]
branch = "master"
digest = "1:8f6c36ee73ded871996ada894e20dfecde56557d08b4d1849d5489076679971f"
name = "github.com/danwakefield/fnmatch"
packages = ["."]
pruneopts = ""
revision = "cbb64ac3d964b81592e64f957ad53df015803288"
[[projects]]
digest = "1:0a39ec8bf5629610a4bc7873a92039ee509246da3cef1a0ea60f1ed7e5f9cea5"
name = "github.com/davecgh/go-spew"
packages = ["spew"]
pruneopts = ""
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
version = "v1.1.0"
[[projects]]
digest = "1:8dc164acd41f84c9f704362d061f90cf45014c3b7eb3fead126efb7d152e2efc"
name = "github.com/disintegration/imaging"
packages = ["."]
pruneopts = ""
revision = "dd50a3ee9985ccd313a2f03c398fcaedc96dc707"
version = "v1.2.4"
[[projects]]
digest = "1:536d2bdf1cdef7ec49e1cb4a8a083ae639159f0fd11a5829fe4d35ecb8cc3a1a"
name = "github.com/dlclark/regexp2"
packages = [
".",
"syntax",
]
pruneopts = ""
revision = "487489b64fb796de2e55f4e8a4ad1e145f80e957"
version = "v1.1.6"
[[projects]]
branch = "master"
digest = "1:fbbae68d476d61afb78178dd4c5532dbfff154e2fea72d1312138bf35c613ec1"
name = "github.com/eknkc/amber"
packages = [
".",
"parser",
]
pruneopts = ""
revision = "cdade1c073850f4ffc70a829e31235ea6892853b"
[[projects]]
digest = "1:e5c807ac3b60699ccec9263f6eec756251b17e78582eb149f90ac345d9e58327"
name = "github.com/fortytw2/leaktest"
packages = ["."]
pruneopts = ""
revision = "a5ef70473c97b71626b9abeda80ee92ba2a7de9e"
version = "v1.2.0"
[[projects]]
digest = "1:b2106f1668ea5efc1ecc480f7e922a093adb9563fd9ce58585292871f0d0f229"
name = "github.com/fsnotify/fsnotify"
packages = ["."]
pruneopts = ""
revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
version = "v1.4.7"
[[projects]]
digest = "1:b7a7e17513aeee6492d93015c7bf29c86a0c1c91210ea56b21e36c1a40958cba"
name = "github.com/gobwas/glob"
packages = [
".",
"compiler",
"match",
"syntax",
"syntax/ast",
"syntax/lexer",
"util/runes",
"util/strings",
]
pruneopts = ""
revision = "5ccd90ef52e1e632236f7326478d4faa74f99438"
version = "v0.2.3"
[[projects]]
digest = "1:fe1b4d4cbe48c0d55507c55f8663aa4185576cc58fa0c8be03bb8f19dfe17a9c"
name = "github.com/gorilla/websocket"
packages = ["."]
pruneopts = ""
revision = "ea4d1f681babbce9545c9c5f3d5194a789c89f5b"
version = "v1.2.0"
[[projects]]
branch = "master"
digest = "1:4423ee95d6ee30bb22f680445c58889bb5b91e1b955405bf34374a053784a8a2"
name = "github.com/hashicorp/go-immutable-radix"
packages = ["."]
pruneopts = ""
revision = "7f3cd4390caab3250a57f30efdb2a65dd7649ecf"
[[projects]]
branch = "master"
digest = "1:9c776d7d9c54b7ed89f119e449983c3f24c0023e75001d6092442412ebca6b94"
name = "github.com/hashicorp/golang-lru"
packages = ["simplelru"]
pruneopts = ""
revision = "0fb14efe8c47ae851c0034ed7a448854d3d34cf3"
[[projects]]
branch = "master"
digest = "1:ccfc44438ba7fc24effffbe9c7b75bbbb51e7a275e361e62a4dbffbc9e8e43d9"
name = "github.com/hashicorp/hcl"
packages = [
".",
"hcl/ast",
"hcl/parser",
"hcl/printer",
"hcl/scanner",
"hcl/strconv",
"hcl/token",
"json/parser",
"json/scanner",
"json/token",
]
pruneopts = ""
revision = "ef8a98b0bbce4a65b5aa4c368430a80ddc533168"
[[projects]]
digest = "1:870d441fe217b8e689d7949fef6e43efbc787e50f200cb1e70dbca9204a1d6be"
name = "github.com/inconshreveable/mousetrap"
packages = ["."]
pruneopts = ""
revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
version = "v1.0"
[[projects]]
digest = "1:3b82a4308adc7319d0c7efbad106e966cbbf70e47f16fb5f7aca131b01f6f9b1"
name = "github.com/jdkato/prose"
packages = [
"internal/util",
"transform",
]
pruneopts = ""
revision = "20d3663d4bc9dd10d75abcde9d92e04b4861c674"
version = "v1.1.0"
[[projects]]
digest = "1:f72872791669f287262777a6a635c7aaebbdd9919cffacea802f8f9c1dc2e6f6"
name = "github.com/kyokomi/emoji"
packages = ["."]
pruneopts = ""
revision = "7e06b236c489543f53868841f188a294e3383eab"
version = "v1.5"
[[projects]]
digest = "1:3ee69edc976a8e66debd179073163cbbef426faa7c0ef2d8ff8e3be159699d2e"
name = "github.com/magefile/mage"
packages = [
"mg",
"sh",
]
pruneopts = ""
revision = "2f974307b636f59c13b88704cf350a4772fef271"
version = "v1.0.2"
[[projects]]
digest = "1:093cd7ebfdecf5692c66f0b0f7a1877d796c89d9940f5769439c53dc65264036"
name = "github.com/magiconair/properties"
packages = ["."]
pruneopts = ""
revision = "c3beff4c2358b44d0493c7dda585e7db7ff28ae6"
version = "v1.7.6"
[[projects]]
digest = "1:fd46423a2fe75d52968baf37471b99e6f05cea3ac29c756128ead26af34e1c35"
name = "github.com/markbates/inflect"
packages = ["."]
pruneopts = ""
revision = "a12c3aec81a6a938bf584a4bac567afed9256586"
[[projects]]
digest = "1:78229b46ddb7434f881390029bd1af7661294af31f6802e0e1bedaad4ab0af3c"
name = "github.com/mattn/go-isatty"
packages = ["."]
pruneopts = ""
revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
version = "v0.0.3"
[[projects]]
digest = "1:81e673df85e765593a863f67cba4544cf40e8919590f04d67664940786c2b61a"
name = "github.com/mattn/go-runewidth"
packages = ["."]
pruneopts = ""
revision = "9e777a8366cce605130a531d2cd6363d07ad7317"
version = "v0.0.2"
[[projects]]
digest = "1:6066f4c384723dd468c96adc13bfe4d977f182c2305e1a82c94bb50e1507d528"
name = "github.com/miekg/mmark"
packages = ["."]
pruneopts = ""
revision = "fd2f6c1403b37925bd7fe13af05853b8ae58ee5f"
version = "v1.3.6"
[[projects]]
branch = "master"
digest = "1:0de0f377aeccd41384e883c59c6f184c9db01c96db33a2724a1eaadd60f92629"
name = "github.com/mitchellh/hashstructure"
packages = ["."]
pruneopts = ""
revision = "2bca23e0e452137f789efbc8610126fd8b94f73b"
[[projects]]
branch = "master"
digest = "1:59fa50d593e5673a0dfffa1852b66fd700c05b35e368680b4b89a68fdb2c1379"
name = "github.com/mitchellh/mapstructure"
packages = ["."]
pruneopts = ""
revision = "00c29f56e2386353d58c599509e8dc3801b0d716"
[[projects]]
branch = "master"
digest = "1:08b8db6381176e5472815f67f29b2b8b21d5bf3adaba4de3e5416faaf26f3689"
name = "github.com/muesli/smartcrop"
packages = [
".",
"options",
]
pruneopts = ""
revision = "f6ebaa786a12a0fdb2d7c6dee72808e68c296464"
[[projects]]
digest = "1:34afc91b88b56c71639e275ff3ea8179a8f094ddc86df96e26074000cade42fe"
name = "github.com/nicksnyder/go-i18n"
packages = [
"i18n/bundle",
"i18n/language",
"i18n/translation",
]
pruneopts = ""
revision = "0dc1626d56435e9d605a29875701721c54bc9bbd"
version = "v1.10.0"
[[projects]]
branch = "master"
digest = "1:2656200f82783893859c77903afc794d97c1f5054e2b57f7021e33a6047e7b1e"
name = "github.com/olekukonko/tablewriter"
packages = ["."]
pruneopts = ""
revision = "b8a9be070da40449e501c3c4730a889e42d87a9e"
[[projects]]
digest = "1:fef37519c971ab3c464318a0c9da6a7fb9c21439aa587e61bf10af651e6119b9"
name = "github.com/pelletier/go-toml"
packages = ["."]
pruneopts = ""
revision = "acdc4509485b587f5e675510c4f2c63e90ff68a8"
version = "v1.1.0"
[[projects]]
digest = "1:256484dbbcd271f9ecebc6795b2df8cad4c458dd0f5fd82a8c2fa0c29f233411"
name = "github.com/pmezard/go-difflib"
packages = ["difflib"]
pruneopts = ""
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
version = "v1.0.0"
[[projects]]
branch = "master"
digest = "1:10bc894f31df5ca3366a50122ee2ade6b56f3f5531c523a8a551748a0663aa1b"
name = "github.com/russross/blackfriday"
packages = ["."]
pruneopts = ""
revision = "11635eb403ff09dbc3a6b5a007ab5ab09151c229"
[[projects]]
digest = "1:afa9b7bb3d9e633ef32e46ab4b6a87b5376271e3d86b09a379029bbb10e26fa0"
name = "github.com/sanity-io/litter"
packages = ["."]
pruneopts = ""
revision = "ae543b7ba8fd6af63e4976198f146e1348ae53c1"
version = "v1.1.0"
[[projects]]
digest = "1:1ebe873a8dc99e3316c30fea2e211038c4d1fcb605eee17e00a5e91b8817925e"
name = "github.com/sergi/go-diff"
packages = ["diffmatchpatch"]
pruneopts = ""
revision = "1744e2970ca51c86172c8190fadad617561ed6e7"
version = "v1.0.0"
[[projects]]
branch = "master"
digest = "1:606fa779c7a80ab6a9ec5836cd12759f86cd6e1d82d5d60cf7ec5133e78c6cf8"
name = "github.com/shurcooL/sanitized_anchor_name"
packages = ["."]
pruneopts = ""
revision = "86672fcb3f950f35f2e675df2240550f2a50762f"
[[projects]]
digest = "1:3d6c88f060fdaac3291f3d18f58eb542fe3a2b330609b269962d26d0c99104be"
name = "github.com/spf13/afero"
packages = [
".",
"mem",
]
pruneopts = ""
revision = "787d034dfe70e44075ccc060d346146ef53270ad"
version = "v1.1.1"
[[projects]]
digest = "1:d0b38ba6da419a6d4380700218eeec8623841d44a856bb57369c172fbf692ab4"
name = "github.com/spf13/cast"
packages = ["."]
pruneopts = ""
revision = "8965335b8c7107321228e3e3702cab9832751bac"
version = "v1.2.0"
[[projects]]
digest = "1:9e14345bfb9aa30952b41ffceaa2acd559933cfe3d17bd87b7f6e54b6c618492"
name = "github.com/spf13/cobra"
packages = [
".",
"doc",
]
pruneopts = ""
revision = "a1f051bc3eba734da4772d60e2d677f47cf93ef4"
version = "v0.0.2"
[[projects]]
branch = "master"
digest = "1:7c00f445c89f468abd5ab86546ba1fa11bac66e63325ade8ca05aa7220791fc7"
name = "github.com/spf13/fsync"
packages = ["."]
pruneopts = ""
revision = "12a01e648f05a938100a26858d2d59a120307a18"
[[projects]]
branch = "master"
digest = "1:104517520aab91164020ab6524a5d6b7cafc641b2e42ac6236f6ac1deac4f66a"
name = "github.com/spf13/jwalterweatherman"
packages = ["."]
pruneopts = ""
revision = "7c0cea34c8ece3fbeb2b27ab9b59511d360fb394"
[[projects]]
branch = "master"
digest = "1:5082c0d57a199dabc0868010784039249af0932fad2990b51ad9404c9a6b6e5d"
name = "github.com/spf13/nitro"
packages = ["."]
pruneopts = ""
revision = "24d7ef30a12da0bdc5e2eb370a79c659ddccf0e8"
[[projects]]
digest = "1:261bc565833ef4f02121450d74eb88d5ae4bd74bfe5d0e862cddb8550ec35000"
name = "github.com/spf13/pflag"
packages = ["."]
pruneopts = ""
revision = "e57e3eeb33f795204c1ca35f56c44f83227c6e66"
version = "v1.0.0"
[[projects]]
digest = "1:79af66c513727a0ed32fb4137ad7d0613b01e8e2f5ce9479724e26e2c9068011"
name = "github.com/spf13/viper"
packages = ["."]
pruneopts = ""
revision = "b5e8006cbee93ec955a89ab31e0e3ce3204f3736"
version = "v1.0.2"
[[projects]]
digest = "1:a70d585d45f695f2e8e6782569bdf181419667a35e6035ceb086706b495aa21a"
name = "github.com/stretchr/testify"
packages = [
"assert",
"require",
]
pruneopts = ""
revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71"
version = "v1.2.1"
[[projects]]
digest = "1:54b1c3f97e0d74b571055cc17af4a978b6160e6ccfda73608aba048e404319c1"
name = "github.com/tdewolff/minify"
packages = [
".",
"css",
"html",
"js",
"json",
"svg",
"xml",
]
pruneopts = ""
revision = "8d72a4127ae33b755e95bffede9b92e396267ce2"
version = "v2.3.5"
[[projects]]
digest = "1:33d327ae34260328b00ed15f89961446d805797a96de8643a983020825bb51ae"
name = "github.com/tdewolff/parse"
packages = [
".",
"buffer",
"css",
"html",
"js",
"json",
"strconv",
"svg",
"xml",
]
pruneopts = ""
revision = "d739d6fccb0971177e06352fea02d3552625efb1"
version = "v2.3.3"
[[projects]]
branch = "master"
digest = "1:12e69a2969bdcdf2928607e51966a868482c2a450f1c97c5dde004257c8369ff"
name = "github.com/wellington/go-libsass"
packages = ["libs"]
pruneopts = ""
revision = "615eaa47ef794d037c1906a0eb7bf85375a5decf"
[[projects]]
digest = "1:b1e5dc66cd8ad9712eb8fd4dfaecac6ae45cbcde94476c5b64d905c5d789eef7"
name = "github.com/yosssi/ace"
packages = ["."]
pruneopts = ""
revision = "ea038f4770b6746c3f8f84f14fa60d9fe1205b56"
version = "v0.0.5"
[[projects]]
branch = "master"
digest = "1:4525c51a65e4974007814da8e2621343840d769d80b2b2ab79e6958342726587"
name = "golang.org/x/image"
packages = [
"bmp",
"draw",
"math/f64",
"riff",
"tiff",
"tiff/lzw",
"vp8",
"vp8l",
"webp",
]
pruneopts = ""
revision = "f315e440302883054d0c2bd85486878cb4f8572c"
[[projects]]
branch = "master"
digest = "1:8bb19e8d6e1321626d3f58ffee75699e86940c79d959b30fcf632883d7c4d303"
name = "golang.org/x/net"
packages = [
"context",
"idna",
]
pruneopts = ""
revision = "61147c48b25b599e5b561d2e9c4f3e1ef489ca41"
[[projects]]
branch = "master"
digest = "1:d84d0f563cc649de4c9a8272a0395f75b11952202d18d4d927e933cc91493062"
name = "golang.org/x/sync"
packages = ["errgroup"]
pruneopts = ""
revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
[[projects]]
branch = "master"
digest = "1:137a530894d869c2fb09e135e6bb7a5d701347ba273471eaa2483053f8fbeb35"
name = "golang.org/x/sys"
packages = ["unix"]
pruneopts = ""
revision = "3b87a42e500a6dc65dae1a55d0b641295971163e"
[[projects]]
branch = "master"
digest = "1:4cf01dae652ef4428cf9d354bdec79467e436ecfa92d943b1ada8184e1a938b6"
name = "golang.org/x/text"
packages = [
"collate",
"collate/build",
"internal/colltab",
"internal/gen",
"internal/language",
"internal/language/compact",
"internal/tag",
"internal/triegen",
"internal/ucd",
"language",
"secure/bidirule",
"transform",
"unicode/bidi",
"unicode/cldr",
"unicode/norm",
"unicode/rangetable",
"width",
]
pruneopts = ""
revision = "2cb43934f0eece38629746959acc633cba083fe4"
[[projects]]
branch = "v2"
digest = "1:f0620375dd1f6251d9973b5f2596228cc8042e887cd7f827e4220bc1ce8c30e2"
name = "gopkg.in/yaml.v2"
packages = ["."]
pruneopts = ""
revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
input-imports = [
"github.com/BurntSushi/locker",
"github.com/BurntSushi/toml",
"github.com/PuerkitoBio/purell",
"github.com/alecthomas/assert",
"github.com/alecthomas/chroma",
"github.com/alecthomas/chroma/formatters",
"github.com/alecthomas/chroma/formatters/html",
"github.com/alecthomas/chroma/lexers",
"github.com/alecthomas/chroma/styles",
"github.com/bep/debounce",
"github.com/bep/gitmap",
"github.com/bep/go-tocss/scss",
"github.com/bep/go-tocss/scss/libsass",
"github.com/bep/go-tocss/tocss",
"github.com/chaseadamsio/goorgeous",
"github.com/disintegration/imaging",
"github.com/eknkc/amber",
"github.com/fortytw2/leaktest",
"github.com/fsnotify/fsnotify",
"github.com/gobwas/glob",
"github.com/gorilla/websocket",
"github.com/hashicorp/go-immutable-radix",
"github.com/jdkato/prose/transform",
"github.com/kyokomi/emoji",
"github.com/magefile/mage/mg",
"github.com/magefile/mage/sh",
"github.com/markbates/inflect",
"github.com/miekg/mmark",
"github.com/mitchellh/hashstructure",
"github.com/mitchellh/mapstructure",
"github.com/muesli/smartcrop",
"github.com/nicksnyder/go-i18n/i18n/bundle",
"github.com/nicksnyder/go-i18n/i18n/language",
"github.com/olekukonko/tablewriter",
"github.com/russross/blackfriday",
"github.com/sanity-io/litter",
"github.com/spf13/afero",
"github.com/spf13/cast",
"github.com/spf13/cobra",
"github.com/spf13/cobra/doc",
"github.com/spf13/fsync",
"github.com/spf13/jwalterweatherman",
"github.com/spf13/nitro",
"github.com/spf13/pflag",
"github.com/spf13/viper",
"github.com/stretchr/testify/assert",
"github.com/stretchr/testify/require",
"github.com/tdewolff/minify",
"github.com/tdewolff/minify/css",
"github.com/tdewolff/minify/html",
"github.com/tdewolff/minify/js",
"github.com/tdewolff/minify/json",
"github.com/tdewolff/minify/svg",
"github.com/tdewolff/minify/xml",
"github.com/yosssi/ace",
"golang.org/x/image/webp",
"golang.org/x/net/context",
"golang.org/x/sync/errgroup",
"golang.org/x/text/transform",
"golang.org/x/text/unicode/norm",
"gopkg.in/yaml.v2",
]
solver-name = "gps-cdcl"
solver-version = 1
-171
View File
@@ -1,171 +0,0 @@
[[constraint]]
name = "github.com/BurntSushi/toml"
branch = "master"
[[constraint]]
name = "github.com/PuerkitoBio/purell"
version = "1.1.0"
[[constraint]]
name = "github.com/alecthomas/chroma"
revision = "1b755a90bd109f170385cb3964f0abdfd3451145"
[[constraint]]
branch = "master"
name = "github.com/bep/gitmap"
[[constraint]]
branch = "master"
name = "github.com/bep/go-tocss"
[[override]]
branch = "master"
name = "github.com/wellington/go-libsass"
[[constraint]]
name = "github.com/chaseadamsio/goorgeous"
version = "^1.1.0"
[[constraint]]
name = "github.com/disintegration/imaging"
version = "~v1.2.4"
[[constraint]]
name = "github.com/magefile/mage"
version = "v1"
[[constraint]]
branch = "master"
name = "github.com/eknkc/amber"
[[constraint]]
name = "github.com/fortytw2/leaktest"
version = "1.1.0"
[[constraint]]
name = "github.com/fsnotify/fsnotify"
version = "^1.4.0"
[[constraint]]
name = "github.com/gorilla/websocket"
version = "1.2.0"
[[constraint]]
branch = "master"
name = "github.com/hashicorp/go-immutable-radix"
[[constraint]]
name = "github.com/jdkato/prose"
version = "1.1.0"
[[constraint]]
name = "github.com/kyokomi/emoji"
version = "1.5.0"
[[constraint]]
name = "github.com/markbates/inflect"
revision = "a12c3aec81a6a938bf584a4bac567afed9256586"
[[constraint]]
name = "github.com/miekg/mmark"
version = "^1.3.6"
[[constraint]]
branch = "master"
name = "github.com/mitchellh/mapstructure"
[[constraint]]
name = "github.com/nicksnyder/go-i18n"
version = "^1.10.0"
[[constraint]]
name = "github.com/russross/blackfriday"
branch = "master"
[[constraint]]
name = "github.com/spf13/afero"
version = "^1.1.0"
[[constraint]]
name = "github.com/spf13/cast"
version = "^1.1.0"
[[constraint]]
version = "^0.0.1"
name = "github.com/spf13/cobra"
[[constraint]]
branch = "master"
name = "github.com/spf13/fsync"
[[constraint]]
branch = "master"
name = "github.com/spf13/jwalterweatherman"
[[constraint]]
branch = "master"
name = "github.com/spf13/nitro"
[[constraint]]
name = "github.com/spf13/pflag"
version = "1.0.0"
[[constraint]]
name = "github.com/spf13/viper"
version = "1.0.0"
[[constraint]]
name = "github.com/stretchr/testify"
version = "1.1.4"
[[constraint]]
branch = "master"
name = "github.com/olekukonko/tablewriter"
[[constraint]]
name = "github.com/yosssi/ace"
version = "^0.0.5"
[[constraint]]
branch = "master"
name = "golang.org/x/image"
[[constraint]]
branch = "master"
name = "golang.org/x/text"
[[constraint]]
branch = "v2"
name = "gopkg.in/yaml.v2"
[[constraint]]
name = "github.com/gobwas/glob"
version = "0.2.2"
[[constraint]]
name = "github.com/muesli/smartcrop"
branch = "master"
[[constraint]]
name = "github.com/sanity-io/litter"
version = "1.1.0"
[[constraint]]
name = "github.com/bep/debounce"
version = "^1.1.0"
[[constraint]]
name = "github.com/tdewolff/minify"
version = "^2.3.5"
[[constraint]]
branch = "master"
name = "github.com/BurntSushi/locker"
[[constraint]]
branch = "master"
name = "github.com/mitchellh/hashstructure"
+127 -29
View File
@@ -1,19 +1,16 @@
![Hugo](https://raw.githubusercontent.com/gohugoio/hugoDocs/master/static/img/hugo-logo.png)
<a href="https://gohugo.io/"><img src="https://raw.githubusercontent.com/gohugoio/gohugoioTheme/master/static/images/hugo-logo-wide.svg?sanitize=true" alt="Hugo" width="565"></a>
A Fast and Flexible Static Site Generator built with love by [bep](https://github.com/bep), [spf13](http://spf13.com/) and [friends](https://github.com/gohugoio/hugo/graphs/contributors) in [Go][].
[Website](https://gohugo.io) |
[Forum](https://discourse.gohugo.io) |
[Developer Chat (no support)](https://gitter.im/gohugoio/hugo) |
[Documentation](https://gohugo.io/overview/introduction/) |
[Installation Guide](https://gohugo.io/overview/installing/) |
[Documentation](https://gohugo.io/getting-started/) |
[Installation Guide](https://gohugo.io/getting-started/installing/) |
[Contribution Guide](CONTRIBUTING.md) |
[Twitter](http://twitter.com/gohugoio)
[Twitter](https://twitter.com/gohugoio)
[![GoDoc](https://godoc.org/github.com/gohugoio/hugo?status.svg)](https://godoc.org/github.com/gohugoio/hugo)
[![Linux and macOS Build Status](https://api.travis-ci.org/gohugoio/hugo.svg?branch=master&label=Linux+and+macOS+build "Linux and macOS Build Status")](https://travis-ci.org/gohugoio/hugo)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/a5mr220vsd091kua?svg=true&label=Windows+build "Windows Build Status")](https://ci.appveyor.com/project/bep/hugo/branch/master)
[![Dev chat at https://gitter.im/gohugoio/hugo](https://img.shields.io/badge/gitter-developer_chat-46bc99.svg)](https://gitter.im/spf13/hugo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![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)
## Overview
@@ -32,11 +29,11 @@ Hugo is designed to work well for any kind of website including blogs, tumbles,
#### Supported Architectures
Currently, we provide pre-built Hugo binaries for Windows, Linux, FreeBSD, NetBSD, macOS (Darwin), and [Android](https://gist.github.com/bep/a0d8a26cf6b4f8bc992729b8e50b480b) for x64, i386 and ARM architectures.
Currently, we provide pre-built Hugo binaries for Windows, Linux, FreeBSD, NetBSD, DragonFly BSD, OpenBSD, macOS (Darwin), and [Android](https://gist.github.com/bep/a0d8a26cf6b4f8bc992729b8e50b480b) for x64, i386 and ARM architectures.
Hugo may also be compiled from source wherever the Go compiler tool chain can run, e.g. for other operating systems including DragonFly BSD, OpenBSD, Plan 9, and Solaris.
Hugo may also be compiled from source wherever the Go compiler tool chain can run, e.g. for other operating systems including Plan 9 and Solaris.
**Complete documentation is available at [Hugo Documentation][].**
**Complete documentation is available at [Hugo Documentation](https://gohugo.io/getting-started/).**
## Choose How to Install
@@ -50,33 +47,35 @@ Building the binaries is an easy task for an experienced `go` getter.
### Install Hugo as Your Site Generator (Binary Install)
Use the [installation instructions in the Hugo documentation](https://gohugo.io/overview/installing/).
Use the [installation instructions in the Hugo documentation](https://gohugo.io/getting-started/installing/).
### Build and Install the Binaries from Source (Advanced Install)
#### Prerequisite Tools
* [Git](http://git-scm.com/)
* [Go (latest or previous version)](https://golang.org/dl/)
#### Vendored Dependencies
Hugo uses [dep](https://github.com/golang/dep) to vendor dependencies, but we don't commit the vendored packages themselves to the Hugo git repository. Therefore, a simple `go get` is _not_ supported because the command is not vendor aware.
The simplest way is to use [mage](https://github.com/magefile/mage) (a Make alternative for Go projects.)
* [Git](https://git-scm.com/)
* [Go (we test it with the last 2 major versions; but note that Hugo 0.81.0 only builds with >= Go 1.16.)](https://golang.org/dl/)
#### Fetch from GitHub
Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build. The easiest is to clone Hugo in a directory outside of `GOPATH`, as in the following example:
```bash
go get github.com/magefile/mage
go get -d github.com/gohugoio/hugo
cd ${GOPATH:-$HOME/go}/src/github.com/gohugoio/hugo
mage vendor
mage install
mkdir $HOME/src
cd $HOME/src
git clone https://github.com/gohugoio/hugo.git
cd hugo
go install
```
**If you are a Windows user, substitute the `$HOME` environment variable above with `%USERPROFILE%`.**
If you want to compile with Sass/SCSS support use `--tags extended` and make sure `CGO_ENABLED=1` is set in your go environment. If you don't want to have CGO enabled, you may use the following command to temporarily enable CGO only for hugo compilation:
```bash
CGO_ENABLED=1 go install --tags extended
```
## The Hugo Documentation
The Hugo documentation now lives in its own repository, see https://github.com/gohugoio/hugoDocs. But we do keep a version of that documentation as a `git subtree` in this repository. To build the sub folder `/docs` as a Hugo site, you need to clone this repo:
@@ -113,14 +112,113 @@ The Hugo project welcomes all contributors and contributions regardless of skill
If you are interested in helping with the project, we will help you with your contribution.
Hugo is a very active project with many contributions happening daily.
Because we want to create the best possible product for our users and the best contribution experience for our developers,
We want to create the best possible product for our users and the best contribution experience for our developers,
we have a set of guidelines which ensure that all contributions are acceptable.
The guidelines are not intended as a filter or barrier to participation.
If you are unfamiliar with the contribution process, the Hugo team will help you and teach you how to bring your contribution in accordance with the guidelines.
For a complete guide to contributing code to Hugo, see the [Contribution Guide](CONTRIBUTING.md).
[![Analytics](https://ga-beacon.appspot.com/UA-7131036-6/hugo/readme)](https://github.com/igrigorik/ga-beacon)
[Go]: https://golang.org/
[Hugo Documentation]: https://gohugo.io/overview/introduction/
## Dependencies
Hugo stands on the shoulder of many great open source libraries.
If you run `hugo env -v` you will get a complete and up to date list.
In Hugo 0.89.0 that list is, in lexical order:
```
cloud.google.com/go/storage="v1.10.0"
cloud.google.com/go="v0.87.0"
github.com/Azure/azure-pipeline-go="v0.2.2"
github.com/Azure/azure-storage-blob-go="v0.9.0"
github.com/BurntSushi/locker="v0.0.0-20171006230638-a6e239ea1c69"
github.com/BurntSushi/toml="v0.3.1"
github.com/PuerkitoBio/purell="v1.1.1"
github.com/PuerkitoBio/urlesc="v0.0.0-20170810143723-de5bf2ad4578"
github.com/alecthomas/chroma="v0.9.4"
github.com/armon/go-radix="v1.0.0"
github.com/aws/aws-sdk-go="v1.41.14"
github.com/bep/debounce="v1.2.0"
github.com/bep/gitmap="v1.1.2"
github.com/bep/godartsass="v0.12.0"
github.com/bep/golibsass="v1.0.0"
github.com/bep/gowebp="v0.1.0"
github.com/bep/tmc="v0.5.1"
github.com/cli/safeexec="v1.0.0"
github.com/cpuguy83/go-md2man/v2="v2.0.0"
github.com/disintegration/gift="v1.2.1"
github.com/dlclark/regexp2="v1.4.0"
github.com/dustin/go-humanize="v1.0.0"
github.com/evanw/esbuild="v0.13.12"
github.com/fsnotify/fsnotify="v1.5.1"
github.com/getkin/kin-openapi="v0.80.0"
github.com/ghodss/yaml="v1.0.0"
github.com/go-openapi/jsonpointer="v0.19.5"
github.com/go-openapi/swag="v0.19.5"
github.com/gobuffalo/flect="v0.2.3"
github.com/gobwas/glob="v0.2.3"
github.com/gohugoio/go-i18n/v2="v2.1.3-0.20210430103248-4c28c89f8013"
github.com/gohugoio/locales="v0.14.0"
github.com/gohugoio/localescompressed="v0.14.0"
github.com/golang/groupcache="v0.0.0-20200121045136-8c9f03a8e57e"
github.com/golang/protobuf="v1.5.2"
github.com/google/go-cmp="v0.5.6"
github.com/google/uuid="v1.1.2"
github.com/google/wire="v0.4.0"
github.com/googleapis/gax-go/v2="v2.0.5"
github.com/googleapis/gax-go="v2.0.2+incompatible"
github.com/gorilla/websocket="v1.4.2"
github.com/inconshreveable/mousetrap="v1.0.0"
github.com/jdkato/prose="v1.2.1"
github.com/jmespath/go-jmespath="v0.4.0"
github.com/kyokomi/emoji/v2="v2.2.8"
github.com/mailru/easyjson="v0.0.0-20190626092158-b2ccc519800e"
github.com/mattn/go-ieproxy="v0.0.1"
github.com/mattn/go-isatty="v0.0.14"
github.com/mattn/go-runewidth="v0.0.9"
github.com/miekg/mmark="v1.3.6"
github.com/mitchellh/hashstructure="v1.1.0"
github.com/mitchellh/mapstructure="v1.4.2"
github.com/muesli/smartcrop="v0.3.0"
github.com/niklasfasching/go-org="v1.5.0"
github.com/olekukonko/tablewriter="v0.0.5"
github.com/pelletier/go-toml/v2="v2.0.0-beta.3.0.20210727221244-fa0796069526"
github.com/pkg/errors="v0.9.1"
github.com/rogpeppe/go-internal="v1.8.0"
github.com/russross/blackfriday/v2="v2.0.1"
github.com/russross/blackfriday="v1.5.3-0.20200218234912-41c5fccfd6f6"
github.com/rwcarlsen/goexif="v0.0.0-20190401172101-9e8deecbddbd"
github.com/sanity-io/litter="v1.5.1"
github.com/sass/libsass="3.6.5"
github.com/shurcooL/sanitized_anchor_name="v1.0.0"
github.com/spf13/afero="v1.6.0"
github.com/spf13/cast="v1.4.1"
github.com/spf13/cobra="v1.2.1"
github.com/spf13/fsync="v0.9.0"
github.com/spf13/jwalterweatherman="v1.1.0"
github.com/spf13/pflag="v1.0.5"
github.com/tdewolff/minify/v2="v2.9.22"
github.com/tdewolff/parse/v2="v2.5.21"
github.com/webmproject/libwebp="v1.2.0"
github.com/yuin/goldmark-highlighting="v0.0.0-20200307114337-60d527fdb691"
github.com/yuin/goldmark="v1.4.2"
go.opencensus.io="v0.23.0"
gocloud.dev="v0.20.0"
golang.org/x/image="v0.0.0-20210220032944-ac19c3e999fb"
golang.org/x/net="v0.0.0-20210614182718-04defd469f4e"
golang.org/x/oauth2="v0.0.0-20210628180205-a41e5a781914"
golang.org/x/sync="v0.0.0-20210220032951-036812b2e83c"
golang.org/x/sys="v0.0.0-20210908233432-aa78b53d3365"
golang.org/x/text="v0.3.7"
golang.org/x/xerrors="v0.0.0-20200804184101-5ec99f83aff1"
google.golang.org/api="v0.51.0"
google.golang.org/genproto="v0.0.0-20210716133855-ce7ef5c701ea"
google.golang.org/grpc="v1.39.0"
google.golang.org/protobuf="v1.27.1"
gopkg.in/yaml.v2="v2.4.0"
```
+7
View File
@@ -0,0 +1,7 @@
## Security Policy
### Reporting a Vulnerability
Please report (suspected) security vulnerabilities to **[bjorn.erik.pedersen@gmail.com](mailto:bjorn.erik.pedersen@gmail.com)**. You will receive a response from us within 48 hours. If we can confirm the issue, we will release a patch as soon as possible depending on the complexity of the issue but historically within days.
Also see [Hugo's Security Model](https://gohugo.io/about/security-model/).
-24
View File
@@ -1,24 +0,0 @@
image: Visual Studio 2015
init:
- set PATH=%PATH%;C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin;%GOPATH%\bin
- go version
- go env
environment:
GOPATH: C:\GOPATH\
HUGO_BUILD_TAGS: extended
# clones and cd's to path
clone_folder: C:\GOPATH\src\github.com\gohugoio\hugo
install:
# - gem install asciidoctor
- pip install docutils
- go get github.com/magefile/mage
build_script:
- mage vendor hugoRace
- mage -v check
- hugo -s docs/
- hugo --renderToMemory -s docs/
+1 -1
View File
@@ -3,7 +3,7 @@
# allow user to override go executable by running as GOEXE=xxx make ...
GOEXE="${GOEXE-go}"
# Send in a regexp mathing the benchmarks you want to run, i.e. './benchSite.sh "YAML"'.
# Send in a regexp matching the benchmarks you want to run, i.e. './benchSite.sh "YAML"'.
# Note the quotes, which will be needed for more complex expressions.
# The above will run all variations, but only for front matter YAML.
Executable
+1
View File
@@ -0,0 +1 @@
gobench -package=./hugolib -bench="BenchmarkSiteNew/Deep_content_tree"
+1 -2
View File
@@ -1,2 +1 @@
# Temp script used to test new builds.
docker run --rm --mount type=bind,source="$(pwd)",target=/go/src/github.com/gohugoio/hugo -w /go/src/github.com/gohugoio/hugo -i -t bepsays/ci-goreleaser:latest /bin/bash
docker run --rm --mount type=bind,source="$(pwd)",target=/hugo -w /hugo -i -t bepsays/ci-goreleaser:1.11-2 /bin/bash
+7 -3
View File
@@ -14,14 +14,18 @@
package bufferpool
import (
"github.com/stretchr/testify/assert"
"testing"
qt "github.com/frankban/quicktest"
)
func TestBufferPool(t *testing.T) {
c := qt.New(t)
buff := GetBuffer()
buff.WriteString("do be do be do")
assert.Equal(t, "do be do be do", buff.String())
c.Assert(buff.String(), qt.Equals, "do be do be do")
PutBuffer(buff)
assert.Equal(t, 0, buff.Len())
c.Assert(buff.Len(), qt.Equals, 0)
}
+399
View File
@@ -0,0 +1,399 @@
// Copyright 2018 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 filecache
import (
"bytes"
"errors"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"sync"
"time"
"github.com/gohugoio/hugo/common/hugio"
"github.com/gohugoio/hugo/helpers"
"github.com/BurntSushi/locker"
"github.com/spf13/afero"
)
// ErrFatal can be used to signal an unrecoverable error.
var ErrFatal = errors.New("fatal filecache error")
const (
filecacheRootDirname = "filecache"
)
// Cache caches a set of files in a directory. This is usually a file on
// disk, but since this is backed by an Afero file system, it can be anything.
type Cache struct {
Fs afero.Fs
// Max age for items in this cache. Negative duration means forever,
// 0 is effectively turning this cache off.
maxAge time.Duration
// Number of retries on create error.
retries int
// When set, we just remove this entire root directory on expiration.
pruneAllRootDir string
nlocker *lockTracker
}
type lockTracker struct {
seenMu sync.RWMutex
seen map[string]struct{}
*locker.Locker
}
// Lock tracks the ids in use. We use this information to do garbage collection
// after a Hugo build.
func (l *lockTracker) Lock(id string) {
l.seenMu.RLock()
if _, seen := l.seen[id]; !seen {
l.seenMu.RUnlock()
l.seenMu.Lock()
l.seen[id] = struct{}{}
l.seenMu.Unlock()
} else {
l.seenMu.RUnlock()
}
l.Locker.Lock(id)
}
// ItemInfo contains info about a cached file.
type ItemInfo struct {
// This is the file's name relative to the cache's filesystem.
Name string
}
// NewCache creates a new file cache with the given filesystem and max age.
func NewCache(fs afero.Fs, maxAge time.Duration, retries int, pruneAllRootDir string) *Cache {
return &Cache{
Fs: fs,
nlocker: &lockTracker{Locker: locker.NewLocker(), seen: make(map[string]struct{})},
maxAge: maxAge,
retries: retries,
pruneAllRootDir: pruneAllRootDir,
}
}
// lockedFile is a file with a lock that is released on Close.
type lockedFile struct {
afero.File
unlock func()
}
func (l *lockedFile) Close() error {
defer l.unlock()
return l.File.Close()
}
// WriteCloser returns a transactional writer into the cache.
// It's important that it's closed when done.
func (c *Cache) WriteCloser(id string) (ItemInfo, io.WriteCloser, error) {
id = cleanID(id)
c.nlocker.Lock(id)
info := ItemInfo{Name: id}
f, err := helpers.OpenFileForWriting(c.Fs, id)
if err != nil {
c.nlocker.Unlock(id)
return info, nil, err
}
return info, &lockedFile{
File: f,
unlock: func() { c.nlocker.Unlock(id) },
}, nil
}
// ReadOrCreate tries to lookup the file in cache.
// If found, it is passed to read and then closed.
// If not found a new file is created and passed to create, which should close
// it when done.
func (c *Cache) ReadOrCreate(id string,
read func(info ItemInfo, r io.ReadSeeker) error,
create func(info ItemInfo, w io.WriteCloser) error) (info ItemInfo, err error) {
id = cleanID(id)
c.nlocker.Lock(id)
defer c.nlocker.Unlock(id)
info = ItemInfo{Name: id}
if r := c.getOrRemove(id); r != nil {
err = read(info, r)
defer r.Close()
if err == nil || err == ErrFatal {
// See https://github.com/gohugoio/hugo/issues/6401
// To recover from file corruption we handle read errors
// as the cache item was not found.
// Any file permission issue will also fail in the next step.
return
}
}
f, err := helpers.OpenFileForWriting(c.Fs, id)
if err != nil {
return
}
err = create(info, f)
return
}
// GetOrCreate tries to get the file with the given id from cache. If not found or expired, create will
// be invoked and the result cached.
// This method is protected by a named lock using the given id as identifier.
func (c *Cache) GetOrCreate(id string, create func() (io.ReadCloser, error)) (ItemInfo, io.ReadCloser, error) {
id = cleanID(id)
c.nlocker.Lock(id)
defer c.nlocker.Unlock(id)
info := ItemInfo{Name: id}
if r := c.getOrRemove(id); r != nil {
return info, r, nil
}
var (
r io.ReadCloser
err error
)
for i := -1; i < c.retries; i++ {
r, err = create()
if err == nil || c.retries == 0 {
break
}
time.Sleep(1 * time.Second)
}
if err != nil {
return info, nil, err
}
if c.maxAge == 0 {
// No caching.
return info, hugio.ToReadCloser(r), nil
}
var buff bytes.Buffer
return info,
hugio.ToReadCloser(&buff),
afero.WriteReader(c.Fs, id, io.TeeReader(r, &buff))
}
// GetOrCreateBytes is the same as GetOrCreate, but produces a byte slice.
func (c *Cache) GetOrCreateBytes(id string, create func() ([]byte, error)) (ItemInfo, []byte, error) {
id = cleanID(id)
c.nlocker.Lock(id)
defer c.nlocker.Unlock(id)
info := ItemInfo{Name: id}
if r := c.getOrRemove(id); r != nil {
defer r.Close()
b, err := ioutil.ReadAll(r)
return info, b, err
}
var (
b []byte
err error
)
for i := -1; i < c.retries; i++ {
b, err = create()
if err == nil || c.retries == 0 {
break
}
time.Sleep(1 * time.Second)
}
if err != nil {
return info, nil, err
}
if c.maxAge == 0 {
return info, b, nil
}
if err := afero.WriteReader(c.Fs, id, bytes.NewReader(b)); err != nil {
return info, nil, err
}
return info, b, nil
}
// GetBytes gets the file content with the given id from the cache, nil if none found.
func (c *Cache) GetBytes(id string) (ItemInfo, []byte, error) {
id = cleanID(id)
c.nlocker.Lock(id)
defer c.nlocker.Unlock(id)
info := ItemInfo{Name: id}
if r := c.getOrRemove(id); r != nil {
defer r.Close()
b, err := ioutil.ReadAll(r)
return info, b, err
}
return info, nil, nil
}
// Get gets the file with the given id from the cahce, nil if none found.
func (c *Cache) Get(id string) (ItemInfo, io.ReadCloser, error) {
id = cleanID(id)
c.nlocker.Lock(id)
defer c.nlocker.Unlock(id)
info := ItemInfo{Name: id}
r := c.getOrRemove(id)
return info, r, nil
}
// getOrRemove gets the file with the given id. If it's expired, it will
// be removed.
func (c *Cache) getOrRemove(id string) hugio.ReadSeekCloser {
if c.maxAge == 0 {
// No caching.
return nil
}
if c.maxAge > 0 {
fi, err := c.Fs.Stat(id)
if err != nil {
return nil
}
if c.isExpired(fi.ModTime()) {
c.Fs.Remove(id)
return nil
}
}
f, err := c.Fs.Open(id)
if err != nil {
return nil
}
return f
}
func (c *Cache) isExpired(modTime time.Time) bool {
if c.maxAge < 0 {
return false
}
return c.maxAge == 0 || time.Since(modTime) > c.maxAge
}
// For testing
func (c *Cache) getString(id string) string {
id = cleanID(id)
c.nlocker.Lock(id)
defer c.nlocker.Unlock(id)
f, err := c.Fs.Open(id)
if err != nil {
return ""
}
defer f.Close()
b, _ := ioutil.ReadAll(f)
return string(b)
}
// Caches is a named set of caches.
type Caches map[string]*Cache
// Get gets a named cache, nil if none found.
func (f Caches) Get(name string) *Cache {
return f[strings.ToLower(name)]
}
// NewCaches creates a new set of file caches from the given
// configuration.
func NewCaches(p *helpers.PathSpec) (Caches, error) {
var dcfg Configs
if c, ok := p.Cfg.Get("filecacheConfigs").(Configs); ok {
dcfg = c
} else {
var err error
dcfg, err = DecodeConfig(p.Fs.Source, p.Cfg)
if err != nil {
return nil, err
}
}
fs := p.Fs.Source
m := make(Caches)
for k, v := range dcfg {
var cfs afero.Fs
if v.isResourceDir {
cfs = p.BaseFs.ResourcesCache
} else {
cfs = fs
}
if cfs == nil {
// TODO(bep) we still have some places that do not initialize the
// full dependencies of a site, e.g. the import Jekyll command.
// That command does not need these caches, so let us just continue
// for now.
continue
}
baseDir := v.Dir
if err := cfs.MkdirAll(baseDir, 0777); err != nil && !os.IsExist(err) {
return nil, err
}
bfs := afero.NewBasePathFs(cfs, baseDir)
var pruneAllRootDir string
if k == cacheKeyModules {
pruneAllRootDir = "pkg"
}
m[k] = NewCache(bfs, v.MaxAge, v.retries, pruneAllRootDir)
}
return m, nil
}
func cleanID(name string) string {
return strings.TrimPrefix(filepath.Clean(name), helpers.FilePathSeparator)
}
+251
View File
@@ -0,0 +1,251 @@
// Copyright 2018 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 filecache
import (
"path"
"path/filepath"
"strings"
"time"
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/helpers"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/spf13/afero"
)
const (
cachesConfigKey = "caches"
resourcesGenDir = ":resourceDir/_gen"
cacheDirProject = ":cacheDir/:project"
)
var defaultCacheConfig = Config{
MaxAge: -1, // Never expire
Dir: cacheDirProject,
}
const (
cacheKeyGetJSON = "getjson"
cacheKeyGetCSV = "getcsv"
cacheKeyImages = "images"
cacheKeyAssets = "assets"
cacheKeyModules = "modules"
cacheKeyGetResource = "getresource"
)
type Configs map[string]Config
func (c Configs) CacheDirModules() string {
return c[cacheKeyModules].Dir
}
var defaultCacheConfigs = Configs{
cacheKeyModules: {
MaxAge: -1,
Dir: ":cacheDir/modules",
},
cacheKeyGetJSON: defaultCacheConfig,
cacheKeyGetCSV: defaultCacheConfig,
cacheKeyImages: {
MaxAge: -1,
Dir: resourcesGenDir,
},
cacheKeyAssets: {
MaxAge: -1,
Dir: resourcesGenDir,
},
cacheKeyGetResource: Config{
MaxAge: -1, // Never expire
Dir: cacheDirProject,
retries: 3, // Retries on error getting the remote resource.
},
}
type Config struct {
// Max age of cache entries in this cache. Any items older than this will
// be removed and not returned from the cache.
// a negative value means forever, 0 means cache is disabled.
MaxAge time.Duration
// The directory where files are stored.
Dir string
// Will resources/_gen will get its own composite filesystem that
// also checks any theme.
isResourceDir bool
// Number of retries when errors occurs when creating the element,
// only used for remote resources.
retries int
}
// GetJSONCache gets the file cache for getJSON.
func (f Caches) GetJSONCache() *Cache {
return f[cacheKeyGetJSON]
}
// GetCSVCache gets the file cache for getCSV.
func (f Caches) GetCSVCache() *Cache {
return f[cacheKeyGetCSV]
}
// ImageCache gets the file cache for processed images.
func (f Caches) ImageCache() *Cache {
return f[cacheKeyImages]
}
// ModulesCache gets the file cache for Hugo Modules.
func (f Caches) ModulesCache() *Cache {
return f[cacheKeyModules]
}
// AssetsCache gets the file cache for assets (processed resources, SCSS etc.).
func (f Caches) AssetsCache() *Cache {
return f[cacheKeyAssets]
}
// GetResourceCache gets the file cache for remote resources.
func (f Caches) GetResourceCache() *Cache {
return f[cacheKeyGetResource]
}
func DecodeConfig(fs afero.Fs, cfg config.Provider) (Configs, error) {
c := make(Configs)
valid := make(map[string]bool)
// Add defaults
for k, v := range defaultCacheConfigs {
c[k] = v
valid[k] = true
}
m := cfg.GetStringMap(cachesConfigKey)
_, isOsFs := fs.(*afero.OsFs)
for k, v := range m {
if _, ok := v.(maps.Params); !ok {
continue
}
cc := defaultCacheConfig
dc := &mapstructure.DecoderConfig{
Result: &cc,
DecodeHook: mapstructure.StringToTimeDurationHookFunc(),
WeaklyTypedInput: true,
}
decoder, err := mapstructure.NewDecoder(dc)
if err != nil {
return c, err
}
if err := decoder.Decode(v); err != nil {
return nil, errors.Wrap(err, "failed to decode filecache config")
}
if cc.Dir == "" {
return c, errors.New("must provide cache Dir")
}
name := strings.ToLower(k)
if !valid[name] {
return nil, errors.Errorf("%q is not a valid cache name", name)
}
c[name] = cc
}
// This is a very old flag in Hugo, but we need to respect it.
disabled := cfg.GetBool("ignoreCache")
for k, v := range c {
dir := filepath.ToSlash(filepath.Clean(v.Dir))
hadSlash := strings.HasPrefix(dir, "/")
parts := strings.Split(dir, "/")
for i, part := range parts {
if strings.HasPrefix(part, ":") {
resolved, isResource, err := resolveDirPlaceholder(fs, cfg, part)
if err != nil {
return c, err
}
if isResource {
v.isResourceDir = true
}
parts[i] = resolved
}
}
dir = path.Join(parts...)
if hadSlash {
dir = "/" + dir
}
v.Dir = filepath.Clean(filepath.FromSlash(dir))
if !v.isResourceDir {
if isOsFs && !filepath.IsAbs(v.Dir) {
return c, errors.Errorf("%q must resolve to an absolute directory", v.Dir)
}
// Avoid cache in root, e.g. / (Unix) or c:\ (Windows)
if len(strings.TrimPrefix(v.Dir, filepath.VolumeName(v.Dir))) == 1 {
return c, errors.Errorf("%q is a root folder and not allowed as cache dir", v.Dir)
}
}
if !strings.HasPrefix(v.Dir, "_gen") {
// We do cache eviction (file removes) and since the user can set
// his/hers own cache directory, we really want to make sure
// we do not delete any files that do not belong to this cache.
// We do add the cache name as the root, but this is an extra safe
// guard. We skip the files inside /resources/_gen/ because
// that would be breaking.
v.Dir = filepath.Join(v.Dir, filecacheRootDirname, k)
} else {
v.Dir = filepath.Join(v.Dir, k)
}
if disabled {
v.MaxAge = 0
}
c[k] = v
}
return c, nil
}
// Resolves :resourceDir => /myproject/resources etc., :cacheDir => ...
func resolveDirPlaceholder(fs afero.Fs, cfg config.Provider, placeholder string) (cacheDir string, isResource bool, err error) {
workingDir := cfg.GetString("workingDir")
switch strings.ToLower(placeholder) {
case ":resourcedir":
return "", true, nil
case ":cachedir":
d, err := helpers.GetCacheDir(fs, cfg)
return d, false, err
case ":project":
return filepath.Base(workingDir), false, nil
}
return "", false, errors.Errorf("%q is not a valid placeholder (valid values are :cacheDir or :resourceDir)", placeholder)
}
+198
View File
@@ -0,0 +1,198 @@
// Copyright 2018 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 filecache
import (
"path/filepath"
"runtime"
"strings"
"testing"
"time"
"github.com/spf13/afero"
"github.com/gohugoio/hugo/config"
qt "github.com/frankban/quicktest"
)
func TestDecodeConfig(t *testing.T) {
t.Parallel()
c := qt.New(t)
configStr := `
resourceDir = "myresources"
contentDir = "content"
dataDir = "data"
i18nDir = "i18n"
layoutDir = "layouts"
assetDir = "assets"
archetypeDir = "archetypes"
[caches]
[caches.getJSON]
maxAge = "10m"
dir = "/path/to/c1"
[caches.getCSV]
maxAge = "11h"
dir = "/path/to/c2"
[caches.images]
dir = "/path/to/c3"
[caches.getResource]
dir = "/path/to/c4"
`
cfg, err := config.FromConfigString(configStr, "toml")
c.Assert(err, qt.IsNil)
fs := afero.NewMemMapFs()
decoded, err := DecodeConfig(fs, cfg)
c.Assert(err, qt.IsNil)
c.Assert(len(decoded), qt.Equals, 6)
c2 := decoded["getcsv"]
c.Assert(c2.MaxAge.String(), qt.Equals, "11h0m0s")
c.Assert(c2.Dir, qt.Equals, filepath.FromSlash("/path/to/c2/filecache/getcsv"))
c3 := decoded["images"]
c.Assert(c3.MaxAge, qt.Equals, time.Duration(-1))
c.Assert(c3.Dir, qt.Equals, filepath.FromSlash("/path/to/c3/filecache/images"))
c4 := decoded["getresource"]
c.Assert(c4.MaxAge, qt.Equals, time.Duration(-1))
c.Assert(c4.Dir, qt.Equals, filepath.FromSlash("/path/to/c4/filecache/getresource"))
}
func TestDecodeConfigIgnoreCache(t *testing.T) {
t.Parallel()
c := qt.New(t)
configStr := `
resourceDir = "myresources"
contentDir = "content"
dataDir = "data"
i18nDir = "i18n"
layoutDir = "layouts"
assetDir = "assets"
archeTypedir = "archetypes"
ignoreCache = true
[caches]
[caches.getJSON]
maxAge = 1234
dir = "/path/to/c1"
[caches.getCSV]
maxAge = 3456
dir = "/path/to/c2"
[caches.images]
dir = "/path/to/c3"
[caches.getResource]
dir = "/path/to/c4"
`
cfg, err := config.FromConfigString(configStr, "toml")
c.Assert(err, qt.IsNil)
fs := afero.NewMemMapFs()
decoded, err := DecodeConfig(fs, cfg)
c.Assert(err, qt.IsNil)
c.Assert(len(decoded), qt.Equals, 6)
for _, v := range decoded {
c.Assert(v.MaxAge, qt.Equals, time.Duration(0))
}
}
func TestDecodeConfigDefault(t *testing.T) {
c := qt.New(t)
cfg := newTestConfig()
if runtime.GOOS == "windows" {
cfg.Set("resourceDir", "c:\\cache\\resources")
cfg.Set("cacheDir", "c:\\cache\\thecache")
} else {
cfg.Set("resourceDir", "/cache/resources")
cfg.Set("cacheDir", "/cache/thecache")
}
fs := afero.NewMemMapFs()
decoded, err := DecodeConfig(fs, cfg)
c.Assert(err, qt.IsNil)
c.Assert(len(decoded), qt.Equals, 6)
imgConfig := decoded[cacheKeyImages]
jsonConfig := decoded[cacheKeyGetJSON]
if runtime.GOOS == "windows" {
c.Assert(imgConfig.Dir, qt.Equals, filepath.FromSlash("_gen/images"))
} else {
c.Assert(imgConfig.Dir, qt.Equals, "_gen/images")
c.Assert(jsonConfig.Dir, qt.Equals, "/cache/thecache/hugoproject/filecache/getjson")
}
c.Assert(imgConfig.isResourceDir, qt.Equals, true)
c.Assert(jsonConfig.isResourceDir, qt.Equals, false)
}
func TestDecodeConfigInvalidDir(t *testing.T) {
t.Parallel()
c := qt.New(t)
configStr := `
resourceDir = "myresources"
contentDir = "content"
dataDir = "data"
i18nDir = "i18n"
layoutDir = "layouts"
assetDir = "assets"
archeTypedir = "archetypes"
[caches]
[caches.getJSON]
maxAge = "10m"
dir = "/"
`
if runtime.GOOS == "windows" {
configStr = strings.Replace(configStr, "/", "c:\\\\", 1)
}
cfg, err := config.FromConfigString(configStr, "toml")
c.Assert(err, qt.IsNil)
fs := afero.NewMemMapFs()
_, err = DecodeConfig(fs, cfg)
c.Assert(err, qt.Not(qt.IsNil))
}
func newTestConfig() config.Provider {
cfg := config.New()
cfg.Set("workingDir", filepath.FromSlash("/my/cool/hugoproject"))
cfg.Set("contentDir", "content")
cfg.Set("dataDir", "data")
cfg.Set("resourceDir", "resources")
cfg.Set("i18nDir", "i18n")
cfg.Set("layoutDir", "layouts")
cfg.Set("archetypeDir", "archetypes")
cfg.Set("assetDir", "assets")
return cfg
}
+126
View File
@@ -0,0 +1,126 @@
// Copyright 2018 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 filecache
import (
"io"
"os"
"github.com/gohugoio/hugo/hugofs"
"github.com/pkg/errors"
"github.com/spf13/afero"
)
// Prune removes expired and unused items from this cache.
// The last one requires a full build so the cache usage can be tracked.
// Note that we operate directly on the filesystem here, so this is not
// thread safe.
func (c Caches) Prune() (int, error) {
counter := 0
for k, cache := range c {
count, err := cache.Prune(false)
counter += count
if err != nil {
if os.IsNotExist(err) {
continue
}
return counter, errors.Wrapf(err, "failed to prune cache %q", k)
}
}
return counter, nil
}
// Prune removes expired and unused items from this cache.
// If force is set, everything will be removed not considering expiry time.
func (c *Cache) Prune(force bool) (int, error) {
if c.pruneAllRootDir != "" {
return c.pruneRootDir(force)
}
counter := 0
err := afero.Walk(c.Fs, "", func(name string, info os.FileInfo, err error) error {
if info == nil {
return nil
}
name = cleanID(name)
if info.IsDir() {
f, err := c.Fs.Open(name)
if err != nil {
// This cache dir may not exist.
return nil
}
defer f.Close()
_, err = f.Readdirnames(1)
if err == io.EOF {
// Empty dir.
err = c.Fs.Remove(name)
}
if err != nil && !os.IsNotExist(err) {
return err
}
return nil
}
shouldRemove := force || c.isExpired(info.ModTime())
if !shouldRemove && len(c.nlocker.seen) > 0 {
// Remove it if it's not been touched/used in the last build.
_, seen := c.nlocker.seen[name]
shouldRemove = !seen
}
if shouldRemove {
err := c.Fs.Remove(name)
if err == nil {
counter++
}
if err != nil && !os.IsNotExist(err) {
return err
}
}
return nil
})
return counter, err
}
func (c *Cache) pruneRootDir(force bool) (int, error) {
info, err := c.Fs.Stat(c.pruneAllRootDir)
if err != nil {
if os.IsNotExist(err) {
return 0, nil
}
return 0, err
}
if !force && !c.isExpired(info.ModTime()) {
return 0, nil
}
return hugofs.MakeReadableAndRemoveAllModulePkgDir(c.Fs, c.pruneAllRootDir)
}
+110
View File
@@ -0,0 +1,110 @@
// Copyright 2018 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 filecache
import (
"fmt"
"testing"
"time"
"github.com/spf13/afero"
qt "github.com/frankban/quicktest"
)
func TestPrune(t *testing.T) {
t.Parallel()
c := qt.New(t)
configStr := `
resourceDir = "myresources"
contentDir = "content"
dataDir = "data"
i18nDir = "i18n"
layoutDir = "layouts"
assetDir = "assets"
archeTypedir = "archetypes"
[caches]
[caches.getjson]
maxAge = "200ms"
dir = "/cache/c"
[caches.getcsv]
maxAge = "200ms"
dir = "/cache/d"
[caches.assets]
maxAge = "200ms"
dir = ":resourceDir/_gen"
[caches.images]
maxAge = "200ms"
dir = ":resourceDir/_gen"
`
for _, name := range []string{cacheKeyGetCSV, cacheKeyGetJSON, cacheKeyAssets, cacheKeyImages} {
msg := qt.Commentf("cache: %s", name)
p := newPathsSpec(t, afero.NewMemMapFs(), configStr)
caches, err := NewCaches(p)
c.Assert(err, qt.IsNil)
cache := caches[name]
for i := 0; i < 10; i++ {
id := fmt.Sprintf("i%d", i)
cache.GetOrCreateBytes(id, func() ([]byte, error) {
return []byte("abc"), nil
})
if i == 4 {
// This will expire the first 5
time.Sleep(201 * time.Millisecond)
}
}
count, err := caches.Prune()
c.Assert(err, qt.IsNil)
c.Assert(count, qt.Equals, 5, msg)
for i := 0; i < 10; i++ {
id := fmt.Sprintf("i%d", i)
v := cache.getString(id)
if i < 5 {
c.Assert(v, qt.Equals, "")
} else {
c.Assert(v, qt.Equals, "abc")
}
}
caches, err = NewCaches(p)
c.Assert(err, qt.IsNil)
cache = caches[name]
// Touch one and then prune.
cache.GetOrCreateBytes("i5", func() ([]byte, error) {
return []byte("abc"), nil
})
count, err = caches.Prune()
c.Assert(err, qt.IsNil)
c.Assert(count, qt.Equals, 4)
// Now only the i5 should be left.
for i := 0; i < 10; i++ {
id := fmt.Sprintf("i%d", i)
v := cache.getString(id)
if i != 5 {
c.Assert(v, qt.Equals, "")
} else {
c.Assert(v, qt.Equals, "abc")
}
}
}
}
+348
View File
@@ -0,0 +1,348 @@
// Copyright 2018 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 filecache
import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"sync"
"testing"
"time"
"github.com/gobwas/glob"
"github.com/gohugoio/hugo/langs"
"github.com/gohugoio/hugo/modules"
"github.com/gohugoio/hugo/common/hugio"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/hugofs"
"github.com/spf13/afero"
qt "github.com/frankban/quicktest"
)
func TestFileCache(t *testing.T) {
t.Parallel()
c := qt.New(t)
tempWorkingDir, err := ioutil.TempDir("", "hugo_filecache_test_work")
c.Assert(err, qt.IsNil)
defer os.Remove(tempWorkingDir)
tempCacheDir, err := ioutil.TempDir("", "hugo_filecache_test_cache")
c.Assert(err, qt.IsNil)
defer os.Remove(tempCacheDir)
osfs := afero.NewOsFs()
for _, test := range []struct {
cacheDir string
workingDir string
}{
// Run with same dirs twice to make sure that works.
{tempCacheDir, tempWorkingDir},
{tempCacheDir, tempWorkingDir},
} {
configStr := `
workingDir = "WORKING_DIR"
resourceDir = "resources"
cacheDir = "CACHEDIR"
contentDir = "content"
dataDir = "data"
i18nDir = "i18n"
layoutDir = "layouts"
assetDir = "assets"
archeTypedir = "archetypes"
[caches]
[caches.getJSON]
maxAge = "10h"
dir = ":cacheDir/c"
`
winPathSep := "\\\\"
replacer := strings.NewReplacer("CACHEDIR", test.cacheDir, "WORKING_DIR", test.workingDir)
configStr = replacer.Replace(configStr)
configStr = strings.Replace(configStr, "\\", winPathSep, -1)
p := newPathsSpec(t, osfs, configStr)
caches, err := NewCaches(p)
c.Assert(err, qt.IsNil)
cache := caches.Get("GetJSON")
c.Assert(cache, qt.Not(qt.IsNil))
c.Assert(cache.maxAge.String(), qt.Equals, "10h0m0s")
bfs, ok := cache.Fs.(*afero.BasePathFs)
c.Assert(ok, qt.Equals, true)
filename, err := bfs.RealPath("key")
c.Assert(err, qt.IsNil)
if test.cacheDir != "" {
c.Assert(filename, qt.Equals, filepath.Join(test.cacheDir, "c/"+filecacheRootDirname+"/getjson/key"))
} else {
// Temp dir.
c.Assert(filename, qt.Matches, ".*hugo_cache.*"+filecacheRootDirname+".*key")
}
cache = caches.Get("Images")
c.Assert(cache, qt.Not(qt.IsNil))
c.Assert(cache.maxAge, qt.Equals, time.Duration(-1))
bfs, ok = cache.Fs.(*afero.BasePathFs)
c.Assert(ok, qt.Equals, true)
filename, _ = bfs.RealPath("key")
c.Assert(filename, qt.Equals, filepath.FromSlash("_gen/images/key"))
rf := func(s string) func() (io.ReadCloser, error) {
return func() (io.ReadCloser, error) {
return struct {
io.ReadSeeker
io.Closer
}{
strings.NewReader(s),
ioutil.NopCloser(nil),
}, nil
}
}
bf := func() ([]byte, error) {
return []byte("bcd"), nil
}
for _, ca := range []*Cache{caches.ImageCache(), caches.AssetsCache(), caches.GetJSONCache(), caches.GetCSVCache()} {
for i := 0; i < 2; i++ {
info, r, err := ca.GetOrCreate("a", rf("abc"))
c.Assert(err, qt.IsNil)
c.Assert(r, qt.Not(qt.IsNil))
c.Assert(info.Name, qt.Equals, "a")
b, _ := ioutil.ReadAll(r)
r.Close()
c.Assert(string(b), qt.Equals, "abc")
info, b, err = ca.GetOrCreateBytes("b", bf)
c.Assert(err, qt.IsNil)
c.Assert(r, qt.Not(qt.IsNil))
c.Assert(info.Name, qt.Equals, "b")
c.Assert(string(b), qt.Equals, "bcd")
_, b, err = ca.GetOrCreateBytes("a", bf)
c.Assert(err, qt.IsNil)
c.Assert(string(b), qt.Equals, "abc")
_, r, err = ca.GetOrCreate("a", rf("bcd"))
c.Assert(err, qt.IsNil)
b, _ = ioutil.ReadAll(r)
r.Close()
c.Assert(string(b), qt.Equals, "abc")
}
}
c.Assert(caches.Get("getJSON"), qt.Not(qt.IsNil))
info, w, err := caches.ImageCache().WriteCloser("mykey")
c.Assert(err, qt.IsNil)
c.Assert(info.Name, qt.Equals, "mykey")
io.WriteString(w, "Hugo is great!")
w.Close()
c.Assert(caches.ImageCache().getString("mykey"), qt.Equals, "Hugo is great!")
info, r, err := caches.ImageCache().Get("mykey")
c.Assert(err, qt.IsNil)
c.Assert(r, qt.Not(qt.IsNil))
c.Assert(info.Name, qt.Equals, "mykey")
b, _ := ioutil.ReadAll(r)
r.Close()
c.Assert(string(b), qt.Equals, "Hugo is great!")
info, b, err = caches.ImageCache().GetBytes("mykey")
c.Assert(err, qt.IsNil)
c.Assert(info.Name, qt.Equals, "mykey")
c.Assert(string(b), qt.Equals, "Hugo is great!")
}
}
func TestFileCacheConcurrent(t *testing.T) {
t.Parallel()
c := qt.New(t)
configStr := `
resourceDir = "myresources"
contentDir = "content"
dataDir = "data"
i18nDir = "i18n"
layoutDir = "layouts"
assetDir = "assets"
archeTypedir = "archetypes"
[caches]
[caches.getjson]
maxAge = "1s"
dir = "/cache/c"
`
p := newPathsSpec(t, afero.NewMemMapFs(), configStr)
caches, err := NewCaches(p)
c.Assert(err, qt.IsNil)
const cacheName = "getjson"
filenameData := func(i int) (string, string) {
data := fmt.Sprintf("data: %d", i)
filename := fmt.Sprintf("file%d", i)
return filename, data
}
var wg sync.WaitGroup
for i := 0; i < 50; i++ {
wg.Add(1)
go func(i int) {
defer wg.Done()
for j := 0; j < 20; j++ {
ca := caches.Get(cacheName)
c.Assert(ca, qt.Not(qt.IsNil))
filename, data := filenameData(i)
_, r, err := ca.GetOrCreate(filename, func() (io.ReadCloser, error) {
return hugio.ToReadCloser(strings.NewReader(data)), nil
})
c.Assert(err, qt.IsNil)
b, _ := ioutil.ReadAll(r)
r.Close()
c.Assert(string(b), qt.Equals, data)
// Trigger some expiration.
time.Sleep(50 * time.Millisecond)
}
}(i)
}
wg.Wait()
}
func TestFileCacheReadOrCreateErrorInRead(t *testing.T) {
t.Parallel()
c := qt.New(t)
var result string
rf := func(failLevel int) func(info ItemInfo, r io.ReadSeeker) error {
return func(info ItemInfo, r io.ReadSeeker) error {
if failLevel > 0 {
if failLevel > 1 {
return ErrFatal
}
return errors.New("fail")
}
b, _ := ioutil.ReadAll(r)
result = string(b)
return nil
}
}
bf := func(s string) func(info ItemInfo, w io.WriteCloser) error {
return func(info ItemInfo, w io.WriteCloser) error {
defer w.Close()
result = s
_, err := w.Write([]byte(s))
return err
}
}
cache := NewCache(afero.NewMemMapFs(), 100*time.Hour, 0, "")
const id = "a32"
_, err := cache.ReadOrCreate(id, rf(0), bf("v1"))
c.Assert(err, qt.IsNil)
c.Assert(result, qt.Equals, "v1")
_, err = cache.ReadOrCreate(id, rf(0), bf("v2"))
c.Assert(err, qt.IsNil)
c.Assert(result, qt.Equals, "v1")
_, err = cache.ReadOrCreate(id, rf(1), bf("v3"))
c.Assert(err, qt.IsNil)
c.Assert(result, qt.Equals, "v3")
_, err = cache.ReadOrCreate(id, rf(2), bf("v3"))
c.Assert(err, qt.Equals, ErrFatal)
}
func TestCleanID(t *testing.T) {
c := qt.New(t)
c.Assert(cleanID(filepath.FromSlash("/a/b//c.txt")), qt.Equals, filepath.FromSlash("a/b/c.txt"))
c.Assert(cleanID(filepath.FromSlash("a/b//c.txt")), qt.Equals, filepath.FromSlash("a/b/c.txt"))
}
func initConfig(fs afero.Fs, cfg config.Provider) error {
if _, err := langs.LoadLanguageSettings(cfg, nil); err != nil {
return err
}
modConfig, err := modules.DecodeConfig(cfg)
if err != nil {
return err
}
workingDir := cfg.GetString("workingDir")
themesDir := cfg.GetString("themesDir")
if !filepath.IsAbs(themesDir) {
themesDir = filepath.Join(workingDir, themesDir)
}
globAll := glob.MustCompile("**", '/')
modulesClient := modules.NewClient(modules.ClientConfig{
Fs: fs,
WorkingDir: workingDir,
ThemesDir: themesDir,
ModuleConfig: modConfig,
IgnoreVendor: globAll,
})
moduleConfig, err := modulesClient.Collect()
if err != nil {
return err
}
if err := modules.ApplyProjectConfigDefaults(cfg, moduleConfig.ActiveModules[len(moduleConfig.ActiveModules)-1]); err != nil {
return err
}
cfg.Set("allModules", moduleConfig.ActiveModules)
return nil
}
func newPathsSpec(t *testing.T, fs afero.Fs, configStr string) *helpers.PathSpec {
c := qt.New(t)
cfg, err := config.FromConfigString(configStr, "toml")
c.Assert(err, qt.IsNil)
initConfig(fs, cfg)
p, err := helpers.NewPathSpec(hugofs.NewFrom(fs, cfg), cfg, nil)
c.Assert(err, qt.IsNil)
return p
}
+78
View File
@@ -0,0 +1,78 @@
// Copyright 2018 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 namedmemcache provides a memory cache with a named lock. This is suitable
// for situations where creating the cached resource can be time consuming or otherwise
// resource hungry, or in situations where a "once only per key" is a requirement.
package namedmemcache
import (
"sync"
"github.com/BurntSushi/locker"
)
// Cache holds the cached values.
type Cache struct {
nlocker *locker.Locker
cache map[string]cacheEntry
mu sync.RWMutex
}
type cacheEntry struct {
value interface{}
err error
}
// New creates a new cache.
func New() *Cache {
return &Cache{
nlocker: locker.NewLocker(),
cache: make(map[string]cacheEntry),
}
}
// Clear clears the cache state.
func (c *Cache) Clear() {
c.mu.Lock()
defer c.mu.Unlock()
c.cache = make(map[string]cacheEntry)
c.nlocker = locker.NewLocker()
}
// GetOrCreate tries to get the value with the given cache key, if not found
// create will be called and cached.
// This method is thread safe. It also guarantees that the create func for a given
// key is invoked only once for this cache.
func (c *Cache) GetOrCreate(key string, create func() (interface{}, error)) (interface{}, error) {
c.mu.RLock()
entry, found := c.cache[key]
c.mu.RUnlock()
if found {
return entry.value, entry.err
}
c.nlocker.Lock(key)
defer c.nlocker.Unlock(key)
// Create it.
value, err := create()
c.mu.Lock()
c.cache[key] = cacheEntry{value: value, err: err}
c.mu.Unlock()
return value, err
}
+80
View File
@@ -0,0 +1,80 @@
// Copyright 2018 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 namedmemcache
import (
"fmt"
"sync"
"testing"
qt "github.com/frankban/quicktest"
)
func TestNamedCache(t *testing.T) {
t.Parallel()
c := qt.New(t)
cache := New()
counter := 0
create := func() (interface{}, error) {
counter++
return counter, nil
}
for i := 0; i < 5; i++ {
v1, err := cache.GetOrCreate("a1", create)
c.Assert(err, qt.IsNil)
c.Assert(v1, qt.Equals, 1)
v2, err := cache.GetOrCreate("a2", create)
c.Assert(err, qt.IsNil)
c.Assert(v2, qt.Equals, 2)
}
cache.Clear()
v3, err := cache.GetOrCreate("a2", create)
c.Assert(err, qt.IsNil)
c.Assert(v3, qt.Equals, 3)
}
func TestNamedCacheConcurrent(t *testing.T) {
t.Parallel()
c := qt.New(t)
var wg sync.WaitGroup
cache := New()
create := func(i int) func() (interface{}, error) {
return func() (interface{}, error) {
return i, nil
}
}
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
defer wg.Done()
for j := 0; j < 100; j++ {
id := fmt.Sprintf("id%d", j)
v, err := cache.GetOrCreate(id, create(j))
c.Assert(err, qt.IsNil)
c.Assert(v, qt.Equals, j)
}
}()
}
wg.Wait()
}
-99
View File
@@ -1,99 +0,0 @@
// Copyright 2017-present 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 cache
import (
"sync"
)
// Partition represents a cache partition where Load is the callback
// for when the partition is needed.
type Partition struct {
Key string
Load func() (map[string]interface{}, error)
}
// Lazy represents a lazily loaded cache.
type Lazy struct {
initSync sync.Once
initErr error
cache map[string]interface{}
load func() (map[string]interface{}, error)
}
// NewLazy creates a lazy cache with the given load func.
func NewLazy(load func() (map[string]interface{}, error)) *Lazy {
return &Lazy{load: load}
}
func (l *Lazy) init() error {
l.initSync.Do(func() {
c, err := l.load()
l.cache = c
l.initErr = err
})
return l.initErr
}
// Get initializes the cache if not already initialized, then looks up the
// given key.
func (l *Lazy) Get(key string) (interface{}, bool, error) {
l.init()
if l.initErr != nil {
return nil, false, l.initErr
}
v, found := l.cache[key]
return v, found, nil
}
// PartitionedLazyCache is a lazily loaded cache paritioned by a supplied string key.
type PartitionedLazyCache struct {
partitions map[string]*Lazy
}
// NewPartitionedLazyCache creates a new NewPartitionedLazyCache with the supplied
// partitions.
func NewPartitionedLazyCache(partitions ...Partition) *PartitionedLazyCache {
lazyPartitions := make(map[string]*Lazy, len(partitions))
for _, partition := range partitions {
lazyPartitions[partition.Key] = NewLazy(partition.Load)
}
cache := &PartitionedLazyCache{partitions: lazyPartitions}
return cache
}
// Get initializes the partition if not already done so, then looks up the given
// key in the given partition, returns nil if no value found.
func (c *PartitionedLazyCache) Get(partition, key string) (interface{}, error) {
p, found := c.partitions[partition]
if !found {
return nil, nil
}
v, found, err := p.Get(key)
if err != nil {
return nil, err
}
if found {
return v, nil
}
return nil, nil
}
-138
View File
@@ -1,138 +0,0 @@
// Copyright 2017-present 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 cache
import (
"errors"
"sync"
"testing"
"github.com/stretchr/testify/require"
)
func TestNewPartitionedLazyCache(t *testing.T) {
t.Parallel()
assert := require.New(t)
p1 := Partition{
Key: "p1",
Load: func() (map[string]interface{}, error) {
return map[string]interface{}{
"p1_1": "p1v1",
"p1_2": "p1v2",
"p1_nil": nil,
}, nil
},
}
p2 := Partition{
Key: "p2",
Load: func() (map[string]interface{}, error) {
return map[string]interface{}{
"p2_1": "p2v1",
"p2_2": "p2v2",
"p2_3": "p2v3",
}, nil
},
}
cache := NewPartitionedLazyCache(p1, p2)
v, err := cache.Get("p1", "p1_1")
assert.NoError(err)
assert.Equal("p1v1", v)
v, err = cache.Get("p1", "p2_1")
assert.NoError(err)
assert.Nil(v)
v, err = cache.Get("p1", "p1_nil")
assert.NoError(err)
assert.Nil(v)
v, err = cache.Get("p2", "p2_3")
assert.NoError(err)
assert.Equal("p2v3", v)
v, err = cache.Get("doesnotexist", "p1_1")
assert.NoError(err)
assert.Nil(v)
v, err = cache.Get("p1", "doesnotexist")
assert.NoError(err)
assert.Nil(v)
errorP := Partition{
Key: "p3",
Load: func() (map[string]interface{}, error) {
return nil, errors.New("Failed")
},
}
cache = NewPartitionedLazyCache(errorP)
v, err = cache.Get("p1", "doesnotexist")
assert.NoError(err)
assert.Nil(v)
_, err = cache.Get("p3", "doesnotexist")
assert.Error(err)
}
func TestConcurrentPartitionedLazyCache(t *testing.T) {
t.Parallel()
assert := require.New(t)
var wg sync.WaitGroup
p1 := Partition{
Key: "p1",
Load: func() (map[string]interface{}, error) {
return map[string]interface{}{
"p1_1": "p1v1",
"p1_2": "p1v2",
"p1_nil": nil,
}, nil
},
}
p2 := Partition{
Key: "p2",
Load: func() (map[string]interface{}, error) {
return map[string]interface{}{
"p2_1": "p2v1",
"p2_2": "p2v2",
"p2_3": "p2v3",
}, nil
},
}
cache := NewPartitionedLazyCache(p1, p2)
for i := 0; i < 100; i++ {
wg.Add(1)
go func() {
defer wg.Done()
for j := 0; j < 10; j++ {
v, err := cache.Get("p1", "p1_1")
assert.NoError(err)
assert.Equal("p1v1", v)
}
}()
}
wg.Wait()
}
+536
View File
@@ -0,0 +1,536 @@
// Copyright 2019 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 codegen contains helpers for code generation.
package codegen
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"os"
"path"
"path/filepath"
"reflect"
"regexp"
"sort"
"strings"
"sync"
)
// Make room for insertions
const weightWidth = 1000
// NewInspector creates a new Inspector given a source root.
func NewInspector(root string) *Inspector {
return &Inspector{ProjectRootDir: root}
}
// Inspector provides methods to help code generation. It uses a combination
// of reflection and source code AST to do the heavy lifting.
type Inspector struct {
ProjectRootDir string
init sync.Once
// Determines method order. Go's reflect sorts lexicographically, so
// we must parse the source to preserve this order.
methodWeight map[string]map[string]int
}
// MethodsFromTypes create a method set from the include slice, excluding any
// method in exclude.
func (c *Inspector) MethodsFromTypes(include []reflect.Type, exclude []reflect.Type) Methods {
c.parseSource()
var methods Methods
excludes := make(map[string]bool)
if len(exclude) > 0 {
for _, m := range c.MethodsFromTypes(exclude, nil) {
excludes[m.Name] = true
}
}
// There may be overlapping interfaces in types. Do a simple check for now.
seen := make(map[string]bool)
nameAndPackage := func(t reflect.Type) (string, string) {
var name, pkg string
isPointer := t.Kind() == reflect.Ptr
if isPointer {
t = t.Elem()
}
pkgPrefix := ""
if pkgPath := t.PkgPath(); pkgPath != "" {
pkgPath = strings.TrimSuffix(pkgPath, "/")
_, shortPath := path.Split(pkgPath)
pkgPrefix = shortPath + "."
pkg = pkgPath
}
name = t.Name()
if name == "" {
// interface{}
name = t.String()
}
if isPointer {
pkgPrefix = "*" + pkgPrefix
}
name = pkgPrefix + name
return name, pkg
}
for _, t := range include {
for i := 0; i < t.NumMethod(); i++ {
m := t.Method(i)
if excludes[m.Name] || seen[m.Name] {
continue
}
seen[m.Name] = true
if m.PkgPath != "" {
// Not exported
continue
}
numIn := m.Type.NumIn()
ownerName, _ := nameAndPackage(t)
method := Method{Owner: t, OwnerName: ownerName, Name: m.Name}
for i := 0; i < numIn; i++ {
in := m.Type.In(i)
name, pkg := nameAndPackage(in)
if pkg != "" {
method.Imports = append(method.Imports, pkg)
}
method.In = append(method.In, name)
}
numOut := m.Type.NumOut()
if numOut > 0 {
for i := 0; i < numOut; i++ {
out := m.Type.Out(i)
name, pkg := nameAndPackage(out)
if pkg != "" {
method.Imports = append(method.Imports, pkg)
}
method.Out = append(method.Out, name)
}
}
methods = append(methods, method)
}
}
sort.SliceStable(methods, func(i, j int) bool {
mi, mj := methods[i], methods[j]
wi := c.methodWeight[mi.OwnerName][mi.Name]
wj := c.methodWeight[mj.OwnerName][mj.Name]
if wi == wj {
return mi.Name < mj.Name
}
return wi < wj
})
return methods
}
func (c *Inspector) parseSource() {
c.init.Do(func() {
if !strings.Contains(c.ProjectRootDir, "hugo") {
panic("dir must be set to the Hugo root")
}
c.methodWeight = make(map[string]map[string]int)
dirExcludes := regexp.MustCompile("docs|examples")
fileExcludes := regexp.MustCompile("autogen")
var filenames []string
filepath.Walk(c.ProjectRootDir, func(path string, info os.FileInfo, err error) error {
if info.IsDir() {
if dirExcludes.MatchString(info.Name()) {
return filepath.SkipDir
}
}
if !strings.HasSuffix(path, ".go") || fileExcludes.MatchString(path) {
return nil
}
filenames = append(filenames, path)
return nil
})
for _, filename := range filenames {
pkg := c.packageFromPath(filename)
fset := token.NewFileSet()
node, err := parser.ParseFile(fset, filename, nil, parser.ParseComments)
if err != nil {
panic(err)
}
ast.Inspect(node, func(n ast.Node) bool {
switch t := n.(type) {
case *ast.TypeSpec:
if t.Name.IsExported() {
switch it := t.Type.(type) {
case *ast.InterfaceType:
iface := pkg + "." + t.Name.Name
methodNames := collectMethodsRecursive(pkg, it.Methods.List)
weights := make(map[string]int)
weight := weightWidth
for _, name := range methodNames {
weights[name] = weight
weight += weightWidth
}
c.methodWeight[iface] = weights
}
}
}
return true
})
}
// Complement
for _, v1 := range c.methodWeight {
for k2, w := range v1 {
if v, found := c.methodWeight[k2]; found {
for k3, v3 := range v {
v1[k3] = (v3 / weightWidth) + w
}
}
}
}
})
}
func (c *Inspector) packageFromPath(p string) string {
p = filepath.ToSlash(p)
base := path.Base(p)
if !strings.Contains(base, ".") {
return base
}
return path.Base(strings.TrimSuffix(p, base))
}
// Method holds enough information about it to recreate it.
type Method struct {
// The interface we extracted this method from.
Owner reflect.Type
// String version of the above, on the form PACKAGE.NAME, e.g.
// page.Page
OwnerName string
// Method name.
Name string
// Imports needed to satisfy the method signature.
Imports []string
// Argument types, including any package prefix, e.g. string, int, interface{},
// net.Url
In []string
// Return types.
Out []string
}
// Declaration creates a method declaration (without any body) for the given receiver.
func (m Method) Declaration(receiver string) string {
return fmt.Sprintf("func (%s %s) %s%s %s", receiverShort(receiver), receiver, m.Name, m.inStr(), m.outStr())
}
// DeclarationNamed creates a method declaration (without any body) for the given receiver
// with named return values.
func (m Method) DeclarationNamed(receiver string) string {
return fmt.Sprintf("func (%s %s) %s%s %s", receiverShort(receiver), receiver, m.Name, m.inStr(), m.outStrNamed())
}
// Delegate creates a delegate call string.
func (m Method) Delegate(receiver, delegate string) string {
ret := ""
if len(m.Out) > 0 {
ret = "return "
}
return fmt.Sprintf("%s%s.%s.%s%s", ret, receiverShort(receiver), delegate, m.Name, m.inOutStr())
}
func (m Method) String() string {
return m.Name + m.inStr() + " " + m.outStr() + "\n"
}
func (m Method) inOutStr() string {
if len(m.In) == 0 {
return "()"
}
args := make([]string, len(m.In))
for i := 0; i < len(args); i++ {
args[i] = fmt.Sprintf("arg%d", i)
}
return "(" + strings.Join(args, ", ") + ")"
}
func (m Method) inStr() string {
if len(m.In) == 0 {
return "()"
}
args := make([]string, len(m.In))
for i := 0; i < len(args); i++ {
args[i] = fmt.Sprintf("arg%d %s", i, m.In[i])
}
return "(" + strings.Join(args, ", ") + ")"
}
func (m Method) outStr() string {
if len(m.Out) == 0 {
return ""
}
if len(m.Out) == 1 {
return m.Out[0]
}
return "(" + strings.Join(m.Out, ", ") + ")"
}
func (m Method) outStrNamed() string {
if len(m.Out) == 0 {
return ""
}
outs := make([]string, len(m.Out))
for i := 0; i < len(outs); i++ {
outs[i] = fmt.Sprintf("o%d %s", i, m.Out[i])
}
return "(" + strings.Join(outs, ", ") + ")"
}
// Methods represents a list of methods for one or more interfaces.
// The order matches the defined order in their source file(s).
type Methods []Method
// Imports returns a sorted list of package imports needed to satisfy the
// signatures of all methods.
func (m Methods) Imports() []string {
var pkgImports []string
for _, method := range m {
pkgImports = append(pkgImports, method.Imports...)
}
if len(pkgImports) > 0 {
pkgImports = uniqueNonEmptyStrings(pkgImports)
sort.Strings(pkgImports)
}
return pkgImports
}
// ToMarshalJSON creates a MarshalJSON method for these methods. Any method name
// matching any of the regexps in excludes will be ignored.
func (m Methods) ToMarshalJSON(receiver, pkgPath string, excludes ...string) (string, []string) {
var sb strings.Builder
r := receiverShort(receiver)
what := firstToUpper(trimAsterisk(receiver))
pgkName := path.Base(pkgPath)
fmt.Fprintf(&sb, "func Marshal%sToJSON(%s %s) ([]byte, error) {\n", what, r, receiver)
var methods Methods
excludeRes := make([]*regexp.Regexp, len(excludes))
for i, exclude := range excludes {
excludeRes[i] = regexp.MustCompile(exclude)
}
for _, method := range m {
// Exclude methods with arguments and incompatible return values
if len(method.In) > 0 || len(method.Out) == 0 || len(method.Out) > 2 {
continue
}
if len(method.Out) == 2 {
if method.Out[1] != "error" {
continue
}
}
for _, re := range excludeRes {
if re.MatchString(method.Name) {
continue
}
}
methods = append(methods, method)
}
for _, method := range methods {
varn := varName(method.Name)
if len(method.Out) == 1 {
fmt.Fprintf(&sb, "\t%s := %s.%s()\n", varn, r, method.Name)
} else {
fmt.Fprintf(&sb, "\t%s, err := %s.%s()\n", varn, r, method.Name)
fmt.Fprint(&sb, "\tif err != nil {\n\t\treturn nil, err\n\t}\n")
}
}
fmt.Fprint(&sb, "\n\ts := struct {\n")
for _, method := range methods {
fmt.Fprintf(&sb, "\t\t%s %s\n", method.Name, typeName(method.Out[0], pgkName))
}
fmt.Fprint(&sb, "\n\t}{\n")
for _, method := range methods {
varn := varName(method.Name)
fmt.Fprintf(&sb, "\t\t%s: %s,\n", method.Name, varn)
}
fmt.Fprint(&sb, "\n\t}\n\n")
fmt.Fprint(&sb, "\treturn json.Marshal(&s)\n}")
pkgImports := append(methods.Imports(), "encoding/json")
if pkgPath != "" {
// Exclude self
for i, pkgImp := range pkgImports {
if pkgImp == pkgPath {
pkgImports = append(pkgImports[:i], pkgImports[i+1:]...)
}
}
}
return sb.String(), pkgImports
}
func collectMethodsRecursive(pkg string, f []*ast.Field) []string {
var methodNames []string
for _, m := range f {
if m.Names != nil {
methodNames = append(methodNames, m.Names[0].Name)
continue
}
if ident, ok := m.Type.(*ast.Ident); ok && ident.Obj != nil {
// Embedded interface
methodNames = append(
methodNames,
collectMethodsRecursive(
pkg,
ident.Obj.Decl.(*ast.TypeSpec).Type.(*ast.InterfaceType).Methods.List)...)
} else {
// Embedded, but in a different file/package. Return the
// package.Name and deal with that later.
name := packageName(m.Type)
if !strings.Contains(name, ".") {
// Assume current package
name = pkg + "." + name
}
methodNames = append(methodNames, name)
}
}
return methodNames
}
func firstToLower(name string) string {
return strings.ToLower(name[:1]) + name[1:]
}
func firstToUpper(name string) string {
return strings.ToUpper(name[:1]) + name[1:]
}
func packageName(e ast.Expr) string {
switch tp := e.(type) {
case *ast.Ident:
return tp.Name
case *ast.SelectorExpr:
return fmt.Sprintf("%s.%s", packageName(tp.X), packageName(tp.Sel))
}
return ""
}
func receiverShort(receiver string) string {
return strings.ToLower(trimAsterisk(receiver))[:1]
}
func trimAsterisk(name string) string {
return strings.TrimPrefix(name, "*")
}
func typeName(name, pkg string) string {
return strings.TrimPrefix(name, pkg+".")
}
func uniqueNonEmptyStrings(s []string) []string {
var unique []string
set := map[string]interface{}{}
for _, val := range s {
if val == "" {
continue
}
if _, ok := set[val]; !ok {
unique = append(unique, val)
set[val] = val
}
}
return unique
}
func varName(name string) string {
name = firstToLower(name)
// Adjust some reserved keywords, see https://golang.org/ref/spec#Keywords
switch name {
case "type":
name = "typ"
case "package":
name = "pkg"
// Not reserved, but syntax highlighters has it as a keyword.
case "len":
name = "length"
}
return name
}
+20
View File
@@ -0,0 +1,20 @@
// Copyright 2019 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 codegen
type IEmbed interface {
MethodEmbed3(s string) string
MethodEmbed1() string
MethodEmbed2()
}
+96
View File
@@ -0,0 +1,96 @@
// Copyright 2019 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 codegen
import (
"fmt"
"net"
"os"
"reflect"
"testing"
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/common/herrors"
)
func TestMethods(t *testing.T) {
var (
zeroIE = reflect.TypeOf((*IEmbed)(nil)).Elem()
zeroIEOnly = reflect.TypeOf((*IEOnly)(nil)).Elem()
zeroI = reflect.TypeOf((*I)(nil)).Elem()
)
dir, _ := os.Getwd()
insp := NewInspector(dir)
t.Run("MethodsFromTypes", func(t *testing.T) {
c := qt.New(t)
methods := insp.MethodsFromTypes([]reflect.Type{zeroI}, nil)
methodsStr := fmt.Sprint(methods)
c.Assert(methodsStr, qt.Contains, "Method1(arg0 herrors.ErrorContext)")
c.Assert(methodsStr, qt.Contains, "Method7() interface {}")
c.Assert(methodsStr, qt.Contains, "Method0() string\n Method4() string")
c.Assert(methodsStr, qt.Contains, "MethodEmbed3(arg0 string) string\n MethodEmbed1() string")
c.Assert(methods.Imports(), qt.Contains, "github.com/gohugoio/hugo/common/herrors")
})
t.Run("EmbedOnly", func(t *testing.T) {
c := qt.New(t)
methods := insp.MethodsFromTypes([]reflect.Type{zeroIEOnly}, nil)
methodsStr := fmt.Sprint(methods)
c.Assert(methodsStr, qt.Contains, "MethodEmbed3(arg0 string) string")
})
t.Run("ToMarshalJSON", func(t *testing.T) {
c := qt.New(t)
m, pkg := insp.MethodsFromTypes(
[]reflect.Type{zeroI},
[]reflect.Type{zeroIE}).ToMarshalJSON("*page", "page")
c.Assert(m, qt.Contains, "method6 := p.Method6()")
c.Assert(m, qt.Contains, "Method0: method0,")
c.Assert(m, qt.Contains, "return json.Marshal(&s)")
c.Assert(pkg, qt.Contains, "github.com/gohugoio/hugo/common/herrors")
c.Assert(pkg, qt.Contains, "encoding/json")
fmt.Println(pkg)
})
}
type I interface {
IEmbed
Method0() string
Method4() string
Method1(myerr herrors.ErrorContext)
Method3(myint int, mystring string)
Method5() (string, error)
Method6() *net.IP
Method7() interface{}
Method8() herrors.ErrorContext
method2()
method9() os.FileInfo
}
type IEOnly interface {
IEmbed
}
-115
View File
@@ -1,115 +0,0 @@
// Copyright 2015 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 (
"os"
"runtime"
"runtime/pprof"
"time"
"github.com/spf13/cobra"
jww "github.com/spf13/jwalterweatherman"
)
type benchmarkCmd struct {
benchmarkTimes int
cpuProfileFile string
memProfileFile string
*baseBuilderCmd
}
func (b *commandsBuilder) newBenchmarkCmd() *benchmarkCmd {
cmd := &cobra.Command{
Use: "benchmark",
Short: "Benchmark Hugo by building a site a number of times.",
Long: `Hugo can build a site many times over and analyze the running process
creating a benchmark.`,
}
c := &benchmarkCmd{baseBuilderCmd: b.newBuilderCmd(cmd)}
cmd.Flags().StringVar(&c.cpuProfileFile, "cpuprofile", "", "path/filename for the CPU profile file")
cmd.Flags().StringVar(&c.memProfileFile, "memprofile", "", "path/filename for the memory profile file")
cmd.Flags().IntVarP(&c.benchmarkTimes, "count", "n", 13, "number of times to build the site")
cmd.Flags().Bool("renderToMemory", false, "render to memory (only useful for benchmark testing)")
cmd.RunE = c.benchmark
return c
}
func (c *benchmarkCmd) benchmark(cmd *cobra.Command, args []string) error {
cfgInit := func(c *commandeer) error {
return nil
}
comm, err := initializeConfig(true, false, &c.hugoBuilderCommon, c, cfgInit)
if err != nil {
return err
}
var memProf *os.File
if c.memProfileFile != "" {
memProf, err = os.Create(c.memProfileFile)
if err != nil {
return err
}
}
var cpuProf *os.File
if c.cpuProfileFile != "" {
cpuProf, err = os.Create(c.cpuProfileFile)
if err != nil {
return err
}
}
var memStats runtime.MemStats
runtime.ReadMemStats(&memStats)
memAllocated := memStats.TotalAlloc
mallocs := memStats.Mallocs
if cpuProf != nil {
pprof.StartCPUProfile(cpuProf)
}
t := time.Now()
for i := 0; i < c.benchmarkTimes; i++ {
if err = comm.resetAndBuildSites(); err != nil {
return err
}
}
totalTime := time.Since(t)
if memProf != nil {
pprof.WriteHeapProfile(memProf)
memProf.Close()
}
if cpuProf != nil {
pprof.StopCPUProfile()
cpuProf.Close()
}
runtime.ReadMemStats(&memStats)
totalMemAllocated := memStats.TotalAlloc - memAllocated
totalMallocs := memStats.Mallocs - mallocs
jww.FEEDBACK.Println()
jww.FEEDBACK.Printf("Average time per operation: %vms\n", int(1000*totalTime.Seconds()/float64(c.benchmarkTimes)))
jww.FEEDBACK.Printf("Average memory allocated per operation: %vkB\n", totalMemAllocated/uint64(c.benchmarkTimes)/1024)
jww.FEEDBACK.Printf("Average allocations per operation: %v\n", totalMallocs/uint64(c.benchmarkTimes))
return nil
}
+5 -4
View File
@@ -26,9 +26,10 @@ type checkCmd struct {
}
func newCheckCmd() *checkCmd {
return &checkCmd{baseCmd: &baseCmd{cmd: &cobra.Command{
Use: "check",
Short: "Contains some verification checks",
},
return &checkCmd{baseCmd: &baseCmd{
cmd: &cobra.Command{
Use: "check",
Short: "Contains some verification checks",
},
}}
}
+5 -4
View File
@@ -24,10 +24,11 @@ type checkCmd struct {
}
func newCheckCmd() *checkCmd {
cc := &checkCmd{baseCmd: &baseCmd{cmd: &cobra.Command{
Use: "check",
Short: "Contains some verification checks",
},
cc := &checkCmd{baseCmd: &baseCmd{
cmd: &cobra.Command{
Use: "check",
Short: "Contains some verification checks",
},
}}
cc.cmd.AddCommand(newLimitCmd().getCommand())
+166 -66
View File
@@ -1,4 +1,4 @@
// Copyright 2018 The Hugo Authors. All rights reserved.
// Copyright 2019 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.
@@ -14,19 +14,31 @@
package commands
import (
"bytes"
"errors"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"sync"
"time"
hconfig "github.com/gohugoio/hugo/config"
"golang.org/x/sync/semaphore"
"github.com/gohugoio/hugo/common/herrors"
"github.com/gohugoio/hugo/common/hugo"
jww "github.com/spf13/jwalterweatherman"
"github.com/gohugoio/hugo/common/loggers"
"github.com/gohugoio/hugo/config"
"github.com/spf13/cobra"
"github.com/spf13/afero"
"github.com/gohugoio/hugo/hugolib"
"github.com/spf13/afero"
"github.com/bep/debounce"
"github.com/gohugoio/hugo/common/types"
@@ -38,13 +50,22 @@ import (
type commandeerHugoState struct {
*deps.DepsCfg
hugo *hugolib.HugoSites
fsCreate sync.Once
hugoSites *hugolib.HugoSites
fsCreate sync.Once
created chan struct{}
}
type commandeer struct {
*commandeerHugoState
logger loggers.Logger
serverConfig *config.Server
// Loading state
mustHaveConfigFile bool
failOnInitErr bool
running bool
// Currently only set when in "fast render mode". But it seems to
// be fast enough that we could maybe just add it for all server modes.
changeDetector *fileChangeDetector
@@ -57,7 +78,7 @@ type commandeer struct {
visitedURLs *types.EvictingStringQueue
doWithCommandeer func(c *commandeer) error
cfgInit func(c *commandeer) error
// We watch these for changes.
configFiles []string
@@ -68,8 +89,59 @@ type commandeer struct {
serverPorts []int
languagesConfigured bool
languages langs.Languages
doLiveReload bool
fastRenderMode bool
showErrorInBrowser bool
wasError bool
configured bool
paused bool
fullRebuildSem *semaphore.Weighted
// Any error from the last build.
buildErr error
}
func newCommandeerHugoState() *commandeerHugoState {
return &commandeerHugoState{
created: make(chan struct{}),
}
}
func (c *commandeerHugoState) hugo() *hugolib.HugoSites {
<-c.created
return c.hugoSites
}
func (c *commandeer) errCount() int {
return int(c.logger.LogCounters().ErrorCounter.Count())
}
func (c *commandeer) getErrorWithContext() interface{} {
errCount := c.errCount()
if errCount == 0 {
return nil
}
m := make(map[string]interface{})
m["Error"] = errors.New(removeErrorPrefixFromLog(c.logger.Errors()))
m["Version"] = hugo.BuildVersionString()
fe := herrors.UnwrapErrorWithFileContext(c.buildErr)
if fe != nil {
m["File"] = fe
}
if c.h.verbose {
var b bytes.Buffer
herrors.FprintStackTraceFromErr(&b, c.buildErr)
m["StackTrace"] = b.String()
}
return m
}
func (c *commandeer) Set(key string, value interface{}) {
@@ -86,26 +158,39 @@ func (c *commandeer) initFs(fs *hugofs.Fs) error {
return nil
}
func newCommandeer(mustHaveConfigFile, running bool, h *hugoBuilderCommon, f flagsToConfigHandler, doWithCommandeer func(c *commandeer) error, subCmdVs ...*cobra.Command) (*commandeer, error) {
func newCommandeer(mustHaveConfigFile, failOnInitErr, running bool, h *hugoBuilderCommon, f flagsToConfigHandler, cfgInit func(c *commandeer) error, subCmdVs ...*cobra.Command) (*commandeer, error) {
var rebuildDebouncer func(f func())
if running {
// The time value used is tested with mass content replacements in a fairly big Hugo site.
// It is better to wait for some seconds in those cases rather than get flooded
// with rebuilds.
rebuildDebouncer, _, _ = debounce.New(4 * time.Second)
rebuildDebouncer = debounce.New(4 * time.Second)
}
out := ioutil.Discard
if !h.quiet {
out = os.Stdout
}
c := &commandeer{
h: h,
ftch: f,
commandeerHugoState: &commandeerHugoState{},
doWithCommandeer: doWithCommandeer,
commandeerHugoState: newCommandeerHugoState(),
cfgInit: cfgInit,
visitedURLs: types.NewEvictingStringQueue(10),
debounce: rebuildDebouncer,
fullRebuildSem: semaphore.NewWeighted(1),
// Init state
mustHaveConfigFile: mustHaveConfigFile,
failOnInitErr: failOnInitErr,
running: running,
// This will be replaced later, but we need something to log to before the configuration is read.
logger: loggers.NewLogger(jww.LevelWarn, jww.LevelError, out, ioutil.Discard, running),
}
return c, c.loadConfig(mustHaveConfigFile, running)
return c, c.loadConfig()
}
type fileChangeDetector struct {
@@ -170,15 +255,19 @@ func (f *fileChangeDetector) PrepareNew() {
f.current = make(map[string]string)
}
func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
func (c *commandeer) loadConfig() error {
if c.DepsCfg == nil {
c.DepsCfg = &deps.DepsCfg{}
}
if c.logger != nil {
// Truncate the error log if this is a reload.
c.logger.Reset()
}
cfg := c.DepsCfg
c.configured = false
cfg.Running = running
cfg.Running = c.running
var dir string
if c.h.source != "" {
@@ -192,39 +281,56 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
sourceFs = c.DepsCfg.Fs.Source
}
doWithConfig := func(cfg config.Provider) error {
environment := c.h.getEnvironment(c.running)
doWithConfig := func(cfg config.Provider) error {
if c.ftch != nil {
c.ftch.flagsToConfig(cfg)
}
cfg.Set("workingDir", dir)
cfg.Set("environment", environment)
return nil
}
doWithCommandeer := func(cfg config.Provider) error {
cfgSetAndInit := func(cfg config.Provider) error {
c.Cfg = cfg
if c.doWithCommandeer == nil {
if c.cfgInit == nil {
return nil
}
err := c.doWithCommandeer(c)
err := c.cfgInit(c)
return err
}
configPath := c.h.source
if configPath == "" {
configPath = dir
}
config, configFiles, err := hugolib.LoadConfig(
hugolib.ConfigSourceDescriptor{Fs: sourceFs, Path: c.h.source, WorkingDir: dir, Filename: c.h.cfgFile},
doWithCommandeer,
hugolib.ConfigSourceDescriptor{
Fs: sourceFs,
Logger: c.logger,
Path: configPath,
WorkingDir: dir,
Filename: c.h.cfgFile,
AbsConfigDir: c.h.getConfigDir(dir),
Environment: environment,
},
cfgSetAndInit,
doWithConfig)
if err != nil {
if mustHaveConfigFile {
// We should improve the error handling here,
// but with hugo mod init and similar there is a chicken and egg situation
// with modules already configured in config.toml, so ignore those errors.
if c.mustHaveConfigFile || (c.failOnInitErr && !moduleNotFoundRe.MatchString(err.Error())) {
return err
} else {
// Just make it a warning.
c.logger.Warnln(err)
}
if err != hugolib.ErrNoConfigFile {
return err
}
} else if c.mustHaveConfigFile && len(configFiles) == 0 {
return hugolib.ErrNoConfigFile
}
c.configFiles = configFiles
@@ -234,10 +340,15 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
c.languages = l
}
// Set some commonly used flags
c.doLiveReload = c.running && !c.Cfg.GetBool("disableLiveReload")
c.fastRenderMode = c.doLiveReload && !c.Cfg.GetBool("disableFastRender")
c.showErrorInBrowser = c.doLiveReload && !c.Cfg.GetBool("disableBrowserError")
// This is potentially double work, but we need to do this one more time now
// that all the languages have been configured.
if c.doWithCommandeer != nil {
if err := c.doWithCommandeer(c); err != nil {
if c.cfgInit != nil {
if err := c.cfgInit(c); err != nil {
return err
}
}
@@ -248,6 +359,11 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
}
cfg.Logger = logger
c.logger = logger
c.serverConfig, err = hconfig.DecodeServer(cfg.Cfg)
if err != nil {
return err
}
createMemFs := config.GetBool("renderToMemory")
@@ -267,10 +383,7 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
fs.Destination = new(afero.MemMapFs)
}
doLiveReload := !c.h.buildWatch && !config.GetBool("disableLiveReload")
fastRenderMode := doLiveReload && !config.GetBool("disableFastRender")
if fastRenderMode {
if c.fastRenderMode {
// For now, fast render mode only. It should, however, be fast enough
// for the full variant, too.
changeDetector := &fileChangeDetector{
@@ -279,58 +392,45 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
// to make that decision.
irrelevantRe: regexp.MustCompile(`\.map$`),
}
changeDetector.PrepareNew()
fs.Destination = hugofs.NewHashingFs(fs.Destination, changeDetector)
c.changeDetector = changeDetector
}
if c.Cfg.GetBool("logPathWarnings") {
fs.Destination = hugofs.NewCreateCountingFs(fs.Destination)
}
// To debug hard-to-find path issues.
// fs.Destination = hugofs.NewStacktracerFs(fs.Destination, `fr/fr`)
err = c.initFs(fs)
if err != nil {
close(c.created)
return
}
var h *hugolib.HugoSites
h, err = hugolib.NewHugoSites(*c.DepsCfg)
c.hugo = h
var createErr error
h, createErr = hugolib.NewHugoSites(*c.DepsCfg)
if h == nil || c.failOnInitErr {
err = createErr
}
c.hugoSites = h
close(c.created)
})
if err != nil {
return err
}
cacheDir := config.GetString("cacheDir")
if cacheDir != "" {
if helpers.FilePathSeparator != cacheDir[len(cacheDir)-1:] {
cacheDir = cacheDir + helpers.FilePathSeparator
}
isDir, err := helpers.DirExists(cacheDir, sourceFs)
checkErr(cfg.Logger, err)
if !isDir {
mkdir(cacheDir)
}
config.Set("cacheDir", cacheDir)
} else {
config.Set("cacheDir", helpers.GetTempDir("hugo_cache", sourceFs))
}
cfg.Logger.INFO.Println("Using config file:", config.ConfigFileUsed())
themeDir := c.hugo.PathSpec.GetFirstThemeDir()
if themeDir != "" {
if _, err := sourceFs.Stat(themeDir); os.IsNotExist(err) {
return newSystemError("Unable to find theme Directory:", themeDir)
}
}
themeVersionMismatch, minVersion := c.isThemeVsHugoVersionMismatch(sourceFs)
if themeVersionMismatch {
cfg.Logger.ERROR.Printf("Current theme does not support Hugo version %s. Minimum version required is %s\n",
helpers.CurrentHugoVersion.ReleaseVersion(), minVersion)
cacheDir, err := helpers.GetCacheDir(sourceFs, config)
if err != nil {
return err
}
config.Set("cacheDir", cacheDir)
return nil
}
+116 -55
View File
@@ -1,4 +1,4 @@
// Copyright 2017 The Hugo Authors. All rights reserved.
// Copyright 2019 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.
@@ -14,14 +14,17 @@
package commands
import (
"fmt"
"os"
"time"
"github.com/gohugoio/hugo/hugolib/paths"
"github.com/gohugoio/hugo/common/hugo"
"github.com/gohugoio/hugo/common/loggers"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/helpers"
"github.com/spf13/cobra"
jww "github.com/spf13/jwalterweatherman"
"github.com/spf13/nitro"
)
type commandsBuilder struct {
@@ -44,15 +47,16 @@ func (b *commandsBuilder) addAll() *commandsBuilder {
b.newServerCmd(),
newVersionCmd(),
newEnvCmd(),
newConfigCmd(),
b.newConfigCmd(),
newCheckCmd(),
b.newBenchmarkCmd(),
newConvertCmd(),
newNewCmd(),
newListCmd(),
b.newDeployCmd(),
b.newConvertCmd(),
b.newNewCmd(),
b.newListCmd(),
newImportCmd(),
newGenCmd(),
createReleaser(),
b.newModCmd(),
)
return b
@@ -82,14 +86,15 @@ var _ commandsBuilderGetter = (*baseBuilderCmd)(nil)
// Used in tests.
type commandsBuilderGetter interface {
getCmmandsBuilder() *commandsBuilder
getCommandsBuilder() *commandsBuilder
}
type baseBuilderCmd struct {
*baseCmd
*commandsBuilder
}
func (b *baseBuilderCmd) getCmmandsBuilder() *commandsBuilder {
func (b *baseBuilderCmd) getCommandsBuilder() *commandsBuilder {
return b.commandsBuilder
}
@@ -107,6 +112,12 @@ func (b *commandsBuilder) newBuilderCmd(cmd *cobra.Command) *baseBuilderCmd {
return bcmd
}
func (b *commandsBuilder) newBuilderBasicCmd(cmd *cobra.Command) *baseBuilderCmd {
bcmd := &baseBuilderCmd{commandsBuilder: b, baseCmd: &baseCmd{cmd: cmd}}
bcmd.hugoBuilderCommon.handleCommonBuilderFlags(cmd)
return bcmd
}
func (c *baseCmd) flagsToConfig(cfg config.Provider) {
initializeFlags(c.cmd, cfg)
}
@@ -128,7 +139,6 @@ func (c *nilCommand) getCommand() *cobra.Command {
}
func (c *nilCommand) flagsToConfig(cfg config.Provider) {
}
func (b *commandsBuilder) newHugoCmd() *hugoCmd {
@@ -144,6 +154,7 @@ built with love by spf13 and friends in Go.
Complete documentation is available at http://gohugo.io/.`,
RunE: func(cmd *cobra.Command, args []string) error {
defer cc.timeTrack(time.Now(), "Total")
cfgInit := func(c *commandeer) error {
if cc.buildWatch {
c.Set("disableLiveReload", true)
@@ -151,22 +162,30 @@ Complete documentation is available at http://gohugo.io/.`,
return nil
}
c, err := initializeConfig(true, cc.buildWatch, &cc.hugoBuilderCommon, cc, cfgInit)
// prevent cobra printing error so it can be handled here (before the timeTrack prints)
cmd.SilenceErrors = true
c, err := initializeConfig(true, true, cc.buildWatch, &cc.hugoBuilderCommon, cc, cfgInit)
if err != nil {
cmd.PrintErrln("Error:", err.Error())
return err
}
cc.c = c
return c.build()
err = c.build()
if err != nil {
cmd.PrintErrln("Error:", err.Error())
}
return err
},
})
cc.cmd.PersistentFlags().StringVar(&cc.cfgFile, "config", "", "config file (default is path/config.yaml|json|toml)")
cc.cmd.PersistentFlags().StringVar(&cc.cfgDir, "configDir", "config", "config dir")
cc.cmd.PersistentFlags().BoolVar(&cc.quiet, "quiet", false, "build in quiet mode")
// Set bash-completion
validConfigFilenames := []string{"json", "js", "yaml", "yml", "toml", "tml"}
_ = cc.cmd.PersistentFlags().SetAnnotation("config", cobra.BashCompFilenameExt, validConfigFilenames)
_ = cc.cmd.PersistentFlags().SetAnnotation("config", cobra.BashCompFilenameExt, config.ValidConfigFileExtensions)
cc.cmd.PersistentFlags().BoolVarP(&cc.verbose, "verbose", "v", false, "verbose output")
cc.cmd.PersistentFlags().BoolVarP(&cc.debug, "debug", "", false, "debug output")
@@ -188,13 +207,22 @@ Complete documentation is available at http://gohugo.io/.`,
}
type hugoBuilderCommon struct {
source string
baseURL string
source string
baseURL string
environment string
buildWatch bool
poll string
gc bool
// Profile flags (for debugging of performance problems)
cpuprofile string
memprofile string
mutexprofile string
traceprofile string
printm bool
// TODO(bep) var vs string
logging bool
verbose bool
@@ -203,40 +231,99 @@ type hugoBuilderCommon struct {
quiet bool
cfgFile string
cfgDir string
logFile string
}
func (cc *hugoBuilderCommon) timeTrack(start time.Time, name string) {
if cc.quiet {
return
}
elapsed := time.Since(start)
fmt.Printf("%s in %v ms\n", name, int(1000*elapsed.Seconds()))
}
func (cc *hugoBuilderCommon) getConfigDir(baseDir string) string {
if cc.cfgDir != "" {
return paths.AbsPathify(baseDir, cc.cfgDir)
}
if v, found := os.LookupEnv("HUGO_CONFIGDIR"); found {
return paths.AbsPathify(baseDir, v)
}
return paths.AbsPathify(baseDir, "config")
}
func (cc *hugoBuilderCommon) getEnvironment(isServer bool) string {
if cc.environment != "" {
return cc.environment
}
if v, found := os.LookupEnv("HUGO_ENVIRONMENT"); found {
return v
}
// Used by Netlify and Forestry
if v, found := os.LookupEnv("HUGO_ENV"); found {
return v
}
if isServer {
return hugo.EnvironmentDevelopment
}
return hugo.EnvironmentProduction
}
func (cc *hugoBuilderCommon) handleCommonBuilderFlags(cmd *cobra.Command) {
cmd.PersistentFlags().StringVarP(&cc.source, "source", "s", "", "filesystem path to read files relative from")
cmd.PersistentFlags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{})
cmd.PersistentFlags().StringVarP(&cc.environment, "environment", "e", "", "build environment")
cmd.PersistentFlags().StringP("themesDir", "", "", "filesystem path to themes directory")
cmd.PersistentFlags().BoolP("ignoreVendor", "", false, "ignores any _vendor directory")
cmd.PersistentFlags().StringP("ignoreVendorPaths", "", "", "ignores any _vendor for module paths matching the given Glob pattern")
}
func (cc *hugoBuilderCommon) handleFlags(cmd *cobra.Command) {
cc.handleCommonBuilderFlags(cmd)
cmd.Flags().Bool("cleanDestinationDir", false, "remove files from destination not found in static directories")
cmd.Flags().BoolP("buildDrafts", "D", false, "include content marked as draft")
cmd.Flags().BoolP("buildFuture", "F", false, "include content with publishdate in the future")
cmd.Flags().BoolP("buildExpired", "E", false, "include expired content")
cmd.Flags().StringVarP(&cc.source, "source", "s", "", "filesystem path to read files relative from")
cmd.Flags().StringP("contentDir", "c", "", "filesystem path to content directory")
cmd.Flags().StringP("layoutDir", "l", "", "filesystem path to layout directory")
cmd.Flags().StringP("cacheDir", "", "", "filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/")
cmd.Flags().BoolP("ignoreCache", "", false, "ignores the cache directory")
cmd.Flags().StringP("destination", "d", "", "filesystem path to write files to")
cmd.Flags().StringP("theme", "t", "", "theme to use (located in /themes/THEMENAME/)")
cmd.Flags().StringP("themesDir", "", "", "filesystem path to themes directory")
cmd.Flags().Bool("uglyURLs", false, "(deprecated) if true, use /filename.html instead of /filename/")
cmd.Flags().Bool("canonifyURLs", false, "(deprecated) if true, all relative URLs will be canonicalized using baseURL")
cmd.Flags().StringSliceP("theme", "t", []string{}, "themes to use (located in /themes/THEMENAME/)")
cmd.Flags().StringVarP(&cc.baseURL, "baseURL", "b", "", "hostname (and path) to the root, e.g. http://spf13.com/")
cmd.Flags().Bool("enableGitInfo", false, "add Git revision, date and author info to the pages")
cmd.Flags().BoolVar(&cc.gc, "gc", false, "enable to run some cleanup tasks (remove unused cache files) after the build")
cmd.Flags().StringVar(&cc.poll, "poll", "", "set this to a poll interval, e.g --poll 700ms, to use a poll based approach to watch for file system changes")
cmd.Flags().BoolVar(&nitro.AnalysisOn, "stepAnalysis", false, "display memory and timing of different steps of the program")
cmd.Flags().Bool("templateMetrics", false, "display metrics about template executions")
cmd.Flags().Bool("templateMetricsHints", false, "calculate some improvement hints when combined with --templateMetrics")
cmd.Flags().Bool("pluralizeListTitles", true, "(deprecated) pluralize titles in lists using inflect")
cmd.Flags().Bool("preserveTaxonomyNames", false, `(deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")`)
cmd.Flags().BoolP("forceSyncStatic", "", false, "copy all files when static is changed.")
cmd.Flags().BoolP("noTimes", "", false, "don't sync modification time of files")
cmd.Flags().BoolP("noChmod", "", false, "don't sync permission mode of files")
cmd.Flags().BoolP("i18n-warnings", "", false, "print missing translations")
cmd.Flags().BoolP("path-warnings", "", false, "print warnings on duplicate target paths etc.")
cmd.Flags().StringVarP(&cc.cpuprofile, "profile-cpu", "", "", "write cpu profile to `file`")
cmd.Flags().StringVarP(&cc.memprofile, "profile-mem", "", "", "write memory profile to `file`")
cmd.Flags().BoolVarP(&cc.printm, "print-mem", "", false, "print memory usage to screen at intervals")
cmd.Flags().StringVarP(&cc.mutexprofile, "profile-mutex", "", "", "write Mutex profile to `file`")
cmd.Flags().StringVarP(&cc.traceprofile, "trace", "", "", "write trace to `file` (not useful in general)")
// Hide these for now.
cmd.Flags().MarkHidden("profile-cpu")
cmd.Flags().MarkHidden("profile-mem")
cmd.Flags().MarkHidden("profile-mutex")
cmd.Flags().StringSlice("disableKinds", []string{}, "disable different kind of pages (home, RSS etc.)")
cmd.Flags().Bool("minify", false, "minify any supported output format (HTML, XML etc.)")
// Set bash-completion.
// Each flag must first be defined before using the SetAnnotation() call.
_ = cmd.Flags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{})
@@ -245,38 +332,12 @@ func (cc *hugoBuilderCommon) handleFlags(cmd *cobra.Command) {
_ = cmd.Flags().SetAnnotation("theme", cobra.BashCompSubdirsInDir, []string{"themes"})
}
func checkErr(logger *jww.Notepad, err error, s ...string) {
func checkErr(logger loggers.Logger, err error, s ...string) {
if err == nil {
return
}
if len(s) == 0 {
logger.CRITICAL.Println(err)
return
}
for _, message := range s {
logger.ERROR.Println(message)
}
logger.ERROR.Println(err)
}
func stopOnErr(logger *jww.Notepad, err error, s ...string) {
if err == nil {
return
}
defer os.Exit(-1)
if len(s) == 0 {
newMessage := err.Error()
// Printing an empty string results in a error with
// no message, no bueno.
if newMessage != "" {
logger.CRITICAL.Println(newMessage)
}
}
for _, message := range s {
if message != "" {
logger.CRITICAL.Println(message)
}
logger.Errorln(message)
}
logger.Errorln(err)
}
+269 -112
View File
@@ -1,4 +1,4 @@
// Copyright 2018 The Hugo Authors. All rights reserved.
// Copyright 2019 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.
@@ -20,132 +20,256 @@ import (
"path/filepath"
"testing"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/gohugoio/hugo/config"
"github.com/stretchr/testify/require"
"github.com/gohugoio/hugo/htesting"
"github.com/spf13/afero"
"github.com/gohugoio/hugo/hugofs"
"github.com/gohugoio/hugo/common/types"
"github.com/spf13/cobra"
qt "github.com/frankban/quicktest"
)
func TestExecute(t *testing.T) {
c := qt.New(t)
assert := require.New(t)
createSite := func(c *qt.C) (string, func()) {
dir, clean, err := createSimpleTestSite(t, testSiteConfig{})
c.Assert(err, qt.IsNil)
return dir, clean
}
dir, err := createSimpleTestSite(t)
assert.NoError(err)
c.Run("hugo", func(c *qt.C) {
dir, clean := createSite(c)
defer clean()
resp := Execute([]string{"-s=" + dir})
c.Assert(resp.Err, qt.IsNil)
result := resp.Result
c.Assert(len(result.Sites) == 1, qt.Equals, true)
c.Assert(len(result.Sites[0].RegularPages()) == 1, qt.Equals, true)
c.Assert(result.Sites[0].Info.Params()["myparam"], qt.Equals, "paramproduction")
})
defer func() {
os.RemoveAll(dir)
}()
c.Run("hugo, set environment", func(c *qt.C) {
dir, clean := createSite(c)
defer clean()
resp := Execute([]string{"-s=" + dir, "-e=staging"})
c.Assert(resp.Err, qt.IsNil)
result := resp.Result
c.Assert(result.Sites[0].Info.Params()["myparam"], qt.Equals, "paramstaging")
})
resp := Execute([]string{"-s=" + dir})
assert.NoError(resp.Err)
result := resp.Result
assert.True(len(result.Sites) == 1)
assert.True(len(result.Sites[0].RegularPages) == 1)
c.Run("convert toJSON", func(c *qt.C) {
dir, clean := createSite(c)
output := filepath.Join(dir, "myjson")
defer clean()
resp := Execute([]string{"convert", "toJSON", "-s=" + dir, "-e=staging", "-o=" + output})
c.Assert(resp.Err, qt.IsNil)
converted := readFileFrom(c, filepath.Join(output, "content", "p1.md"))
c.Assert(converted, qt.Equals, "{\n \"title\": \"P1\",\n \"weight\": 1\n}\n\nContent\n\n", qt.Commentf(converted))
})
c.Run("config, set environment", func(c *qt.C) {
dir, clean := createSite(c)
defer clean()
out, err := captureStdout(func() error {
resp := Execute([]string{"config", "-s=" + dir, "-e=staging"})
return resp.Err
})
c.Assert(err, qt.IsNil)
c.Assert(out, qt.Contains, "params = map[myparam:paramstaging]", qt.Commentf(out))
})
c.Run("deploy, environment set", func(c *qt.C) {
dir, clean := createSite(c)
defer clean()
resp := Execute([]string{"deploy", "-s=" + dir, "-e=staging", "--target=mydeployment", "--dryRun"})
c.Assert(resp.Err, qt.Not(qt.IsNil))
c.Assert(resp.Err.Error(), qt.Contains, `no driver registered for "hugocloud"`)
})
c.Run("list", func(c *qt.C) {
dir, clean := createSite(c)
defer clean()
out, err := captureStdout(func() error {
resp := Execute([]string{"list", "all", "-s=" + dir, "-e=staging"})
return resp.Err
})
c.Assert(err, qt.IsNil)
c.Assert(out, qt.Contains, "p1.md")
})
c.Run("new theme", func(c *qt.C) {
dir, clean := createSite(c)
defer clean()
themesDir := filepath.Join(dir, "mythemes")
resp := Execute([]string{"new", "theme", "mytheme", "-s=" + dir, "-e=staging", "--themesDir=" + themesDir})
c.Assert(resp.Err, qt.IsNil)
themeTOML := readFileFrom(c, filepath.Join(themesDir, "mytheme", "theme.toml"))
c.Assert(themeTOML, qt.Contains, "name = \"Mytheme\"")
})
c.Run("new site", func(c *qt.C) {
dir, clean := createSite(c)
defer clean()
siteDir := filepath.Join(dir, "mysite")
resp := Execute([]string{"new", "site", siteDir, "-e=staging"})
c.Assert(resp.Err, qt.IsNil)
config := readFileFrom(c, filepath.Join(siteDir, "config.toml"))
c.Assert(config, qt.Contains, "baseURL = 'http://example.org/'")
checkNewSiteInited(c, siteDir)
})
}
func TestCommandsPersistentFlags(t *testing.T) {
assert := require.New(t)
func checkNewSiteInited(c *qt.C, basepath string) {
paths := []string{
filepath.Join(basepath, "layouts"),
filepath.Join(basepath, "content"),
filepath.Join(basepath, "archetypes"),
filepath.Join(basepath, "static"),
filepath.Join(basepath, "data"),
filepath.Join(basepath, "config.toml"),
}
for _, path := range paths {
_, err := os.Stat(path)
c.Assert(err, qt.IsNil)
}
}
func readFileFrom(c *qt.C, filename string) string {
c.Helper()
filename = filepath.Clean(filename)
b, err := afero.ReadFile(hugofs.Os, filename)
c.Assert(err, qt.IsNil)
return string(b)
}
func TestFlags(t *testing.T) {
c := qt.New(t)
noOpRunE := func(cmd *cobra.Command, args []string) error {
return nil
}
tests := []struct {
name string
args []string
check func(command []cmder)
}{{[]string{"server",
"--config=myconfig.toml",
"--contentDir=mycontent",
"--disableKinds=page,home",
"--layoutDir=mylayouts",
"--theme=mytheme",
"--gc",
"--themesDir=mythemes",
"--cleanDestinationDir",
"--navigateToChanged",
"--disableLiveReload",
"--noHTTPCache",
"--i18n-warnings",
"--destination=/tmp/mydestination",
"-b=https://example.com/b/",
"--port=1366",
"--renderToDisk",
"--source=mysource",
"--uglyURLs"}, func(commands []cmder) {
var sc *serverCmd
for _, command := range commands {
if b, ok := command.(commandsBuilderGetter); ok {
v := b.getCmmandsBuilder().hugoBuilderCommon
assert.Equal("myconfig.toml", v.cfgFile)
assert.Equal("mysource", v.source)
assert.Equal("https://example.com/b/", v.baseURL)
}
check func(c *qt.C, cmd *serverCmd)
}{
{
// https://github.com/gohugoio/hugo/issues/7642
name: "ignoreVendor as bool",
args: []string{"server", "--ignoreVendor"},
check: func(c *qt.C, cmd *serverCmd) {
cfg := config.New()
cmd.flagsToConfig(cfg)
c.Assert(cfg.Get("ignoreVendor"), qt.Equals, true)
},
},
{
// https://github.com/gohugoio/hugo/issues/7642
name: "ignoreVendorPaths",
args: []string{"server", "--ignoreVendorPaths=github.com/**"},
check: func(c *qt.C, cmd *serverCmd) {
cfg := config.New()
cmd.flagsToConfig(cfg)
c.Assert(cfg.Get("ignoreVendorPaths"), qt.Equals, "github.com/**")
},
},
{
name: "Persistent flags",
args: []string{
"server",
"--config=myconfig.toml",
"--configDir=myconfigdir",
"--contentDir=mycontent",
"--disableKinds=page,home",
"--environment=testing",
"--configDir=myconfigdir",
"--layoutDir=mylayouts",
"--theme=mytheme",
"--gc",
"--themesDir=mythemes",
"--cleanDestinationDir",
"--navigateToChanged",
"--disableLiveReload",
"--noHTTPCache",
"--i18n-warnings",
"--destination=/tmp/mydestination",
"-b=https://example.com/b/",
"--port=1366",
"--renderToDisk",
"--source=mysource",
"--path-warnings",
},
check: func(c *qt.C, sc *serverCmd) {
c.Assert(sc, qt.Not(qt.IsNil))
c.Assert(sc.navigateToChanged, qt.Equals, true)
c.Assert(sc.disableLiveReload, qt.Equals, true)
c.Assert(sc.noHTTPCache, qt.Equals, true)
c.Assert(sc.renderToDisk, qt.Equals, true)
c.Assert(sc.serverPort, qt.Equals, 1366)
c.Assert(sc.environment, qt.Equals, "testing")
if srvCmd, ok := command.(*serverCmd); ok {
sc = srvCmd
}
}
cfg := config.New()
sc.flagsToConfig(cfg)
c.Assert(cfg.GetString("publishDir"), qt.Equals, "/tmp/mydestination")
c.Assert(cfg.GetString("contentDir"), qt.Equals, "mycontent")
c.Assert(cfg.GetString("layoutDir"), qt.Equals, "mylayouts")
c.Assert(cfg.GetStringSlice("theme"), qt.DeepEquals, []string{"mytheme"})
c.Assert(cfg.GetString("themesDir"), qt.Equals, "mythemes")
c.Assert(cfg.GetString("baseURL"), qt.Equals, "https://example.com/b/")
assert.NotNil(sc)
assert.True(sc.navigateToChanged)
assert.True(sc.disableLiveReload)
assert.True(sc.noHTTPCache)
assert.True(sc.renderToDisk)
assert.Equal(1366, sc.serverPort)
c.Assert(cfg.Get("disableKinds"), qt.DeepEquals, []string{"page", "home"})
cfg := viper.New()
sc.flagsToConfig(cfg)
assert.Equal("/tmp/mydestination", cfg.GetString("publishDir"))
assert.Equal("mycontent", cfg.GetString("contentDir"))
assert.Equal("mylayouts", cfg.GetString("layoutDir"))
assert.Equal("mytheme", cfg.GetString("theme"))
assert.Equal("mythemes", cfg.GetString("themesDir"))
assert.Equal("https://example.com/b/", cfg.GetString("baseURL"))
c.Assert(cfg.GetBool("gc"), qt.Equals, true)
assert.Equal([]string{"page", "home"}, cfg.Get("disableKinds"))
// The flag is named path-warnings
c.Assert(cfg.GetBool("logPathWarnings"), qt.Equals, true)
assert.True(cfg.GetBool("uglyURLs"))
assert.True(cfg.GetBool("gc"))
// The flag is named i18n-warnings
assert.True(cfg.GetBool("logI18nWarnings"))
}}}
for _, test := range tests {
b := newCommandsBuilder()
root := b.addAll().build()
for _, c := range b.commands {
if c.getCommand() == nil {
continue
}
// We are only intereseted in the flag handling here.
c.getCommand().RunE = noOpRunE
}
rootCmd := root.getCommand()
rootCmd.SetArgs(test.args)
assert.NoError(rootCmd.Execute())
test.check(b.commands)
// The flag is named i18n-warnings
c.Assert(cfg.GetBool("logI18nWarnings"), qt.Equals, true)
},
},
}
for _, test := range tests {
c.Run(test.name, func(c *qt.C) {
b := newCommandsBuilder()
root := b.addAll().build()
for _, cmd := range b.commands {
if cmd.getCommand() == nil {
continue
}
// We are only intereseted in the flag handling here.
cmd.getCommand().RunE = noOpRunE
}
rootCmd := root.getCommand()
rootCmd.SetArgs(test.args)
c.Assert(rootCmd.Execute(), qt.IsNil)
test.check(c, b.commands[0].(*serverCmd))
})
}
}
func TestCommandsExecute(t *testing.T) {
c := qt.New(t)
assert := require.New(t)
dir, clean, err := createSimpleTestSite(t, testSiteConfig{})
c.Assert(err, qt.IsNil)
dir, err := createSimpleTestSite(t)
assert.NoError(err)
dirOut, clean2, err := htesting.CreateTempDir(hugofs.Os, "hugo-cli-out")
c.Assert(err, qt.IsNil)
dirOut, err := ioutil.TempDir("", "hugo-cli-out")
assert.NoError(err)
defer func() {
os.RemoveAll(dir)
os.RemoveAll(dirOut)
}()
defer clean()
defer clean2()
sourceFlag := fmt.Sprintf("-s=%s", dir)
@@ -161,7 +285,6 @@ func TestCommandsExecute(t *testing.T) {
{nil, []string{sourceFlag}, ""},
{nil, []string{sourceFlag, "--renderToMemory"}, ""},
{[]string{"config"}, []string{sourceFlag}, ""},
{[]string{"benchmark"}, []string{sourceFlag, "-n=1"}, ""},
{[]string{"convert", "toTOML"}, []string{sourceFlag, "-o=" + filepath.Join(dirOut, "toml")}, ""},
{[]string{"convert", "toYAML"}, []string{sourceFlag, "-o=" + filepath.Join(dirOut, "yaml")}, ""},
{[]string{"convert", "toJSON"}, []string{sourceFlag, "-o=" + filepath.Join(dirOut, "json")}, ""},
@@ -180,8 +303,8 @@ func TestCommandsExecute(t *testing.T) {
}
for _, test := range tests {
hugoCmd := newCommandsBuilder().addAll().build().getCommand()
b := newCommandsBuilder().addAll().build()
hugoCmd := b.getCommand()
test.flags = append(test.flags, "--quiet")
hugoCmd.SetArgs(append(test.commands, test.flags...))
@@ -191,31 +314,65 @@ func TestCommandsExecute(t *testing.T) {
_, err := hugoCmd.ExecuteC()
if test.expectErrToContain != "" {
assert.Error(err, fmt.Sprintf("%v", test.commands))
assert.Contains(err.Error(), test.expectErrToContain)
c.Assert(err, qt.Not(qt.IsNil))
c.Assert(err.Error(), qt.Contains, test.expectErrToContain)
} else {
assert.NoError(err, fmt.Sprintf("%v", test.commands))
c.Assert(err, qt.IsNil)
}
// Assert that we have not left any development debug artifacts in
// the code.
if b.c != nil {
_, ok := b.c.destinationFs.(types.DevMarker)
c.Assert(ok, qt.Equals, false)
}
}
}
func createSimpleTestSite(t *testing.T) (string, error) {
d, e := ioutil.TempDir("", "hugo-cli")
type testSiteConfig struct {
configTOML string
contentDir string
}
func createSimpleTestSite(t *testing.T, cfg testSiteConfig) (string, func(), error) {
d, clean, e := htesting.CreateTempDir(hugofs.Os, "hugo-cli")
if e != nil {
return "", e
return "", nil, e
}
// Just the basic. These are for CLI tests, not site testing.
writeFile(t, filepath.Join(d, "config.toml"), `
cfgStr := `
baseURL = "https://example.org"
title = "Hugo Commands"
`
contentDir := "content"
if cfg.configTOML != "" {
cfgStr = cfg.configTOML
}
if cfg.contentDir != "" {
contentDir = cfg.contentDir
}
os.MkdirAll(filepath.Join(d, "public"), 0777)
// Just the basic. These are for CLI tests, not site testing.
writeFile(t, filepath.Join(d, "config.toml"), cfgStr)
writeFile(t, filepath.Join(d, "config", "staging", "params.toml"), `myparam="paramstaging"`)
writeFile(t, filepath.Join(d, "config", "staging", "deployment.toml"), `
[[targets]]
name = "mydeployment"
URL = "hugocloud://hugotestbucket"
`)
writeFile(t, filepath.Join(d, "content", "p1.md"), `
writeFile(t, filepath.Join(d, "config", "testing", "params.toml"), `myparam="paramtesting"`)
writeFile(t, filepath.Join(d, "config", "production", "params.toml"), `myparam="paramproduction"`)
writeFile(t, filepath.Join(d, contentDir, "p1.md"), `
---
title: "P1"
weight: 1
@@ -234,11 +391,11 @@ Single: {{ .Title }}
writeFile(t, filepath.Join(d, "layouts", "_default", "list.html"), `
List: {{ .Title }}
Environment: {{ hugo.Environment }}
`)
return d, nil
return d, clean, nil
}
func writeFile(t *testing.T, filename, content string) {
+126 -18
View File
@@ -14,64 +14,172 @@
package commands
import (
"encoding/json"
"fmt"
"os"
"reflect"
"regexp"
"sort"
"strings"
"time"
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/parser"
"github.com/gohugoio/hugo/parser/metadecoders"
"github.com/gohugoio/hugo/modules"
"github.com/spf13/cobra"
jww "github.com/spf13/jwalterweatherman"
"github.com/spf13/viper"
)
var _ cmder = (*configCmd)(nil)
type configCmd struct {
hugoBuilderCommon
*baseCmd
*baseBuilderCmd
}
func newConfigCmd() *configCmd {
func (b *commandsBuilder) newConfigCmd() *configCmd {
cc := &configCmd{}
cc.baseCmd = newBaseCmd(&cobra.Command{
cmd := &cobra.Command{
Use: "config",
Short: "Print the site configuration",
Long: `Print the site configuration, both default and custom settings.`,
RunE: cc.printConfig,
})
}
cc.cmd.Flags().StringVarP(&cc.source, "source", "s", "", "filesystem path to read files relative from")
printMountsCmd := &cobra.Command{
Use: "mounts",
Short: "Print the configured file mounts",
RunE: cc.printMounts,
}
cmd.AddCommand(printMountsCmd)
cc.baseBuilderCmd = b.newBuilderBasicCmd(cmd)
return cc
}
func (c *configCmd) printConfig(cmd *cobra.Command, args []string) error {
cfg, err := initializeConfig(true, false, &c.hugoBuilderCommon, c, nil)
func (c *configCmd) printMounts(cmd *cobra.Command, args []string) error {
cfg, err := initializeConfig(true, false, false, &c.hugoBuilderCommon, c, nil)
if err != nil {
return err
}
allSettings := cfg.Cfg.(*viper.Viper).AllSettings()
allModules := cfg.Cfg.Get("allmodules").(modules.Modules)
var separator string
if allSettings["metadataformat"] == "toml" {
for _, m := range allModules {
if err := parser.InterfaceToConfig(&modMounts{m: m, verbose: c.verbose}, metadecoders.JSON, os.Stdout); err != nil {
return err
}
}
return nil
}
func (c *configCmd) printConfig(cmd *cobra.Command, args []string) error {
cfg, err := initializeConfig(true, false, false, &c.hugoBuilderCommon, c, nil)
if err != nil {
return err
}
allSettings := cfg.Cfg.Get("").(maps.Params)
// We need to clean up this, but we store objects in the config that
// isn't really interesting to the end user, so filter these.
ignoreKeysRe := regexp.MustCompile("client|sorted|filecacheconfigs|allmodules|multilingual")
separator := ": "
if len(cfg.configFiles) > 0 && strings.HasSuffix(cfg.configFiles[0], ".toml") {
separator = " = "
} else {
separator = ": "
}
var keys []string
for k := range allSettings {
if ignoreKeysRe.MatchString(k) {
continue
}
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
kv := reflect.ValueOf(allSettings[k])
if kv.Kind() == reflect.String {
jww.FEEDBACK.Printf("%s%s\"%+v\"\n", k, separator, allSettings[k])
fmt.Printf("%s%s\"%+v\"\n", k, separator, allSettings[k])
} else {
jww.FEEDBACK.Printf("%s%s%+v\n", k, separator, allSettings[k])
fmt.Printf("%s%s%+v\n", k, separator, allSettings[k])
}
}
return nil
}
type modMounts struct {
verbose bool
m modules.Module
}
type modMount struct {
Source string `json:"source"`
Target string `json:"target"`
Lang string `json:"lang,omitempty"`
}
func (m *modMounts) MarshalJSON() ([]byte, error) {
var mounts []modMount
for _, mount := range m.m.Mounts() {
mounts = append(mounts, modMount{
Source: mount.Source,
Target: mount.Target,
Lang: mount.Lang,
})
}
var ownerPath string
if m.m.Owner() != nil {
ownerPath = m.m.Owner().Path()
}
if m.verbose {
config := m.m.Config()
return json.Marshal(&struct {
Path string `json:"path"`
Version string `json:"version"`
Time time.Time `json:"time"`
Owner string `json:"owner"`
Dir string `json:"dir"`
Meta map[string]interface{} `json:"meta"`
HugoVersion modules.HugoVersion `json:"hugoVersion"`
Mounts []modMount `json:"mounts"`
}{
Path: m.m.Path(),
Version: m.m.Version(),
Time: m.m.Time(),
Owner: ownerPath,
Dir: m.m.Dir(),
Meta: config.Params,
HugoVersion: config.HugoVersion,
Mounts: mounts,
})
}
return json.Marshal(&struct {
Path string `json:"path"`
Version string `json:"version"`
Time time.Time `json:"time"`
Owner string `json:"owner"`
Dir string `json:"dir"`
Mounts []modMount `json:"mounts"`
}{
Path: m.m.Path(),
Version: m.m.Version(),
Time: m.m.Time(),
Owner: ownerPath,
Dir: m.m.Dir(),
Mounts: mounts,
})
}
+79 -64
View File
@@ -1,4 +1,4 @@
// Copyright 2015 The Hugo Authors. All rights reserved.
// Copyright 2019 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.
@@ -14,53 +14,59 @@
package commands
import (
"bytes"
"fmt"
"path/filepath"
"strings"
"time"
src "github.com/gohugoio/hugo/source"
"github.com/gohugoio/hugo/parser/pageparser"
"github.com/gohugoio/hugo/resources/page"
"github.com/gohugoio/hugo/hugofs"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/parser"
"github.com/gohugoio/hugo/parser/metadecoders"
"github.com/pkg/errors"
"github.com/gohugoio/hugo/hugolib"
"path/filepath"
"github.com/gohugoio/hugo/parser"
"github.com/spf13/cast"
"github.com/spf13/cobra"
)
var (
_ cmder = (*convertCmd)(nil)
)
var _ cmder = (*convertCmd)(nil)
type convertCmd struct {
hugoBuilderCommon
outputDir string
unsafe bool
*baseCmd
*baseBuilderCmd
}
func newConvertCmd() *convertCmd {
func (b *commandsBuilder) newConvertCmd() *convertCmd {
cc := &convertCmd{}
cc.baseCmd = newBaseCmd(&cobra.Command{
cmd := &cobra.Command{
Use: "convert",
Short: "Convert your content to different formats",
Long: `Convert your content (e.g. front matter) to different formats.
See convert's subcommands toJSON, toTOML and toYAML for more information.`,
RunE: nil,
})
}
cc.cmd.AddCommand(
cmd.AddCommand(
&cobra.Command{
Use: "toJSON",
Short: "Convert front matter to JSON",
Long: `toJSON converts all front matter in the content directory
to use JSON for the front matter.`,
RunE: func(cmd *cobra.Command, args []string) error {
return cc.convertContents(rune([]byte(parser.JSONLead)[0]))
return cc.convertContents(metadecoders.JSON)
},
},
&cobra.Command{
@@ -69,7 +75,7 @@ to use JSON for the front matter.`,
Long: `toTOML converts all front matter in the content directory
to use TOML for the front matter.`,
RunE: func(cmd *cobra.Command, args []string) error {
return cc.convertContents(rune([]byte(parser.TOMLLead)[0]))
return cc.convertContents(metadecoders.TOML)
},
},
&cobra.Command{
@@ -78,29 +84,31 @@ to use TOML for the front matter.`,
Long: `toYAML converts all front matter in the content directory
to use YAML for the front matter.`,
RunE: func(cmd *cobra.Command, args []string) error {
return cc.convertContents(rune([]byte(parser.YAMLLead)[0]))
return cc.convertContents(metadecoders.YAML)
},
},
)
cc.cmd.PersistentFlags().StringVarP(&cc.outputDir, "output", "o", "", "filesystem path to write files to")
cc.cmd.PersistentFlags().StringVarP(&cc.source, "source", "s", "", "filesystem path to read files relative from")
cc.cmd.PersistentFlags().BoolVar(&cc.unsafe, "unsafe", false, "enable less safe operations, please backup first")
cc.cmd.PersistentFlags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{})
cmd.PersistentFlags().StringVarP(&cc.outputDir, "output", "o", "", "filesystem path to write files to")
cmd.PersistentFlags().BoolVar(&cc.unsafe, "unsafe", false, "enable less safe operations, please backup first")
cc.baseBuilderCmd = b.newBuilderBasicCmd(cmd)
return cc
}
func (cc *convertCmd) convertContents(mark rune) error {
func (cc *convertCmd) convertContents(format metadecoders.Format) error {
if cc.outputDir == "" && !cc.unsafe {
return newUserError("Unsafe operation not allowed, use --unsafe or set a different output path")
}
c, err := initializeConfig(true, false, &cc.hugoBuilderCommon, cc, nil)
c, err := initializeConfig(true, false, false, &cc.hugoBuilderCommon, cc, nil)
if err != nil {
return err
}
c.Cfg.Set("buildDrafts", true)
h, err := hugolib.NewHugoSites(*c.DepsCfg)
if err != nil {
return err
@@ -112,83 +120,90 @@ func (cc *convertCmd) convertContents(mark rune) error {
site := h.Sites[0]
site.Log.FEEDBACK.Println("processing", len(site.AllPages), "content files")
for _, p := range site.AllPages {
if err := cc.convertAndSavePage(p, site, mark); err != nil {
site.Log.Println("processing", len(site.AllPages()), "content files")
for _, p := range site.AllPages() {
if err := cc.convertAndSavePage(p, site, format); err != nil {
return err
}
}
return nil
}
func (cc *convertCmd) convertAndSavePage(p *hugolib.Page, site *hugolib.Site, mark rune) error {
func (cc *convertCmd) convertAndSavePage(p page.Page, site *hugolib.Site, targetFormat metadecoders.Format) error {
// The resources are not in .Site.AllPages.
for _, r := range p.Resources.ByType("page") {
if err := cc.convertAndSavePage(r.(*hugolib.Page), site, mark); err != nil {
for _, r := range p.Resources().ByType("page") {
if err := cc.convertAndSavePage(r.(page.Page), site, targetFormat); err != nil {
return err
}
}
if p.Filename() == "" {
if p.File().IsZero() {
// No content file.
return nil
}
site.Log.INFO.Println("Attempting to convert", p.LogicalName())
newPage, err := site.NewPage(p.LogicalName())
if err != nil {
return err
}
errMsg := fmt.Errorf("Error processing file %q", p.Path())
f, _ := p.File.(src.ReadableFile)
file, err := f.Open()
site.Log.Infoln("Attempting to convert", p.File().Filename())
f := p.File()
file, err := f.FileInfo().Meta().Open()
if err != nil {
site.Log.ERROR.Println("Error reading file:", p.Path())
site.Log.Errorln(errMsg)
file.Close()
return nil
}
psr, err := parser.ReadFrom(file)
pf, err := pageparser.ParseFrontMatterAndContent(file)
if err != nil {
site.Log.ERROR.Println("Error processing file:", p.Path())
site.Log.Errorln(errMsg)
file.Close()
return err
}
file.Close()
metadata, err := psr.Metadata()
// better handling of dates in formats that don't have support for them
if pf.FrontMatterFormat == metadecoders.JSON || pf.FrontMatterFormat == metadecoders.YAML || pf.FrontMatterFormat == metadecoders.TOML {
for k, v := range pf.FrontMatter {
switch vv := v.(type) {
case time.Time:
pf.FrontMatter[k] = vv.Format(time.RFC3339)
}
}
}
var newContent bytes.Buffer
err = parser.InterfaceToFrontMatter(pf.FrontMatter, targetFormat, &newContent)
if err != nil {
site.Log.ERROR.Println("Error processing file:", p.Path())
site.Log.Errorln(errMsg)
return err
}
// better handling of dates in formats that don't have support for them
if mark == parser.FormatToLeadRune("json") || mark == parser.FormatToLeadRune("yaml") || mark == parser.FormatToLeadRune("toml") {
newMetadata := cast.ToStringMap(metadata)
for k, v := range newMetadata {
switch vv := v.(type) {
case time.Time:
newMetadata[k] = vv.Format(time.RFC3339)
}
}
metadata = newMetadata
}
newContent.Write(pf.Content)
newPage.SetSourceContent(psr.Content())
if err = newPage.SetSourceMetaData(metadata, mark); err != nil {
site.Log.ERROR.Printf("Failed to set source metadata for file %q: %s. For more info see For more info see https://github.com/gohugoio/hugo/issues/2458", newPage.FullFilePath(), err)
return nil
}
newFilename := p.File().Filename()
newFilename := p.Filename()
if cc.outputDir != "" {
newFilename = filepath.Join(cc.outputDir, p.Dir(), newPage.LogicalName())
contentDir := strings.TrimSuffix(newFilename, p.Path())
contentDir = filepath.Base(contentDir)
newFilename = filepath.Join(cc.outputDir, contentDir, p.Path())
}
if err = newPage.SaveSourceAs(newFilename); err != nil {
return fmt.Errorf("Failed to save file %q: %s", newFilename, err)
fs := hugofs.Os
if err := helpers.WriteToDisk(newFilename, &newContent, fs); err != nil {
return errors.Wrapf(err, "Failed to save file %q:", newFilename)
}
return nil
}
type parsedFile struct {
frontMatterFormat metadecoders.Format
frontMatterSource []byte
frontMatter map[string]interface{}
// Everything after Front Matter
content []byte
}
+85
View File
@@ -0,0 +1,85 @@
// Copyright 2019 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.
// +build !nodeploy
package commands
import (
"context"
"github.com/gohugoio/hugo/deploy"
"github.com/spf13/cobra"
)
var _ cmder = (*deployCmd)(nil)
// deployCmd supports deploying sites to Cloud providers.
type deployCmd struct {
*baseBuilderCmd
invalidateCDN bool
maxDeletes int
}
// TODO: In addition to the "deploy" command, consider adding a "--deploy"
// flag for the default command; this would build the site and then deploy it.
// It's not obvious how to do this; would all of the deploy-specific flags
// have to exist at the top level as well?
// TODO: The output files change every time "hugo" is executed, it looks
// like because of map order randomization. This means that you can
// run "hugo && hugo deploy" again and again and upload new stuff every time. Is
// this intended?
func (b *commandsBuilder) newDeployCmd() *deployCmd {
cc := &deployCmd{}
cmd := &cobra.Command{
Use: "deploy",
Short: "Deploy your site to a Cloud provider.",
Long: `Deploy your site to a Cloud provider.
See https://gohugo.io/hosting-and-deployment/hugo-deploy/ for detailed
documentation.
`,
RunE: func(cmd *cobra.Command, args []string) error {
cfgInit := func(c *commandeer) error {
c.Set("invalidateCDN", cc.invalidateCDN)
c.Set("maxDeletes", cc.maxDeletes)
return nil
}
comm, err := initializeConfig(true, true, false, &cc.hugoBuilderCommon, cc, cfgInit)
if err != nil {
return err
}
deployer, err := deploy.New(comm.Cfg, comm.hugo().PathSpec.PublishFs)
if err != nil {
return err
}
return deployer.Deploy(context.Background())
},
}
cmd.Flags().String("target", "", "target deployment from deployments section in config file; defaults to the first one")
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().BoolVar(&cc.invalidateCDN, "invalidateCDN", true, "invalidate the CDN cache listed in the deployment target")
cmd.Flags().IntVar(&cc.maxDeletes, "maxDeletes", 256, "maximum # of files to delete, or -1 to disable")
cc.baseBuilderCmd = b.newBuilderBasicCmd(cmd)
return cc
}
+28 -12
View File
@@ -16,6 +16,8 @@ package commands
import (
"runtime"
"github.com/gohugoio/hugo/common/hugo"
"github.com/spf13/cobra"
jww "github.com/spf13/jwalterweatherman"
)
@@ -27,18 +29,32 @@ type envCmd struct {
}
func newEnvCmd() *envCmd {
return &envCmd{baseCmd: newBaseCmd(&cobra.Command{
Use: "env",
Short: "Print Hugo version and environment info",
Long: `Print Hugo version and environment info. This is useful in Hugo bug reports.`,
RunE: func(cmd *cobra.Command, args []string) error {
printHugoVersion()
jww.FEEDBACK.Printf("GOOS=%q\n", runtime.GOOS)
jww.FEEDBACK.Printf("GOARCH=%q\n", runtime.GOARCH)
jww.FEEDBACK.Printf("GOVERSION=%q\n", runtime.Version())
return &envCmd{
baseCmd: newBaseCmd(&cobra.Command{
Use: "env",
Short: "Print Hugo version and environment info",
Long: `Print Hugo version and environment info. This is useful in Hugo bug reports.
return nil
},
}),
If you add the -v flag, you will get a full dependency list.
`,
RunE: func(cmd *cobra.Command, args []string) error {
printHugoVersion()
jww.FEEDBACK.Printf("GOOS=%q\n", runtime.GOOS)
jww.FEEDBACK.Printf("GOARCH=%q\n", runtime.GOARCH)
jww.FEEDBACK.Printf("GOVERSION=%q\n", runtime.Version())
isVerbose, _ := cmd.Flags().GetBool("verbose")
if isVerbose {
deps := hugo.GetDependencyList()
for _, dep := range deps {
jww.FEEDBACK.Printf("%s\n", dep)
}
}
return nil
},
}),
}
}
+33 -20
View File
@@ -14,6 +14,9 @@
package commands
import (
"io"
"os"
"github.com/spf13/cobra"
jww "github.com/spf13/jwalterweatherman"
)
@@ -23,7 +26,7 @@ var _ cmder = (*genautocompleteCmd)(nil)
type genautocompleteCmd struct {
autocompleteTarget string
// bash for now (zsh and others will come)
// bash, zsh, fish or powershell
autocompleteType string
*baseCmd
@@ -37,44 +40,54 @@ func newGenautocompleteCmd() *genautocompleteCmd {
Short: "Generate shell autocompletion script for Hugo",
Long: `Generates a shell autocompletion script for Hugo.
NOTE: The current version supports Bash only.
This should work for *nix systems with Bash installed.
The script is written to the console (stdout).
By default, the file is written directly to /etc/bash_completion.d
for convenience, and the command may need superuser rights, e.g.:
To write to file, add the ` + "`--completionfile=/path/to/file`" + ` flag.
$ sudo hugo gen autocomplete
Add ` + "`--completionfile=/path/to/file`" + ` flag to set alternative
file-path and name.
Add ` + "`--type={bash, zsh, fish or powershell}`" + ` flag to set alternative
shell type.
Logout and in again to reload the completion scripts,
or just source them in directly:
$ . /etc/bash_completion`,
$ . /etc/bash_completion or /path/to/file`,
RunE: func(cmd *cobra.Command, args []string) error {
if cc.autocompleteType != "bash" {
return newUserError("Only Bash is supported for now")
var err error
var target io.Writer
if cc.autocompleteTarget == "" {
target = os.Stdout
} else {
target, _ = os.OpenFile(cc.autocompleteTarget, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
}
err := cmd.Root().GenBashCompletionFile(cc.autocompleteTarget)
switch cc.autocompleteType {
case "bash":
err = cmd.Root().GenBashCompletion(target)
case "zsh":
err = cmd.Root().GenZshCompletion(target)
case "fish":
err = cmd.Root().GenFishCompletion(target, true)
case "powershell":
err = cmd.Root().GenPowerShellCompletion(target)
default:
return newUserError("Unsupported completion type")
}
if err != nil {
return err
}
jww.FEEDBACK.Println("Bash completion file for Hugo saved to", cc.autocompleteTarget)
if cc.autocompleteTarget != "" {
jww.FEEDBACK.Println(cc.autocompleteType+" completion file for Hugo saved to", cc.autocompleteTarget)
}
return nil
},
})
cc.cmd.PersistentFlags().StringVarP(&cc.autocompleteTarget, "completionfile", "", "/etc/bash_completion.d/hugo.sh", "autocompletion file")
cc.cmd.PersistentFlags().StringVarP(&cc.autocompleteType, "type", "", "bash", "autocompletion type (currently only bash supported)")
// For bash-completion
cc.cmd.PersistentFlags().SetAnnotation("completionfile", cobra.BashCompFilenameExt, []string{})
cc.cmd.PersistentFlags().StringVarP(&cc.autocompleteTarget, "completionfile", "f", "", "autocompletion file, defaults to stdout")
cc.cmd.PersistentFlags().StringVarP(&cc.autocompleteType, "type", "t", "bash", "autocompletion type (bash, zsh, fish, or powershell)")
return cc
}
+5 -7
View File
@@ -22,9 +22,7 @@ import (
"github.com/spf13/cobra"
)
var (
_ cmder = (*genChromaStyles)(nil)
)
var _ cmder = (*genChromaStyles)(nil)
type genChromaStyles struct {
style string
@@ -39,9 +37,9 @@ func createGenChromaStyles() *genChromaStyles {
baseCmd: newBaseCmd(&cobra.Command{
Use: "chromastyles",
Short: "Generate CSS stylesheet for the Chroma code highlighter",
Long: `Generate CSS stylesheet for the Chroma code highlighter for a given style. This stylesheet is needed if pygmentsUseClasses is enabled in config.
Long: `Generate CSS stylesheet for the Chroma code highlighter for a given style. This stylesheet is needed if markup.highlight.noClasses is disabled in config.
See https://help.farbox.com/pygments.html for preview of available styles`,
See https://xyproto.github.io/splash/docs/all.html for a preview of the available styles`,
}),
}
@@ -49,7 +47,7 @@ See https://help.farbox.com/pygments.html for preview of available styles`,
return g.generate()
}
g.cmd.PersistentFlags().StringVar(&g.style, "style", "friendly", "highlighter style (see https://help.farbox.com/pygments.html)")
g.cmd.PersistentFlags().StringVar(&g.style, "style", "friendly", "highlighter style (see https://xyproto.github.io/splash/docs/)")
g.cmd.PersistentFlags().StringVar(&g.highlightStyle, "highlightStyle", "bg:#ffffcc", "style used for highlighting lines (see https://github.com/alecthomas/chroma)")
g.cmd.PersistentFlags().StringVar(&g.linesStyle, "linesStyle", "", "style used for line numbers (see https://github.com/alecthomas/chroma)")
@@ -68,7 +66,7 @@ func (g *genChromaStyles) generate() error {
if err != nil {
return err
}
formatter := html.New(html.WithClasses())
formatter := html.New(html.WithAllClasses(true))
formatter.WriteCSS(os.Stdout, style)
return nil
}
+7 -5
View File
@@ -18,7 +18,6 @@ import (
"path"
"path/filepath"
"strings"
"time"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/hugofs"
@@ -36,7 +35,6 @@ type genDocCmd struct {
func newGenDocCmd() *genDocCmd {
const gendocFrontmatterTemplate = `---
date: %s
title: "%s"
slug: %s
url: %s
@@ -57,6 +55,12 @@ It creates one Markdown file per command with front matter suitable
for rendering in Hugo.`,
RunE: func(cmd *cobra.Command, args []string) error {
cmd.VisitParents(func(c *cobra.Command) {
// Disable the "Auto generated by spf13/cobra on DATE"
// as it creates a lot of diffs.
c.DisableAutoGenTag = true
})
if !strings.HasSuffix(cc.gendocdir, helpers.FilePathSeparator) {
cc.gendocdir += helpers.FilePathSeparator
}
@@ -66,19 +70,17 @@ for rendering in Hugo.`,
return err
}
}
now := time.Now().Format("2006-01-02")
prepender := func(filename string) string {
name := filepath.Base(filename)
base := strings.TrimSuffix(name, path.Ext(name))
url := "/commands/" + strings.ToLower(base) + "/"
return fmt.Sprintf(gendocFrontmatterTemplate, now, strings.Replace(base, "_", " ", -1), base, url)
return fmt.Sprintf(gendocFrontmatterTemplate, strings.Replace(base, "_", " ", -1), base, url)
}
linkHandler := func(name string) string {
base := strings.TrimSuffix(name, path.Ext(name))
return "/commands/" + strings.ToLower(base) + "/"
}
jww.FEEDBACK.Println("Generating Hugo command-line documentation in", cc.gendocdir, "...")
doc.GenMarkdownTreeCustom(cmd.Root(), cc.gendocdir, prepender, linkHandler)
jww.FEEDBACK.Println("Done.")
+2 -5
View File
@@ -23,9 +23,7 @@ import (
"github.com/spf13/cobra"
)
var (
_ cmder = (*genDocsHelper)(nil)
)
var _ cmder = (*genDocsHelper)(nil)
type genDocsHelper struct {
target string
@@ -64,11 +62,10 @@ func (g *genDocsHelper) generate() error {
enc := json.NewEncoder(f)
enc.SetIndent("", " ")
if err := enc.Encode(docshelper.DocProviders); err != nil {
if err := enc.Encode(docshelper.GetDocProvider()); err != nil {
return err
}
fmt.Println("Done!")
return nil
}
+2 -1
View File
@@ -17,6 +17,7 @@ import (
"fmt"
"strings"
"github.com/gohugoio/hugo/common/hugo"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/hugofs"
"github.com/spf13/cobra"
@@ -45,7 +46,7 @@ in the "man" directory under the current directory.`,
header := &doc.GenManHeader{
Section: "1",
Manual: "Hugo Manual",
Source: fmt.Sprintf("Hugo %s", helpers.CurrentHugoVersion),
Source: fmt.Sprintf("Hugo %s", hugo.CurrentVersion),
}
if !strings.HasSuffix(cc.genmandir, helpers.FilePathSeparator) {
cc.genmandir += helpers.FilePathSeparator
+7
View File
@@ -23,6 +23,13 @@ import (
"github.com/spf13/cobra"
)
const (
ansiEsc = "\u001B"
clearLine = "\r\033[K"
hideCursor = ansiEsc + "[?25l"
showCursor = ansiEsc + "[?25h"
)
type flagsToConfigHandler interface {
flagsToConfig(cfg config.Provider)
}
+731 -463
View File
File diff suppressed because it is too large Load Diff
+47
View File
@@ -0,0 +1,47 @@
// Copyright 2019 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 (
"testing"
qt "github.com/frankban/quicktest"
)
// Issue #5662
func TestHugoWithContentDirOverride(t *testing.T) {
c := qt.New(t)
hugoCmd := newCommandsBuilder().addAll().build()
cmd := hugoCmd.getCommand()
contentDir := "contentOverride"
cfgStr := `
baseURL = "https://example.org"
title = "Hugo Commands"
contentDir = "thisdoesnotexist"
`
dir, clean, err := createSimpleTestSite(t, testSiteConfig{configTOML: cfgStr, contentDir: contentDir})
c.Assert(err, qt.IsNil)
defer clean()
cmd.SetArgs([]string{"-s=" + dir, "-c=" + contentDir})
_, err = cmd.ExecuteC()
c.Assert(err, qt.IsNil)
}
+7 -1
View File
@@ -13,7 +13,13 @@
package commands
import "github.com/spf13/cobra"
import (
// For time zone lookups on Windows without Go installed.
// See #8892
_ "time/tzdata"
"github.com/spf13/cobra"
)
func init() {
// This message to show to Windows users if Hugo is opened from explorer.exe
+109 -114
View File
@@ -1,4 +1,4 @@
// Copyright 2016 The Hugo Authors. All rights reserved.
// Copyright 2019 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.
@@ -16,7 +16,7 @@ package commands
import (
"bytes"
"errors"
"io"
"fmt"
"io/ioutil"
"os"
"path/filepath"
@@ -24,13 +24,20 @@ import (
"strconv"
"strings"
"time"
"unicode"
"github.com/gohugoio/hugo/parser/pageparser"
"github.com/gohugoio/hugo/common/hugio"
"github.com/gohugoio/hugo/parser/metadecoders"
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/hugofs"
"github.com/gohugoio/hugo/hugolib"
"github.com/gohugoio/hugo/parser"
"github.com/spf13/afero"
"github.com/spf13/cast"
"github.com/spf13/cobra"
jww "github.com/spf13/jwalterweatherman"
)
@@ -67,29 +74,27 @@ Import from Jekyll requires two paths, e.g. ` + "`hugo import jekyll jekyll_root
cc.cmd.AddCommand(importJekyllCmd)
return cc
}
func (i *importCmd) importFromJekyll(cmd *cobra.Command, args []string) error {
if len(args) < 2 {
return newUserError(`Import from Jekyll requires two paths, e.g. ` + "`hugo import jekyll jekyll_root_path target_path`.")
return newUserError(`import from jekyll requires two paths, e.g. ` + "`hugo import jekyll jekyll_root_path target_path`.")
}
jekyllRoot, err := filepath.Abs(filepath.Clean(args[0]))
if err != nil {
return newUserError("Path error:", args[0])
return newUserError("path error:", args[0])
}
targetDir, err := filepath.Abs(filepath.Clean(args[1]))
if err != nil {
return newUserError("Path error:", args[1])
return newUserError("path error:", args[1])
}
jww.INFO.Println("Import Jekyll from:", jekyllRoot, "to:", targetDir)
if strings.HasPrefix(filepath.Dir(targetDir), jekyllRoot) {
return newUserError("Target path should not be inside the Jekyll root, aborting.")
return newUserError("abort: target path should not be inside the Jekyll root")
}
forceImport, _ := cmd.Flags().GetBool("force")
@@ -97,10 +102,10 @@ func (i *importCmd) importFromJekyll(cmd *cobra.Command, args []string) error {
fs := afero.NewOsFs()
jekyllPostDirs, hasAnyPost := i.getJekyllDirInfo(fs, jekyllRoot)
if !hasAnyPost {
return errors.New("Your Jekyll root contains neither posts nor drafts, aborting.")
return errors.New("abort: jekyll root contains neither posts nor drafts")
}
site, err := i.createSiteFromJekyll(jekyllRoot, targetDir, jekyllPostDirs, forceImport)
err = i.createSiteFromJekyll(jekyllRoot, targetDir, jekyllPostDirs, forceImport)
if err != nil {
return newUserError(err)
@@ -109,7 +114,7 @@ func (i *importCmd) importFromJekyll(cmd *cobra.Command, args []string) error {
jww.FEEDBACK.Println("Importing...")
fileCount := 0
callback := func(path string, fi os.FileInfo, err error) error {
callback := func(path string, fi hugofs.FileMetaInfo, err error) error {
if err != nil {
return err
}
@@ -120,7 +125,7 @@ func (i *importCmd) importFromJekyll(cmd *cobra.Command, args []string) error {
relPath, err := filepath.Rel(jekyllRoot, path)
if err != nil {
return newUserError("Get rel path error:", path)
return newUserError("get rel path error:", path)
}
relPath = filepath.ToSlash(relPath)
@@ -137,7 +142,7 @@ func (i *importCmd) importFromJekyll(cmd *cobra.Command, args []string) error {
}
fileCount++
return convertJekyllPost(site, path, relPath, targetDir, draft)
return convertJekyllPost(path, relPath, targetDir, draft)
}
for jekyllPostDir, hasAnyPostInDir := range jekyllPostDirs {
@@ -195,22 +200,22 @@ func (i *importCmd) retrieveJekyllPostDir(fs afero.Fs, dir string) (bool, bool)
return false, true
}
func (i *importCmd) createSiteFromJekyll(jekyllRoot, targetDir string, jekyllPostDirs map[string]bool, force bool) (*hugolib.Site, error) {
func (i *importCmd) createSiteFromJekyll(jekyllRoot, targetDir string, jekyllPostDirs map[string]bool, force bool) error {
s, err := hugolib.NewSiteDefaultLang()
if err != nil {
return nil, err
return err
}
fs := s.Fs.Source
if exists, _ := helpers.Exists(targetDir, fs); exists {
if isDir, _ := helpers.IsDir(targetDir, fs); !isDir {
return nil, errors.New("Target path \"" + targetDir + "\" already exists but not a directory")
return errors.New("target path \"" + targetDir + "\" exists but is not a directory")
}
isEmpty, _ := helpers.IsEmpty(targetDir, fs)
if !isEmpty && !force {
return nil, errors.New("Target path \"" + targetDir + "\" already exists and is not empty")
return errors.New("target path \"" + targetDir + "\" exists and is not empty")
}
}
@@ -227,7 +232,7 @@ func (i *importCmd) createSiteFromJekyll(jekyllRoot, targetDir string, jekyllPos
i.copyJekyllFilesAndFolders(jekyllRoot, filepath.Join(targetDir, "static"), jekyllPostDirs)
return s, nil
return nil
}
func (i *importCmd) loadJekyllConfig(fs afero.Fs, jekyllRoot string) map[string]interface{} {
@@ -248,13 +253,11 @@ func (i *importCmd) loadJekyllConfig(fs afero.Fs, jekyllRoot string) map[string]
defer f.Close()
b, err := ioutil.ReadAll(f)
if err != nil {
return nil
}
c, err := parser.HandleYAMLMetaData(b)
c, err := metadecoders.Default.UnmarshalToMap(b, metadecoders.YAML)
if err != nil {
return nil
}
@@ -262,7 +265,7 @@ func (i *importCmd) loadJekyllConfig(fs afero.Fs, jekyllRoot string) map[string]
return c
}
func (i *importCmd) createConfigFromJekyll(fs afero.Fs, inpath string, kind string, jekyllConfig map[string]interface{}) (err error) {
func (i *importCmd) createConfigFromJekyll(fs afero.Fs, inpath string, kind metadecoders.Format, jekyllConfig map[string]interface{}) (err error) {
title := "My New Hugo Site"
baseURL := "http://example.org/"
@@ -288,77 +291,20 @@ func (i *importCmd) createConfigFromJekyll(fs afero.Fs, inpath string, kind stri
"languageCode": "en-us",
"disablePathToLower": true,
}
kind = parser.FormatSanitize(kind)
var buf bytes.Buffer
err = parser.InterfaceToConfig(in, parser.FormatToLeadRune(kind), &buf)
err = parser.InterfaceToConfig(in, kind, &buf)
if err != nil {
return err
}
return helpers.WriteToDisk(filepath.Join(inpath, "config."+kind), &buf, fs)
}
func copyFile(source string, dest string) error {
sf, err := os.Open(source)
if err != nil {
return err
}
defer sf.Close()
df, err := os.Create(dest)
if err != nil {
return err
}
defer df.Close()
_, err = io.Copy(df, sf)
if err == nil {
si, err := os.Stat(source)
if err != nil {
err = os.Chmod(dest, si.Mode())
if err != nil {
return err
}
}
}
return nil
}
func copyDir(source string, dest string) error {
fi, err := os.Stat(source)
if err != nil {
return err
}
if !fi.IsDir() {
return errors.New(source + " is not a directory")
}
err = os.MkdirAll(dest, fi.Mode())
if err != nil {
return err
}
entries, err := ioutil.ReadDir(source)
for _, entry := range entries {
sfp := filepath.Join(source, entry.Name())
dfp := filepath.Join(dest, entry.Name())
if entry.IsDir() {
err = copyDir(sfp, dfp)
if err != nil {
jww.ERROR.Println(err)
}
} else {
err = copyFile(sfp, dfp)
if err != nil {
jww.ERROR.Println(err)
}
}
}
return nil
return helpers.WriteToDisk(filepath.Join(inpath, "config."+string(kind)), &buf, fs)
}
func (i *importCmd) copyJekyllFilesAndFolders(jekyllRoot, dest string, jekyllPostDirs map[string]bool) (err error) {
fi, err := os.Stat(jekyllRoot)
fs := hugofs.Os
fi, err := fs.Stat(jekyllRoot)
if err != nil {
return err
}
@@ -370,13 +316,17 @@ func (i *importCmd) copyJekyllFilesAndFolders(jekyllRoot, dest string, jekyllPos
return err
}
entries, err := ioutil.ReadDir(jekyllRoot)
if err != nil {
return err
}
for _, entry := range entries {
sfp := filepath.Join(jekyllRoot, entry.Name())
dfp := filepath.Join(dest, entry.Name())
if entry.IsDir() {
if entry.Name()[0] != '_' && entry.Name()[0] != '.' {
if _, ok := jekyllPostDirs[entry.Name()]; !ok {
err = copyDir(sfp, dfp)
err = hugio.CopyDir(fs, sfp, dfp, nil)
if err != nil {
jww.ERROR.Println(err)
}
@@ -384,8 +334,10 @@ func (i *importCmd) copyJekyllFilesAndFolders(jekyllRoot, dest string, jekyllPos
}
} else {
lowerEntryName := strings.ToLower(entry.Name())
exceptSuffix := []string{".md", ".markdown", ".html", ".htm",
".xml", ".textile", "rakefile", "gemfile", ".lock"}
exceptSuffix := []string{
".md", ".markdown", ".html", ".htm",
".xml", ".textile", "rakefile", "gemfile", ".lock",
}
isExcept := false
for _, suffix := range exceptSuffix {
if strings.HasSuffix(lowerEntryName, suffix) {
@@ -395,7 +347,7 @@ func (i *importCmd) copyJekyllFilesAndFolders(jekyllRoot, dest string, jekyllPos
}
if !isExcept && entry.Name()[0] != '.' && entry.Name()[0] != '_' {
err = copyFile(sfp, dfp)
err = hugio.CopyFile(fs, sfp, dfp)
if err != nil {
jww.ERROR.Println(err)
}
@@ -423,7 +375,7 @@ func parseJekyllFilename(filename string) (time.Time, string, error) {
return postDate, postName, nil
}
func convertJekyllPost(s *hugolib.Site, path, relPath, targetDir string, draft bool) error {
func convertJekyllPost(path, relPath, targetDir string, draft bool) error {
jww.TRACE.Println("Converting", path)
filename := filepath.Base(path)
@@ -445,44 +397,34 @@ func convertJekyllPost(s *hugolib.Site, path, relPath, targetDir string, draft b
return err
}
psr, err := parser.ReadFrom(bytes.NewReader(contentBytes))
pf, err := pageparser.ParseFrontMatterAndContent(bytes.NewReader(contentBytes))
if err != nil {
jww.ERROR.Println("Parse file error:", path)
return err
}
metadata, err := psr.Metadata()
if err != nil {
jww.ERROR.Println("Processing file error:", path)
return err
}
newmetadata, err := convertJekyllMetaData(metadata, postName, postDate, draft)
newmetadata, err := convertJekyllMetaData(pf.FrontMatter, postName, postDate, draft)
if err != nil {
jww.ERROR.Println("Convert metadata error:", path)
return err
}
jww.TRACE.Println(newmetadata)
content := convertJekyllContent(newmetadata, string(psr.Content()))
page, err := s.NewPage(filename)
content, err := convertJekyllContent(newmetadata, string(pf.Content))
if err != nil {
jww.ERROR.Println("New page error", filename)
jww.ERROR.Println("Converting Jekyll error:", path)
return err
}
page.SetSourceContent([]byte(content))
page.SetSourceMetaData(newmetadata, parser.FormatToLeadRune("yaml"))
page.SaveSourceAs(targetFile)
jww.TRACE.Println("Target file:", targetFile)
fs := hugofs.Os
if err := helpers.WriteToDisk(targetFile, strings.NewReader(content), fs); err != nil {
return fmt.Errorf("failed to save file %q: %s", filename, err)
}
return nil
}
func convertJekyllMetaData(m interface{}, postName string, postDate time.Time, draft bool) (interface{}, error) {
metadata, err := cast.ToStringMapE(m)
metadata, err := maps.ToStringMapE(m)
if err != nil {
return nil, err
}
@@ -533,8 +475,8 @@ func convertJekyllMetaData(m interface{}, postName string, postDate time.Time, d
return metadata, nil
}
func convertJekyllContent(m interface{}, content string) string {
metadata, _ := cast.ToStringMapE(m)
func convertJekyllContent(m interface{}, content string) (string, error) {
metadata, _ := maps.ToStringMapE(m)
lines := strings.Split(content, "\n")
var resultLines []string
@@ -557,7 +499,6 @@ func convertJekyllContent(m interface{}, content string) string {
}{
{regexp.MustCompile("(?i)<!-- more -->"), "<!--more-->"},
{regexp.MustCompile(`\{%\s*raw\s*%\}\s*(.*?)\s*\{%\s*endraw\s*%\}`), "$1"},
{regexp.MustCompile(`{%\s*highlight\s*(.*?)\s*%}`), "{{< highlight $1 >}}"},
{regexp.MustCompile(`{%\s*endhighlight\s*%}`), "{{< / highlight >}}"},
}
@@ -571,13 +512,67 @@ func convertJekyllContent(m interface{}, content string) string {
}{
// Octopress image tag: http://octopress.org/docs/plugins/image-tag/
{regexp.MustCompile(`{%\s+img\s*(.*?)\s*%}`), replaceImageTag},
{regexp.MustCompile(`{%\s*highlight\s*(.*?)\s*%}`), replaceHighlightTag},
}
for _, replace := range replaceListFunc {
content = replace.re.ReplaceAllStringFunc(content, replace.replace)
}
return content
var buf bytes.Buffer
if len(metadata) != 0 {
err := parser.InterfaceToFrontMatter(m, metadecoders.YAML, &buf)
if err != nil {
return "", err
}
}
buf.WriteString(content)
return buf.String(), nil
}
func replaceHighlightTag(match string) string {
r := regexp.MustCompile(`{%\s*highlight\s*(.*?)\s*%}`)
parts := r.FindStringSubmatch(match)
lastQuote := rune(0)
f := func(c rune) bool {
switch {
case c == lastQuote:
lastQuote = rune(0)
return false
case lastQuote != rune(0):
return false
case unicode.In(c, unicode.Quotation_Mark):
lastQuote = c
return false
default:
return unicode.IsSpace(c)
}
}
// splitting string by space but considering quoted section
items := strings.FieldsFunc(parts[1], f)
result := bytes.NewBufferString("{{< highlight ")
result.WriteString(items[0]) // language
options := items[1:]
for i, opt := range options {
opt = strings.Replace(opt, "\"", "", -1)
if opt == "linenos" {
opt = "linenos=table"
}
if i == 0 {
opt = " \"" + opt
}
if i < len(options)-1 {
opt += ","
} else if i == len(options)-1 {
opt += "\""
}
result.WriteString(opt)
}
result.WriteString(" >}}")
return result.String()
}
func replaceImageTag(match string) string {
@@ -605,8 +600,8 @@ func replaceImageTag(match string) string {
}
result.WriteString(">}}")
return result.String()
}
func replaceOptionalPart(buffer *bytes.Buffer, partName string, part string) {
if len(part) > 0 {
buffer.WriteString(partName + "=\"" + part + "\" ")
+95 -44
View File
@@ -15,12 +15,14 @@ package commands
import (
"encoding/json"
"github.com/stretchr/testify/assert"
"testing"
"time"
qt "github.com/frankban/quicktest"
)
func TestParseJekyllFilename(t *testing.T) {
c := qt.New(t)
filenameArray := []string{
"2015-01-02-test.md",
"2012-03-15-中文.markup",
@@ -36,13 +38,14 @@ func TestParseJekyllFilename(t *testing.T) {
for i, filename := range filenameArray {
postDate, postName, err := parseJekyllFilename(filename)
assert.Equal(t, err, nil)
assert.Equal(t, expectResult[i].postDate.Format("2006-01-02"), postDate.Format("2006-01-02"))
assert.Equal(t, expectResult[i].postName, postName)
c.Assert(err, qt.IsNil)
c.Assert(expectResult[i].postDate.Format("2006-01-02"), qt.Equals, postDate.Format("2006-01-02"))
c.Assert(expectResult[i].postName, qt.Equals, postName)
}
}
func TestConvertJekyllMetadata(t *testing.T) {
c := qt.New(t)
testDataList := []struct {
metadata interface{}
postName string
@@ -50,77 +53,125 @@ func TestConvertJekyllMetadata(t *testing.T) {
draft bool
expect string
}{
{map[interface{}]interface{}{}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
`{"date":"2015-10-01T00:00:00Z"}`},
{map[interface{}]interface{}{}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), true,
`{"date":"2015-10-01T00:00:00Z","draft":true}`},
{map[interface{}]interface{}{"Permalink": "/permalink.html", "layout": "post"},
{
map[interface{}]interface{}{},
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
`{"date":"2015-10-01T00:00:00Z","url":"/permalink.html"}`},
{map[interface{}]interface{}{"permalink": "/permalink.html"},
`{"date":"2015-10-01T00:00:00Z"}`,
},
{
map[interface{}]interface{}{},
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), true,
`{"date":"2015-10-01T00:00:00Z","draft":true}`,
},
{
map[interface{}]interface{}{"Permalink": "/permalink.html", "layout": "post"},
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
`{"date":"2015-10-01T00:00:00Z","url":"/permalink.html"}`},
{map[interface{}]interface{}{"category": nil, "permalink": 123},
`{"date":"2015-10-01T00:00:00Z","url":"/permalink.html"}`,
},
{
map[interface{}]interface{}{"permalink": "/permalink.html"},
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
`{"date":"2015-10-01T00:00:00Z"}`},
{map[interface{}]interface{}{"Excerpt_Separator": "sep"},
`{"date":"2015-10-01T00:00:00Z","url":"/permalink.html"}`,
},
{
map[interface{}]interface{}{"category": nil, "permalink": 123},
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
`{"date":"2015-10-01T00:00:00Z","excerpt_separator":"sep"}`},
{map[interface{}]interface{}{"category": "book", "layout": "post", "Others": "Goods", "Date": "2015-10-01 12:13:11"},
`{"date":"2015-10-01T00:00:00Z"}`,
},
{
map[interface{}]interface{}{"Excerpt_Separator": "sep"},
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
`{"Others":"Goods","categories":["book"],"date":"2015-10-01T12:13:11Z"}`},
`{"date":"2015-10-01T00:00:00Z","excerpt_separator":"sep"}`,
},
{
map[interface{}]interface{}{"category": "book", "layout": "post", "Others": "Goods", "Date": "2015-10-01 12:13:11"},
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
`{"Others":"Goods","categories":["book"],"date":"2015-10-01T12:13:11Z"}`,
},
}
for _, data := range testDataList {
result, err := convertJekyllMetaData(data.metadata, data.postName, data.postDate, data.draft)
assert.Equal(t, nil, err)
c.Assert(err, qt.IsNil)
jsonResult, err := json.Marshal(result)
assert.Equal(t, nil, err)
assert.Equal(t, data.expect, string(jsonResult))
c.Assert(err, qt.IsNil)
c.Assert(string(jsonResult), qt.Equals, data.expect)
}
}
func TestConvertJekyllContent(t *testing.T) {
c := qt.New(t)
testDataList := []struct {
metadata interface{}
content string
expect string
}{
{map[interface{}]interface{}{},
`Test content\n<!-- more -->\npart2 content`, `Test content\n<!--more-->\npart2 content`},
{map[interface{}]interface{}{},
`Test content\n<!-- More -->\npart2 content`, `Test content\n<!--more-->\npart2 content`},
{map[interface{}]interface{}{"excerpt_separator": "<!--sep-->"},
`Test content\n<!--sep-->\npart2 content`, `Test content\n<!--more-->\npart2 content`},
{
map[interface{}]interface{}{},
"Test content\r\n<!-- more -->\npart2 content", "Test content\n<!--more-->\npart2 content",
},
{
map[interface{}]interface{}{},
"Test content\n<!-- More -->\npart2 content", "Test content\n<!--more-->\npart2 content",
},
{
map[interface{}]interface{}{"excerpt_separator": "<!--sep-->"},
"Test content\n<!--sep-->\npart2 content",
"---\nexcerpt_separator: <!--sep-->\n---\nTest content\n<!--more-->\npart2 content",
},
{map[interface{}]interface{}{}, "{% raw %}text{% endraw %}", "text"},
{map[interface{}]interface{}{}, "{%raw%} text2 {%endraw %}", "text2"},
{map[interface{}]interface{}{},
{
map[interface{}]interface{}{},
"{% highlight go %}\nvar s int\n{% endhighlight %}",
"{{< highlight go >}}\nvar s int\n{{< / highlight >}}"},
"{{< highlight go >}}\nvar s int\n{{< / highlight >}}",
},
{
map[interface{}]interface{}{},
"{% highlight go linenos hl_lines=\"1 2\" %}\nvar s string\nvar i int\n{% endhighlight %}",
"{{< highlight go \"linenos=table,hl_lines=1 2\" >}}\nvar s string\nvar i int\n{{< / highlight >}}",
},
// Octopress image tag
{map[interface{}]interface{}{},
{
map[interface{}]interface{}{},
"{% img http://placekitten.com/890/280 %}",
"{{< figure src=\"http://placekitten.com/890/280\" >}}"},
{map[interface{}]interface{}{},
"{{< figure src=\"http://placekitten.com/890/280\" >}}",
},
{
map[interface{}]interface{}{},
"{% img left http://placekitten.com/320/250 Place Kitten #2 %}",
"{{< figure class=\"left\" src=\"http://placekitten.com/320/250\" title=\"Place Kitten #2\" >}}"},
{map[interface{}]interface{}{},
"{{< figure class=\"left\" src=\"http://placekitten.com/320/250\" title=\"Place Kitten #2\" >}}",
},
{
map[interface{}]interface{}{},
"{% img right http://placekitten.com/300/500 150 250 'Place Kitten #3' %}",
"{{< figure class=\"right\" src=\"http://placekitten.com/300/500\" width=\"150\" height=\"250\" title=\"Place Kitten #3\" >}}"},
{map[interface{}]interface{}{},
"{{< figure class=\"right\" src=\"http://placekitten.com/300/500\" width=\"150\" height=\"250\" title=\"Place Kitten #3\" >}}",
},
{
map[interface{}]interface{}{},
"{% img right http://placekitten.com/300/500 150 250 'Place Kitten #4' 'An image of a very cute kitten' %}",
"{{< figure class=\"right\" src=\"http://placekitten.com/300/500\" width=\"150\" height=\"250\" title=\"Place Kitten #4\" alt=\"An image of a very cute kitten\" >}}"},
{map[interface{}]interface{}{},
"{{< figure class=\"right\" src=\"http://placekitten.com/300/500\" width=\"150\" height=\"250\" title=\"Place Kitten #4\" alt=\"An image of a very cute kitten\" >}}",
},
{
map[interface{}]interface{}{},
"{% img http://placekitten.com/300/500 150 250 'Place Kitten #4' 'An image of a very cute kitten' %}",
"{{< figure src=\"http://placekitten.com/300/500\" width=\"150\" height=\"250\" title=\"Place Kitten #4\" alt=\"An image of a very cute kitten\" >}}"},
{map[interface{}]interface{}{},
"{{< figure src=\"http://placekitten.com/300/500\" width=\"150\" height=\"250\" title=\"Place Kitten #4\" alt=\"An image of a very cute kitten\" >}}",
},
{
map[interface{}]interface{}{},
"{% img right /placekitten/300/500 'Place Kitten #4' 'An image of a very cute kitten' %}",
"{{< figure class=\"right\" src=\"/placekitten/300/500\" title=\"Place Kitten #4\" alt=\"An image of a very cute kitten\" >}}"},
"{{< figure class=\"right\" src=\"/placekitten/300/500\" title=\"Place Kitten #4\" alt=\"An image of a very cute kitten\" >}}",
},
{
map[interface{}]interface{}{"category": "book", "layout": "post", "Date": "2015-10-01 12:13:11"},
"somecontent",
"---\nDate: \"2015-10-01 12:13:11\"\ncategory: book\nlayout: post\n---\nsomecontent",
},
}
for _, data := range testDataList {
result := convertJekyllContent(data.metadata, data.content)
assert.Equal(t, data.expect, result)
result, err := convertJekyllContent(data.metadata, data.content)
c.Assert(result, qt.Equals, data.expect)
c.Assert(err, qt.IsNil)
}
}
+14 -8
View File
@@ -36,14 +36,17 @@ This is primarily to ensure that Hugo can watch enough files on some OSs`,
var rLimit syscall.Rlimit
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
if err != nil {
return newSystemError("Error Getting Rlimit ", err)
return newSystemError("Error Getting rlimit ", err)
}
jww.FEEDBACK.Println("Current rLimit:", rLimit)
if rLimit.Cur >= newRlimit {
return nil
}
jww.FEEDBACK.Println("Attempting to increase limit")
rLimit.Max = 999999
rLimit.Cur = 999999
rLimit.Cur = newRlimit
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
if err != nil {
return newSystemError("Error Setting rLimit ", err)
@@ -61,18 +64,21 @@ This is primarily to ensure that Hugo can watch enough files on some OSs`,
return &limitCmd{baseCmd: newBaseCmd(ccmd)}
}
const newRlimit = 10240
func tweakLimit() {
var rLimit syscall.Rlimit
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
if err != nil {
jww.ERROR.Println("Unable to obtain rLimit", err)
jww.WARN.Println("Unable to get rlimit:", err)
return
}
if rLimit.Cur < rLimit.Max {
rLimit.Max = 64000
rLimit.Cur = 64000
if rLimit.Cur < newRlimit {
rLimit.Cur = newRlimit
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
if err != nil {
jww.WARN.Println("Unable to increase number of open files limit", err)
// This may not succeed, see https://github.com/golang/go/issues/30401
jww.INFO.Println("Unable to increase number of open files limit:", err)
}
}
}
+116 -71
View File
@@ -1,4 +1,4 @@
// Copyright 2015 The Hugo Authors. All rights reserved.
// Copyright 2019 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.
@@ -14,9 +14,14 @@
package commands
import (
"path/filepath"
"encoding/csv"
"os"
"strconv"
"strings"
"time"
"github.com/gohugoio/hugo/hugolib"
"github.com/gohugoio/hugo/resources/resource"
"github.com/spf13/cobra"
jww "github.com/spf13/jwalterweatherman"
)
@@ -24,134 +29,174 @@ import (
var _ cmder = (*listCmd)(nil)
type listCmd struct {
hugoBuilderCommon
*baseCmd
*baseBuilderCmd
}
func newListCmd() *listCmd {
func (lc *listCmd) buildSites(config map[string]interface{}) (*hugolib.HugoSites, error) {
cfgInit := func(c *commandeer) error {
for key, value := range config {
c.Set(key, value)
}
return nil
}
c, err := initializeConfig(true, true, false, &lc.hugoBuilderCommon, lc, cfgInit)
if err != nil {
return nil, err
}
sites, err := hugolib.NewHugoSites(*c.DepsCfg)
if err != nil {
return nil, newSystemError("Error creating sites", err)
}
if err := sites.Build(hugolib.BuildCfg{SkipRender: true}); err != nil {
return nil, newSystemError("Error Processing Source Content", err)
}
return sites, nil
}
func (b *commandsBuilder) newListCmd() *listCmd {
cc := &listCmd{}
cc.baseCmd = newBaseCmd(&cobra.Command{
cmd := &cobra.Command{
Use: "list",
Short: "Listing out various types of content",
Long: `Listing out various types of content.
List requires a subcommand, e.g. ` + "`hugo list drafts`.",
RunE: nil,
})
}
cc.cmd.AddCommand(
cmd.AddCommand(
&cobra.Command{
Use: "drafts",
Short: "List all drafts",
Long: `List all of the drafts in your content directory.`,
RunE: func(cmd *cobra.Command, args []string) error {
cfgInit := func(c *commandeer) error {
c.Set("buildDrafts", true)
return nil
}
c, err := initializeConfig(true, false, &cc.hugoBuilderCommon, cc, cfgInit)
sites, err := cc.buildSites(map[string]interface{}{"buildDrafts": true})
if err != nil {
return err
}
sites, err := hugolib.NewHugoSites(*c.DepsCfg)
if err != nil {
return newSystemError("Error creating sites", err)
}
if err := sites.Build(hugolib.BuildCfg{SkipRender: true}); err != nil {
return newSystemError("Error Processing Source Content", err)
return newSystemError("Error building sites", err)
}
for _, p := range sites.Pages() {
if p.IsDraft() {
jww.FEEDBACK.Println(filepath.Join(p.File.Dir(), p.File.LogicalName()))
if p.Draft() {
jww.FEEDBACK.Println(strings.TrimPrefix(p.File().Filename(), sites.WorkingDir+string(os.PathSeparator)))
}
}
return nil
},
},
&cobra.Command{
Use: "future",
Short: "List all posts dated in the future",
Long: `List all of the posts in your content directory which will be
posted in the future.`,
Long: `List all of the posts in your content directory which will be posted in the future.`,
RunE: func(cmd *cobra.Command, args []string) error {
cfgInit := func(c *commandeer) error {
c.Set("buildFuture", true)
return nil
}
c, err := initializeConfig(true, false, &cc.hugoBuilderCommon, cc, cfgInit)
sites, err := cc.buildSites(map[string]interface{}{"buildFuture": true})
if err != nil {
return err
return newSystemError("Error building sites", err)
}
sites, err := hugolib.NewHugoSites(*c.DepsCfg)
if err != nil {
return newSystemError("Error creating sites", err)
}
if err := sites.Build(hugolib.BuildCfg{SkipRender: true}); err != nil {
return newSystemError("Error Processing Source Content", err)
}
writer := csv.NewWriter(os.Stdout)
defer writer.Flush()
for _, p := range sites.Pages() {
if p.IsFuture() {
jww.FEEDBACK.Println(filepath.Join(p.File.Dir(), p.File.LogicalName()))
if resource.IsFuture(p) {
err := writer.Write([]string{
strings.TrimPrefix(p.File().Filename(), sites.WorkingDir+string(os.PathSeparator)),
p.PublishDate().Format(time.RFC3339),
})
if err != nil {
return newSystemError("Error writing future posts to stdout", err)
}
}
}
return nil
},
},
&cobra.Command{
Use: "expired",
Short: "List all posts already expired",
Long: `List all of the posts in your content directory which has already
expired.`,
Long: `List all of the posts in your content directory which has already expired.`,
RunE: func(cmd *cobra.Command, args []string) error {
cfgInit := func(c *commandeer) error {
c.Set("buildExpired", true)
return nil
}
c, err := initializeConfig(true, false, &cc.hugoBuilderCommon, cc, cfgInit)
sites, err := cc.buildSites(map[string]interface{}{"buildExpired": true})
if err != nil {
return err
return newSystemError("Error building sites", err)
}
sites, err := hugolib.NewHugoSites(*c.DepsCfg)
if err != nil {
return newSystemError("Error creating sites", err)
}
if err := sites.Build(hugolib.BuildCfg{SkipRender: true}); err != nil {
return newSystemError("Error Processing Source Content", err)
}
writer := csv.NewWriter(os.Stdout)
defer writer.Flush()
for _, p := range sites.Pages() {
if p.IsExpired() {
jww.FEEDBACK.Println(filepath.Join(p.File.Dir(), p.File.LogicalName()))
if resource.IsExpired(p) {
err := writer.Write([]string{
strings.TrimPrefix(p.File().Filename(), sites.WorkingDir+string(os.PathSeparator)),
p.ExpiryDate().Format(time.RFC3339),
})
if err != nil {
return newSystemError("Error writing expired posts to stdout", err)
}
}
}
return nil
},
},
&cobra.Command{
Use: "all",
Short: "List all posts",
Long: `List all of the posts in your content directory, include drafts, future and expired pages.`,
RunE: func(cmd *cobra.Command, args []string) error {
sites, err := cc.buildSites(map[string]interface{}{
"buildExpired": true,
"buildDrafts": true,
"buildFuture": true,
})
if err != nil {
return newSystemError("Error building sites", err)
}
writer := csv.NewWriter(os.Stdout)
defer writer.Flush()
writer.Write([]string{
"path",
"slug",
"title",
"date",
"expiryDate",
"publishDate",
"draft",
"permalink",
})
for _, p := range sites.Pages() {
if !p.IsPage() {
continue
}
err := writer.Write([]string{
strings.TrimPrefix(p.File().Filename(), sites.WorkingDir+string(os.PathSeparator)),
p.Slug(),
p.Title(),
p.Date().Format(time.RFC3339),
p.ExpiryDate().Format(time.RFC3339),
p.PublishDate().Format(time.RFC3339),
strconv.FormatBool(p.Draft()),
p.Permalink(),
})
if err != nil {
return newSystemError("Error writing posts to stdout", err)
}
}
return nil
},
},
)
cc.cmd.PersistentFlags().StringVarP(&cc.source, "source", "s", "", "filesystem path to read files relative from")
cc.cmd.PersistentFlags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{})
cc.baseBuilderCmd = b.newBuilderBasicCmd(cmd)
return cc
}
+71
View File
@@ -0,0 +1,71 @@
package commands
import (
"bytes"
"encoding/csv"
"io"
"os"
"path/filepath"
"strings"
"testing"
qt "github.com/frankban/quicktest"
)
func captureStdout(f func() error) (string, error) {
old := os.Stdout
r, w, _ := os.Pipe()
os.Stdout = w
err := f()
w.Close()
os.Stdout = old
var buf bytes.Buffer
io.Copy(&buf, r)
return buf.String(), err
}
func TestListAll(t *testing.T) {
c := qt.New(t)
dir, clean, err := createSimpleTestSite(t, testSiteConfig{})
defer clean()
c.Assert(err, qt.IsNil)
hugoCmd := newCommandsBuilder().addAll().build()
cmd := hugoCmd.getCommand()
defer func() {
os.RemoveAll(dir)
}()
cmd.SetArgs([]string{"-s=" + dir, "list", "all"})
out, err := captureStdout(func() error {
_, err := cmd.ExecuteC()
return err
})
c.Assert(err, qt.IsNil)
r := csv.NewReader(strings.NewReader(out))
header, err := r.Read()
c.Assert(err, qt.IsNil)
c.Assert(header, qt.DeepEquals, []string{
"path", "slug", "title",
"date", "expiryDate", "publishDate",
"draft", "permalink",
})
record, err := r.Read()
c.Assert(err, qt.IsNil)
c.Assert(record, qt.DeepEquals, []string{
filepath.Join("content", "p1.md"), "", "P1",
"0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z",
"false", "https://example.org/p1/",
})
}
+293
View File
@@ -0,0 +1,293 @@
// Copyright 2020 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 (
"errors"
"fmt"
"os"
"path/filepath"
"regexp"
"github.com/gohugoio/hugo/hugolib"
"github.com/gohugoio/hugo/modules"
"github.com/spf13/cobra"
)
var _ cmder = (*modCmd)(nil)
type modCmd struct {
*baseBuilderCmd
}
func (c *modCmd) newVerifyCmd() *cobra.Command {
var clean bool
verifyCmd := &cobra.Command{
Use: "verify",
Short: "Verify dependencies.",
Long: `Verify checks that the dependencies of the current module, which are stored in a local downloaded source cache, have not been modified since being downloaded.
`,
RunE: func(cmd *cobra.Command, args []string) error {
return c.withModsClient(true, func(c *modules.Client) error {
return c.Verify(clean)
})
},
}
verifyCmd.Flags().BoolVarP(&clean, "clean", "", false, "delete module cache for dependencies that fail verification")
return verifyCmd
}
var moduleNotFoundRe = regexp.MustCompile("module.*not found")
func (c *modCmd) newCleanCmd() *cobra.Command {
var pattern string
var all bool
cmd := &cobra.Command{
Use: "clean",
Short: "Delete the Hugo Module cache for the current project.",
Long: `Delete the Hugo Module cache for the current project.
Note that after you run this command, all of your dependencies will be re-downloaded next time you run "hugo".
Also note that if you configure a positive maxAge for the "modules" file cache, it will also be cleaned as part of "hugo --gc".
`,
RunE: func(cmd *cobra.Command, args []string) error {
if all {
com, err := c.initConfig(false)
if err != nil && com == nil {
return err
}
count, err := com.hugo().FileCaches.ModulesCache().Prune(true)
com.logger.Printf("Deleted %d files from module cache.", count)
return err
}
return c.withModsClient(true, func(c *modules.Client) error {
return c.Clean(pattern)
})
},
}
cmd.Flags().StringVarP(&pattern, "pattern", "", "", `pattern matching module paths to clean (all if not set), e.g. "**hugo*"`)
cmd.Flags().BoolVarP(&all, "all", "", false, "clean entire module cache")
return cmd
}
func (b *commandsBuilder) newModCmd() *modCmd {
c := &modCmd{}
const commonUsage = `
Note that Hugo will always start out by resolving the components defined in the site
configuration, provided by a _vendor directory (if no --ignoreVendor flag provided),
Go Modules, or a folder inside the themes directory, in that order.
See https://gohugo.io/hugo-modules/ for more information.
`
cmd := &cobra.Command{
Use: "mod",
Short: "Various Hugo Modules helpers.",
Long: `Various helpers to help manage the modules in your project's dependency graph.
Most operations here requires a Go version installed on your system (>= Go 1.12) and the relevant VCS client (typically Git).
This is not needed if you only operate on modules inside /themes or if you have vendored them via "hugo mod vendor".
` + commonUsage,
RunE: nil,
}
cmd.AddCommand(newModNPMCmd(c))
cmd.AddCommand(
&cobra.Command{
Use: "get",
DisableFlagParsing: true,
Short: "Resolves dependencies in your current Hugo Project.",
Long: `
Resolves dependencies in your current Hugo Project.
Some examples:
Install the latest version possible for a given module:
hugo mod get github.com/gohugoio/testshortcodes
Install a specific version:
hugo mod get github.com/gohugoio/testshortcodes@v0.3.0
Install the latest versions of all module dependencies:
hugo mod get -u
hugo mod get -u ./... (recursive)
Run "go help get" for more information. All flags available for "go get" is also relevant here.
` + commonUsage,
RunE: func(cmd *cobra.Command, args []string) error {
// We currently just pass on the flags we get to Go and
// need to do the flag handling manually.
if len(args) == 1 && args[0] == "-h" {
return cmd.Help()
}
var lastArg string
if len(args) != 0 {
lastArg = args[len(args)-1]
}
if lastArg == "./..." {
args = args[:len(args)-1]
// Do a recursive update.
dirname, err := os.Getwd()
if err != nil {
return err
}
// Sanity check. We do recursive walking and want to avoid
// accidents.
if len(dirname) < 5 {
return errors.New("must not be run from the file system root")
}
filepath.Walk(dirname, func(path string, info os.FileInfo, err error) error {
if info.IsDir() {
return nil
}
if info.Name() == "go.mod" {
// Found a module.
dir := filepath.Dir(path)
fmt.Println("Update module in", dir)
c.source = dir
err := c.withModsClient(false, func(c *modules.Client) error {
if len(args) == 1 && args[0] == "-h" {
return cmd.Help()
}
return c.Get(args...)
})
if err != nil {
return err
}
}
return nil
})
return nil
}
return c.withModsClient(false, func(c *modules.Client) error {
return c.Get(args...)
})
},
},
&cobra.Command{
Use: "graph",
Short: "Print a module dependency graph.",
Long: `Print a module dependency graph with information about module status (disabled, vendored).
Note that for vendored modules, that is the version listed and not the one from go.mod.
`,
RunE: func(cmd *cobra.Command, args []string) error {
return c.withModsClient(true, func(c *modules.Client) error {
return c.Graph(os.Stdout)
})
},
},
&cobra.Command{
Use: "init",
Short: "Initialize this project as a Hugo Module.",
Long: `Initialize this project as a Hugo Module.
It will try to guess the module path, but you may help by passing it as an argument, e.g:
hugo mod init github.com/gohugoio/testshortcodes
Note that Hugo Modules supports multi-module projects, so you can initialize a Hugo Module
inside a subfolder on GitHub, as one example.
`,
RunE: func(cmd *cobra.Command, args []string) error {
var path string
if len(args) >= 1 {
path = args[0]
}
return c.withModsClient(false, func(c *modules.Client) error {
return c.Init(path)
})
},
},
&cobra.Command{
Use: "vendor",
Short: "Vendor all module dependencies into the _vendor directory.",
Long: `Vendor all module dependencies into the _vendor directory.
If a module is vendored, that is where Hugo will look for it's dependencies.
`,
RunE: func(cmd *cobra.Command, args []string) error {
return c.withModsClient(true, func(c *modules.Client) error {
return c.Vendor()
})
},
},
c.newVerifyCmd(),
&cobra.Command{
Use: "tidy",
Short: "Remove unused entries in go.mod and go.sum.",
RunE: func(cmd *cobra.Command, args []string) error {
return c.withModsClient(true, func(c *modules.Client) error {
return c.Tidy()
})
},
},
c.newCleanCmd(),
)
c.baseBuilderCmd = b.newBuilderCmd(cmd)
return c
}
func (c *modCmd) withModsClient(failOnMissingConfig bool, f func(*modules.Client) error) error {
com, err := c.initConfig(failOnMissingConfig)
if err != nil {
return err
}
return f(com.hugo().ModulesClient)
}
func (c *modCmd) withHugo(f func(*hugolib.HugoSites) error) error {
com, err := c.initConfig(true)
if err != nil {
return err
}
return f(com.hugo())
}
func (c *modCmd) initConfig(failOnNoConfig bool) (*commandeer, error) {
com, err := initializeConfig(failOnNoConfig, false, false, &c.hugoBuilderCommon, c, nil)
if err != nil {
return nil, err
}
return com, nil
}
+56
View File
@@ -0,0 +1,56 @@
// Copyright 2020 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/hugolib"
"github.com/gohugoio/hugo/modules/npm"
"github.com/spf13/cobra"
)
func newModNPMCmd(c *modCmd) *cobra.Command {
cmd := &cobra.Command{
Use: "npm",
Short: "Various npm helpers.",
Long: `Various npm (Node package manager) helpers.`,
RunE: func(cmd *cobra.Command, args []string) error {
return c.withHugo(func(h *hugolib.HugoSites) error {
return nil
})
},
}
cmd.AddCommand(&cobra.Command{
Use: "pack",
Short: "Experimental: Prepares and writes a composite package.json file for your project.",
Long: `Prepares and writes a composite package.json file for your project.
On first run it creates a "package.hugo.json" in the project root if not already there. This file will be used as a template file
with the base dependency set.
This set will be merged with all "package.hugo.json" files found in the dependency tree, picking the version closest to the project.
This command is marked as 'Experimental'. We think it's a great idea, so it's not likely to be
removed from Hugo, but we need to test this out in "real life" to get a feel of it,
so this may/will change in future versions of Hugo.
`,
RunE: func(cmd *cobra.Command, args []string) error {
return c.withHugo(func(h *hugolib.HugoSites) error {
return npm.Pack(h.BaseFs.SourceFs, h.BaseFs.Assets.Dirs)
})
},
})
return cmd
}
+24 -60
View File
@@ -30,16 +30,14 @@ import (
var _ cmder = (*newCmd)(nil)
type newCmd struct {
hugoBuilderCommon
contentEditor string
contentType string
*baseCmd
*baseBuilderCmd
}
func newNewCmd() *newCmd {
cc := &newCmd{}
cc.baseCmd = newBaseCmd(&cobra.Command{
func (b *commandsBuilder) newNewCmd() *newCmd {
cmd := &cobra.Command{
Use: "new [path]",
Short: "Create new content for your site",
Long: `Create a new content file and automatically set the date and title.
@@ -47,18 +45,20 @@ It will guess which kind of file to create based on the path provided.
You can also specify the kind with ` + "`-k KIND`" + `.
If archetypes are provided in your theme or site, they will be used.`,
If archetypes are provided in your theme or site, they will be used.
RunE: cc.newContent,
})
Ensure you run this within the root directory of your site.`,
}
cc.cmd.Flags().StringVarP(&cc.contentType, "kind", "k", "", "content type to create")
cc.cmd.PersistentFlags().StringVarP(&cc.source, "source", "s", "", "filesystem path to read files relative from")
cc.cmd.PersistentFlags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{})
cc.cmd.Flags().StringVar(&cc.contentEditor, "editor", "", "edit new content with this editor, if provided")
cc := &newCmd{baseBuilderCmd: b.newBuilderCmd(cmd)}
cc.cmd.AddCommand(newNewSiteCmd().getCommand())
cc.cmd.AddCommand(newNewThemeCmd().getCommand())
cmd.Flags().StringVarP(&cc.contentType, "kind", "k", "", "content type to create")
cmd.Flags().StringVar(&cc.contentEditor, "editor", "", "edit new content with this editor, if provided")
cmd.AddCommand(b.newNewSiteCmd().getCommand())
cmd.AddCommand(b.newNewThemeCmd().getCommand())
cmd.RunE = cc.newContent
return cc
}
@@ -71,8 +71,7 @@ func (n *newCmd) newContent(cmd *cobra.Command, args []string) error {
return nil
}
c, err := initializeConfig(true, false, &n.hugoBuilderCommon, n, cfgInit)
c, err := initializeConfig(true, true, false, &n.hugoBuilderCommon, n, cfgInit)
if err != nil {
return err
}
@@ -81,49 +80,7 @@ func (n *newCmd) newContent(cmd *cobra.Command, args []string) error {
return newUserError("path needs to be provided")
}
createPath := args[0]
var kind string
createPath, kind = newContentPathSection(createPath)
if n.contentType != "" {
kind = n.contentType
}
cfg := c.DepsCfg
ps, err := helpers.NewPathSpec(cfg.Fs, cfg.Cfg)
if err != nil {
return err
}
// If a site isn't in use in the archetype template, we can skip the build.
siteFactory := func(filename string, siteUsed bool) (*hugolib.Site, error) {
if !siteUsed {
return hugolib.NewSite(*cfg)
}
var s *hugolib.Site
if err := c.hugo.Build(hugolib.BuildCfg{SkipRender: true}); err != nil {
return nil, err
}
s = c.hugo.Sites[0]
if len(c.hugo.Sites) > 1 {
// Find the best match.
for _, ss := range c.hugo.Sites {
if strings.Contains(createPath, "."+ss.Language.Lang) {
s = ss
break
}
}
}
return s, nil
}
return create.NewContent(ps, siteFactory, kind, createPath)
return create.NewContent(c.hugo(), n.contentType, args[0])
}
func mkdir(x ...string) {
@@ -144,10 +101,17 @@ func touchFile(fs afero.Fs, x ...string) {
}
}
func newContentPathSection(path string) (string, string) {
func newContentPathSection(h *hugolib.HugoSites, path string) (string, string) {
// Forward slashes is used in all examples. Convert if needed.
// Issue #1133
createpath := filepath.FromSlash(path)
if h != nil {
for _, dir := range h.BaseFs.Content.Dirs {
createpath = strings.TrimPrefix(createpath, dir.Meta().Filename)
}
}
var section string
// assume the first directory is the section (kind)
if strings.Contains(createpath[1:], helpers.FilePathSeparator) {
+6 -105
View File
@@ -1,4 +1,4 @@
// Copyright 2018 The Hugo Authors. All rights reserved.
// Copyright 2019 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.
@@ -17,112 +17,13 @@ import (
"path/filepath"
"testing"
"github.com/gohugoio/hugo/hugofs"
"github.com/spf13/viper"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
qt "github.com/frankban/quicktest"
)
// Issue #1133
func TestNewContentPathSectionWithForwardSlashes(t *testing.T) {
p, s := newContentPathSection("/post/new.md")
assert.Equal(t, filepath.FromSlash("/post/new.md"), p)
assert.Equal(t, "post", s)
}
func checkNewSiteInited(fs *hugofs.Fs, basepath string, t *testing.T) {
paths := []string{
filepath.Join(basepath, "layouts"),
filepath.Join(basepath, "content"),
filepath.Join(basepath, "archetypes"),
filepath.Join(basepath, "static"),
filepath.Join(basepath, "data"),
filepath.Join(basepath, "config.toml"),
}
for _, path := range paths {
_, err := fs.Source.Stat(path)
require.NoError(t, err)
}
}
func TestDoNewSite(t *testing.T) {
n := newNewSiteCmd()
basepath := filepath.Join("base", "blog")
_, fs := newTestCfg()
require.NoError(t, n.doNewSite(fs, basepath, false))
checkNewSiteInited(fs, basepath, t)
}
func TestDoNewSite_noerror_base_exists_but_empty(t *testing.T) {
basepath := filepath.Join("base", "blog")
_, fs := newTestCfg()
n := newNewSiteCmd()
require.NoError(t, fs.Source.MkdirAll(basepath, 777))
require.NoError(t, n.doNewSite(fs, basepath, false))
}
func TestDoNewSite_error_base_exists(t *testing.T) {
basepath := filepath.Join("base", "blog")
_, fs := newTestCfg()
n := newNewSiteCmd()
require.NoError(t, fs.Source.MkdirAll(basepath, 777))
_, err := fs.Source.Create(filepath.Join(basepath, "foo"))
require.NoError(t, err)
// Since the directory already exists and isn't empty, expect an error
require.Error(t, n.doNewSite(fs, basepath, false))
}
func TestDoNewSite_force_empty_dir(t *testing.T) {
basepath := filepath.Join("base", "blog")
_, fs := newTestCfg()
n := newNewSiteCmd()
require.NoError(t, fs.Source.MkdirAll(basepath, 777))
require.NoError(t, n.doNewSite(fs, basepath, true))
checkNewSiteInited(fs, basepath, t)
}
func TestDoNewSite_error_force_dir_inside_exists(t *testing.T) {
basepath := filepath.Join("base", "blog")
_, fs := newTestCfg()
n := newNewSiteCmd()
contentPath := filepath.Join(basepath, "content")
require.NoError(t, fs.Source.MkdirAll(contentPath, 777))
require.Error(t, n.doNewSite(fs, basepath, true))
}
func TestDoNewSite_error_force_config_inside_exists(t *testing.T) {
basepath := filepath.Join("base", "blog")
_, fs := newTestCfg()
n := newNewSiteCmd()
configPath := filepath.Join(basepath, "config.toml")
require.NoError(t, fs.Source.MkdirAll(basepath, 777))
_, err := fs.Source.Create(configPath)
require.NoError(t, err)
require.Error(t, n.doNewSite(fs, basepath, true))
}
func newTestCfg() (*viper.Viper, *hugofs.Fs) {
v := viper.New()
fs := hugofs.NewMem(v)
v.SetFs(fs.Source)
return v, fs
c := qt.New(t)
p, s := newContentPathSection(nil, "/post/new.md")
c.Assert(p, qt.Equals, filepath.FromSlash("/post/new.md"))
c.Assert(s, qt.Equals, "post")
}
+18 -17
View File
@@ -16,17 +16,20 @@ package commands
import (
"bytes"
"errors"
"fmt"
"path/filepath"
"strings"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/parser/metadecoders"
_errors "github.com/pkg/errors"
"github.com/gohugoio/hugo/create"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/hugofs"
"github.com/gohugoio/hugo/parser"
"github.com/spf13/cobra"
jww "github.com/spf13/jwalterweatherman"
"github.com/spf13/viper"
)
var _ cmder = (*newSiteCmd)(nil)
@@ -34,11 +37,11 @@ var _ cmder = (*newSiteCmd)(nil)
type newSiteCmd struct {
configFormat string
*baseCmd
*baseBuilderCmd
}
func newNewSiteCmd() *newSiteCmd {
ccmd := &newSiteCmd{}
func (b *commandsBuilder) newNewSiteCmd() *newSiteCmd {
cc := &newSiteCmd{}
cmd := &cobra.Command{
Use: "site [path]",
@@ -46,16 +49,15 @@ func newNewSiteCmd() *newSiteCmd {
Long: `Create a new site in the provided directory.
The new site will have the correct structure, but no content or theme yet.
Use ` + "`hugo new [contentPath]`" + ` to create new content.`,
RunE: ccmd.newSite,
RunE: cc.newSite,
}
cmd.Flags().StringVarP(&ccmd.configFormat, "format", "f", "toml", "config & frontmatter format")
cmd.Flags().StringVarP(&cc.configFormat, "format", "f", "toml", "config & frontmatter format")
cmd.Flags().Bool("force", false, "init inside non-empty directory")
ccmd.baseCmd = newBaseCmd(cmd)
return ccmd
cc.baseBuilderCmd = b.newBuilderBasicCmd(cmd)
return cc
}
func (n *newSiteCmd) doNewSite(fs *hugofs.Fs, basepath string, force bool) error {
@@ -78,7 +80,7 @@ func (n *newSiteCmd) doNewSite(fs *hugofs.Fs, basepath string, force bool) error
switch {
case !isEmpty && !force:
return errors.New(basepath + " already exists and is not empty")
return errors.New(basepath + " already exists and is not empty. See --force.")
case !isEmpty && force:
all := append(dirs, filepath.Join(basepath, "config."+n.configFormat))
@@ -92,7 +94,7 @@ func (n *newSiteCmd) doNewSite(fs *hugofs.Fs, basepath string, force bool) error
for _, dir := range dirs {
if err := fs.Source.MkdirAll(dir, 0777); err != nil {
return fmt.Errorf("Failed to create dir: %s", err)
return _errors.Wrap(err, "Failed to create dir")
}
}
@@ -100,7 +102,7 @@ func (n *newSiteCmd) doNewSite(fs *hugofs.Fs, basepath string, force bool) error
// Create a default archetype file.
helpers.SafeWriteToDisk(filepath.Join(archeTypePath, "default.md"),
strings.NewReader(create.ArchetypeTemplateTemplate), fs.Source)
strings.NewReader(create.DefaultArchetypeTemplateTemplate), fs.Source)
jww.FEEDBACK.Printf("Congratulations! Your new Hugo site is created in %s.\n\n", basepath)
jww.FEEDBACK.Println(nextStepsText())
@@ -121,7 +123,7 @@ func (n *newSiteCmd) newSite(cmd *cobra.Command, args []string) error {
forceNew, _ := cmd.Flags().GetBool("force")
return n.doNewSite(hugofs.NewDefault(viper.New()), createpath, forceNew)
return n.doNewSite(hugofs.NewDefault(config.New()), createpath, forceNew)
}
func createConfig(fs *hugofs.Fs, inpath string, kind string) (err error) {
@@ -130,10 +132,9 @@ func createConfig(fs *hugofs.Fs, inpath string, kind string) (err error) {
"title": "My New Hugo Site",
"languageCode": "en-us",
}
kind = parser.FormatSanitize(kind)
var buf bytes.Buffer
err = parser.InterfaceToConfig(in, parser.FormatToLeadRune(kind), &buf)
err = parser.InterfaceToConfig(in, metadecoders.FormatFromString(kind), &buf)
if err != nil {
return err
}
@@ -147,7 +148,7 @@ func nextStepsText() string {
nextStepsText.WriteString(`Just a few more steps and you're ready to go:
1. Download a theme into the same-named folder.
Choose a theme from https://themes.gohugo.io/, or
Choose a theme from https://themes.gohugo.io/ or
create your own with the "hugo new theme <THEMENAME>" command.
2. Perhaps you want to add some content. You can add single files
with "hugo new `)
+10 -13
View File
@@ -29,32 +29,30 @@ import (
var _ cmder = (*newThemeCmd)(nil)
type newThemeCmd struct {
*baseCmd
hugoBuilderCommon
*baseBuilderCmd
}
func newNewThemeCmd() *newThemeCmd {
ccmd := &newThemeCmd{baseCmd: newBaseCmd(nil)}
func (b *commandsBuilder) newNewThemeCmd() *newThemeCmd {
cc := &newThemeCmd{}
cmd := &cobra.Command{
Use: "theme [name]",
Short: "Create a new theme",
Long: `Create a new theme (skeleton) called [name] in the current directory.
Long: `Create a new theme (skeleton) called [name] in ./themes.
New theme is a skeleton. Please add content to the touched files. Add your
name to the copyright line in the license and adjust the theme.toml file
as you see fit.`,
RunE: ccmd.newTheme,
RunE: cc.newTheme,
}
ccmd.cmd = cmd
cc.baseBuilderCmd = b.newBuilderBasicCmd(cmd)
return ccmd
return cc
}
// newTheme creates a new Hugo theme template
func (n *newThemeCmd) newTheme(cmd *cobra.Command, args []string) error {
c, err := initializeConfig(false, false, &n.hugoBuilderCommon, n, nil)
c, err := initializeConfig(false, false, false, &n.hugoBuilderCommon, n, nil)
if err != nil {
return err
}
@@ -63,7 +61,7 @@ func (n *newThemeCmd) newTheme(cmd *cobra.Command, args []string) error {
return newUserError("theme name needs to be provided")
}
createpath := c.hugo.PathSpec.AbsPathify(filepath.Join(c.Cfg.GetString("themesDir"), args[0]))
createpath := c.hugo().PathSpec.AbsPathify(filepath.Join(c.Cfg.GetString("themesDir"), args[0]))
jww.FEEDBACK.Println("Creating theme at", createpath)
cfg := c.DepsCfg
@@ -146,7 +144,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
}
func (n *newThemeCmd) createThemeMD(fs *hugofs.Fs, inpath string) (err error) {
by := []byte(`# theme.toml template for a Hugo theme
# See https://github.com/gohugoio/hugoThemes#themetoml for an example
@@ -157,7 +154,7 @@ description = ""
homepage = "http://example.com/"
tags = []
features = []
min_version = "0.41"
min_version = "0.41.0"
[author]
name = ""
+50
View File
@@ -0,0 +1,50 @@
// Copyright 2019 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.
// +build nodeploy
package commands
import (
"errors"
"github.com/spf13/cobra"
)
var _ cmder = (*deployCmd)(nil)
// deployCmd supports deploying sites to Cloud providers.
type deployCmd struct {
*baseBuilderCmd
}
func (b *commandsBuilder) newDeployCmd() *deployCmd {
cc := &deployCmd{}
cmd := &cobra.Command{
Use: "deploy",
Short: "Deploy your site to a Cloud provider.",
Long: `Deploy your site to a Cloud provider.
See https://gohugo.io/hosting-and-deployment/hugo-deploy/ for detailed
documentation.
`,
RunE: func(cmd *cobra.Command, args []string) error {
return errors.New("build without HUGO_BUILD_TAGS=nodeploy to use this command")
},
}
cc.baseBuilderCmd = b.newBuilderBasicCmd(cmd)
return cc
}
-1
View File
@@ -61,7 +61,6 @@ func (c *releaseCommandeer) getCommand() *cobra.Command {
}
func (c *releaseCommandeer) flagsToConfig(cfg config.Provider) {
}
func (r *releaseCommandeer) release() error {
+197 -64
View File
@@ -1,4 +1,4 @@
// Copyright 2018 The Hugo Authors. All rights reserved.
// Copyright 2019 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.
@@ -14,13 +14,16 @@
package commands
import (
"bytes"
"fmt"
"io"
"net"
"net/http"
"net/url"
"os"
"os/signal"
"path/filepath"
"regexp"
"runtime"
"strconv"
"strings"
@@ -28,10 +31,13 @@ import (
"syscall"
"time"
"github.com/gohugoio/hugo/common/paths"
"github.com/pkg/errors"
"github.com/gohugoio/hugo/livereload"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/helpers"
"github.com/spf13/afero"
"github.com/spf13/cobra"
@@ -52,7 +58,8 @@ type serverCmd struct {
serverWatch bool
noHTTPCache bool
disableFastRender bool
disableFastRender bool
disableBrowserError bool
*baseBuilderCmd
}
@@ -93,6 +100,7 @@ of a second, you will be able to save and see your changes nearly instantly.`,
cc.cmd.Flags().BoolVar(&cc.navigateToChanged, "navigateToChanged", false, "navigate to changed content file on live browser reload")
cc.cmd.Flags().BoolVar(&cc.renderToDisk, "renderToDisk", false, "render to Destination path (default is render to memory & serve from there)")
cc.cmd.Flags().BoolVar(&cc.disableFastRender, "disableFastRender", false, "enables full re-renders on changes")
cc.cmd.Flags().BoolVar(&cc.disableBrowserError, "disableBrowserError", false, "do not show build errors in the browser")
cc.cmd.Flags().String("memstats", "", "log memory usage to this file")
cc.cmd.Flags().String("meminterval", "100ms", "interval to poll memory usage (requires --memstats), valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\".")
@@ -122,27 +130,30 @@ func (f noDirFile) Readdir(count int) ([]os.FileInfo, error) {
var serverPorts []int
func (s *serverCmd) server(cmd *cobra.Command, args []string) error {
func (sc *serverCmd) server(cmd *cobra.Command, args []string) error {
// If a Destination is provided via flag write to disk
destination, _ := cmd.Flags().GetString("destination")
if destination != "" {
s.renderToDisk = true
sc.renderToDisk = true
}
var serverCfgInit sync.Once
cfgInit := func(c *commandeer) error {
c.Set("renderToMemory", !s.renderToDisk)
c.Set("renderToMemory", !sc.renderToDisk)
if cmd.Flags().Changed("navigateToChanged") {
c.Set("navigateToChanged", s.navigateToChanged)
c.Set("navigateToChanged", sc.navigateToChanged)
}
if cmd.Flags().Changed("disableLiveReload") {
c.Set("disableLiveReload", s.disableLiveReload)
c.Set("disableLiveReload", sc.disableLiveReload)
}
if cmd.Flags().Changed("disableFastRender") {
c.Set("disableFastRender", s.disableFastRender)
c.Set("disableFastRender", sc.disableFastRender)
}
if s.serverWatch {
if cmd.Flags().Changed("disableBrowserError") {
c.Set("disableBrowserError", sc.disableBrowserError)
}
if sc.serverWatch {
c.Set("watch", true)
}
@@ -158,25 +169,25 @@ func (s *serverCmd) server(cmd *cobra.Command, args []string) error {
serverPorts = make([]int, 1)
if c.languages.IsMultihost() {
if !s.serverAppend {
if !sc.serverAppend {
err = newSystemError("--appendPort=false not supported when in multihost mode")
}
serverPorts = make([]int, len(c.languages))
}
currentServerPort := s.serverPort
currentServerPort := sc.serverPort
for i := 0; i < len(serverPorts); i++ {
l, err := net.Listen("tcp", net.JoinHostPort(s.serverInterface, strconv.Itoa(currentServerPort)))
l, err := net.Listen("tcp", net.JoinHostPort(sc.serverInterface, strconv.Itoa(currentServerPort)))
if err == nil {
l.Close()
serverPorts[i] = currentServerPort
} else {
if i == 0 && s.cmd.Flags().Changed("port") {
if i == 0 && sc.cmd.Flags().Changed("port") {
// port set explicitly by user -- he/she probably meant it!
err = newSystemErrorF("Server startup failed: %s", err)
}
jww.ERROR.Println("port", s.serverPort, "already in use, attempting to use an available port")
c.logger.Println("port", sc.serverPort, "already in use, attempting to use an available port")
sp, err := helpers.FindAvailablePort()
if err != nil {
err = newSystemError("Unable to find alternative port to use:", err)
@@ -190,9 +201,9 @@ func (s *serverCmd) server(cmd *cobra.Command, args []string) error {
c.serverPorts = serverPorts
c.Set("port", s.serverPort)
if s.liveReloadPort != -1 {
c.Set("liveReloadPort", s.liveReloadPort)
c.Set("port", sc.serverPort)
if sc.liveReloadPort != -1 {
c.Set("liveReloadPort", sc.liveReloadPort)
} else {
c.Set("liveReloadPort", serverPorts[0])
}
@@ -206,7 +217,7 @@ func (s *serverCmd) server(cmd *cobra.Command, args []string) error {
serverPort = serverPorts[0]
}
baseURL, err := s.fixURL(language, s.baseURL, serverPort)
baseURL, err := sc.fixURL(language, sc.baseURL, serverPort)
if err != nil {
return nil
}
@@ -219,45 +230,51 @@ func (s *serverCmd) server(cmd *cobra.Command, args []string) error {
}
return err
}
if err := memStats(); err != nil {
jww.ERROR.Println("memstats error:", err)
jww.WARN.Println("memstats error:", err)
}
c, err := initializeConfig(true, true, &s.hugoBuilderCommon, s, cfgInit)
// silence errors in cobra so we can handle them here
cmd.SilenceErrors = true
c, err := initializeConfig(true, true, true, &sc.hugoBuilderCommon, sc, cfgInit)
if err != nil {
cmd.PrintErrln("Error:", err.Error())
return err
}
err = func() error {
defer c.timeTrack(time.Now(), "Built")
err := c.serverBuild()
if err != nil {
cmd.PrintErrln("Error:", err.Error())
}
return err
}()
if err != nil {
return err
}
if err := c.serverBuild(); err != nil {
return err
}
for _, s := range c.hugo.Sites {
for _, s := range c.hugo().Sites {
s.RegisterMediaTypes()
}
// Watch runs its own server as part of the routine
if s.serverWatch {
if sc.serverWatch {
watchDirs, err := c.getDirList()
if err != nil {
return err
}
baseWatchDir := c.Cfg.GetString("workingDir")
relWatchDirs := make([]string, len(watchDirs))
for i, dir := range watchDirs {
relWatchDirs[i], _ = helpers.GetRelativePath(dir, baseWatchDir)
watchGroups := helpers.ExtractAndGroupRootPaths(watchDirs)
for _, group := range watchGroups {
jww.FEEDBACK.Printf("Watching for changes in %s\n", group)
}
rootWatchDirs := strings.Join(helpers.UniqueStrings(helpers.ExtractRootPaths(relWatchDirs)), ",")
jww.FEEDBACK.Printf("Watching for changes in %s%s{%s}\n", baseWatchDir, helpers.FilePathSeparator, rootWatchDirs)
watcher, err := c.newWatcher(watchDirs...)
watcher, err := c.newWatcher(sc.poll, watchDirs...)
if err != nil {
return err
}
@@ -266,15 +283,35 @@ func (s *serverCmd) server(cmd *cobra.Command, args []string) error {
}
return c.serve(s)
return c.serve(sc)
}
func getRootWatchDirsStr(baseDir string, watchDirs []string) string {
relWatchDirs := make([]string, len(watchDirs))
for i, dir := range watchDirs {
relWatchDirs[i], _ = paths.GetRelativePath(dir, baseDir)
}
return strings.Join(helpers.UniqueStringsSorted(helpers.ExtractRootPaths(relWatchDirs)), ",")
}
type fileServer struct {
baseURLs []string
roots []string
c *commandeer
s *serverCmd
baseURLs []string
roots []string
errorTemplate func(err interface{}) (io.Reader, error)
c *commandeer
s *serverCmd
}
func (f *fileServer) rewriteRequest(r *http.Request, toPath string) *http.Request {
r2 := new(http.Request)
*r2 = *r
r2.URL = new(url.URL)
*r2.URL = *r.URL
r2.URL.Path = toPath
r2.Header.Set("X-Rewrite-Original-URI", r.URL.RequestURI())
return r2
}
func (f *fileServer) createEndpoint(i int) (*http.ServeMux, string, string, error) {
@@ -288,7 +325,9 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, string, string, erro
publishDir = filepath.Join(publishDir, root)
}
absPublishDir := f.c.hugo.PathSpec.AbsPathify(publishDir)
absPublishDir := f.c.hugo().PathSpec.AbsPathify(publishDir)
jww.FEEDBACK.Printf("Environment: %q", f.c.hugo().Deps.Site.Hugo().Environment)
if i == 0 {
if f.s.renderToDisk {
@@ -301,39 +340,111 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, string, string, erro
httpFs := afero.NewHttpFs(f.c.destinationFs)
fs := filesOnlyFs{httpFs.Dir(absPublishDir)}
doLiveReload := !f.s.buildWatch && !f.c.Cfg.GetBool("disableLiveReload")
fastRenderMode := doLiveReload && !f.c.Cfg.GetBool("disableFastRender")
if i == 0 && fastRenderMode {
if i == 0 && f.c.fastRenderMode {
jww.FEEDBACK.Println("Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender")
}
// We're only interested in the path
u, err := url.Parse(baseURL)
if err != nil {
return nil, "", "", fmt.Errorf("Invalid baseURL: %s", err)
return nil, "", "", errors.Wrap(err, "Invalid baseURL")
}
decorate := func(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if f.c.showErrorInBrowser {
// First check the error state
err := f.c.getErrorWithContext()
if err != nil {
f.c.wasError = true
w.WriteHeader(500)
r, err := f.errorTemplate(err)
if err != nil {
f.c.logger.Errorln(err)
}
port = 1313
if !f.c.paused {
port = f.c.Cfg.GetInt("liveReloadPort")
}
lr := *u
lr.Host = fmt.Sprintf("%s:%d", lr.Hostname(), port)
fmt.Fprint(w, injectLiveReloadScript(r, lr))
return
}
}
if f.s.noHTTPCache {
w.Header().Set("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0")
w.Header().Set("Pragma", "no-cache")
}
if fastRenderMode {
p := r.RequestURI
if strings.HasSuffix(p, "/") || strings.HasSuffix(p, "html") || strings.HasSuffix(p, "htm") {
f.c.visitedURLs.Add(p)
// Ignore any query params for the operations below.
requestURI := strings.TrimSuffix(r.RequestURI, "?"+r.URL.RawQuery)
for _, header := range f.c.serverConfig.MatchHeaders(requestURI) {
w.Header().Set(header.Key, header.Value)
}
if redirect := f.c.serverConfig.MatchRedirect(requestURI); !redirect.IsZero() {
doRedirect := true
// This matches Netlify's behaviour and is needed for SPA behaviour.
// See https://docs.netlify.com/routing/redirects/rewrites-proxies/
if !redirect.Force {
path := filepath.Clean(strings.TrimPrefix(requestURI, u.Path))
fi, err := f.c.hugo().BaseFs.PublishFs.Stat(path)
if err == nil {
if fi.IsDir() {
// There will be overlapping directories, so we
// need to check for a file.
_, err = f.c.hugo().BaseFs.PublishFs.Stat(filepath.Join(path, "index.html"))
doRedirect = err != nil
} else {
doRedirect = false
}
}
}
if doRedirect {
if redirect.Status == 200 {
if r2 := f.rewriteRequest(r, strings.TrimPrefix(redirect.To, u.Path)); r2 != nil {
requestURI = redirect.To
r = r2
}
} else {
w.Header().Set("Content-Type", "")
http.Redirect(w, r, redirect.To, redirect.Status)
return
}
}
}
if f.c.fastRenderMode && f.c.buildErr == nil {
if strings.HasSuffix(requestURI, "/") || strings.HasSuffix(requestURI, "html") || strings.HasSuffix(requestURI, "htm") {
if !f.c.visitedURLs.Contains(requestURI) {
// If not already on stack, re-render that single page.
if err := f.c.partialReRender(requestURI); err != nil {
f.c.handleBuildErr(err, fmt.Sprintf("Failed to render %q", requestURI))
if f.c.showErrorInBrowser {
http.Redirect(w, r, requestURI, http.StatusMovedPermanently)
return
}
}
}
f.c.visitedURLs.Add(requestURI)
}
}
h.ServeHTTP(w, r)
})
}
fileserver := decorate(http.FileServer(fs))
mu := http.NewServeMux()
if u.Path == "" || u.Path == "/" {
mu.Handle("/", fileserver)
} else {
@@ -345,9 +456,14 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, string, string, erro
return mu, u.String(), endpoint, nil
}
func (c *commandeer) serve(s *serverCmd) error {
var logErrorRe = regexp.MustCompile(`(?s)ERROR \d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} `)
isMultiHost := c.hugo.IsMultihost()
func removeErrorPrefixFromLog(content string) string {
return logErrorRe.ReplaceAllLiteralString(content, "")
}
func (c *commandeer) serve(s *serverCmd) error {
isMultiHost := c.hugo().IsMultihost()
var (
baseURLs []string
@@ -355,21 +471,31 @@ func (c *commandeer) serve(s *serverCmd) error {
)
if isMultiHost {
for _, s := range c.hugo.Sites {
for _, s := range c.hugo().Sites {
baseURLs = append(baseURLs, s.BaseURL.String())
roots = append(roots, s.Language.Lang)
roots = append(roots, s.Language().Lang)
}
} else {
s := c.hugo.Sites[0]
s := c.hugo().Sites[0]
baseURLs = []string{s.BaseURL.String()}
roots = []string{""}
}
templ, err := c.hugo().TextTmpl().Parse("__default_server_error", buildErrorTemplate)
if err != nil {
return err
}
srv := &fileServer{
baseURLs: baseURLs,
roots: roots,
c: c,
s: s,
errorTemplate: func(ctx interface{}) (io.Reader, error) {
b := &bytes.Buffer{}
err := c.hugo().Tmpl().Execute(templ, b, ctx)
return b, err
},
}
doLiveReload := !c.Cfg.GetBool("disableLiveReload")
@@ -378,21 +504,26 @@ func (c *commandeer) serve(s *serverCmd) error {
livereload.Initialize()
}
var sigs = make(chan os.Signal)
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
for i := range baseURLs {
mu, serverURL, endpoint, err := srv.createEndpoint(i)
if doLiveReload {
mu.HandleFunc("/livereload.js", livereload.ServeJS)
mu.HandleFunc("/livereload", livereload.Handler)
u, err := url.Parse(helpers.SanitizeURL(baseURLs[i]))
if err != nil {
return err
}
mu.HandleFunc(u.Path+"/livereload.js", livereload.ServeJS)
mu.HandleFunc(u.Path+"/livereload", livereload.Handler)
}
jww.FEEDBACK.Printf("Web Server is available at %s (bind address %s)\n", serverURL, s.serverInterface)
go func() {
err = http.ListenAndServe(endpoint, mu)
if err != nil {
jww.ERROR.Printf("Error: %s\n", err.Error())
c.logger.Errorf("Error: %s\n", err.Error())
os.Exit(1)
}
}()
@@ -409,6 +540,8 @@ func (c *commandeer) serve(s *serverCmd) error {
<-sigs
}
c.hugo().Close()
return nil
}
@@ -453,7 +586,7 @@ func (sc *serverCmd) fixURL(cfg config.Provider, s string, port int) (string, er
if strings.Contains(u.Host, ":") {
u.Host, _, err = net.SplitHostPort(u.Host)
if err != nil {
return "", fmt.Errorf("Failed to split baseURL hostpost: %s", err)
return "", errors.Wrap(err, "Failed to split baseURL hostpost")
}
}
u.Host += fmt.Sprintf(":%d", port)
+92
View File
@@ -0,0 +1,92 @@
// Copyright 2018 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 (
"bytes"
"io"
"net/url"
"github.com/gohugoio/hugo/transform"
"github.com/gohugoio/hugo/transform/livereloadinject"
)
var buildErrorTemplate = `<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title>Hugo Server: Error</title>
<style type="text/css">
body {
font-family: "Muli",avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 16px;
background-color: #2f1e2e;
}
main {
margin: auto;
width: 95%;
padding: 1rem;
}
.version {
color: #ccc;
padding: 1rem 0;
}
.stack {
margin-top: 4rem;
}
pre {
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;
}
.highlight {
overflow-x: auto;
margin-bottom: 1rem;
}
a {
color: #0594cb;
text-decoration: none;
}
a:hover {
color: #ccc;
}
</style>
</head>
<body>
<main>
{{ highlight .Error "apl" "linenos=false,noclasses=true,style=paraiso-dark" }}
{{ with .File }}
{{ $params := printf "noclasses=true,style=paraiso-dark,linenos=table,hl_lines=%d,linenostart=%d" (add .LinesPos 1) (sub .Position.LineNumber .LinesPos) }}
{{ $lexer := .ChromaLexer | default "go-html-template" }}
{{ highlight (delimit .Lines "\n") $lexer $params }}
{{ end }}
{{ with .StackTrace }}
{{ highlight . "apl" "noclasses=true,style=paraiso-dark" }}
{{ end }}
<p class="version">{{ .Version }}</p>
<a href="">Reload Page</a>
</main>
</body>
</html>
`
func injectLiveReloadScript(src io.Reader, baseURL url.URL) string {
var b bytes.Buffer
chain := transform.Chain{livereloadinject.New(baseURL)}
chain.Apply(&b, src)
return b.String()
}
+39 -24
View File
@@ -18,13 +18,14 @@ import (
"net/http"
"os"
"runtime"
"strings"
"testing"
"time"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/helpers"
"github.com/spf13/viper"
"github.com/stretchr/testify/require"
qt "github.com/frankban/quicktest"
)
func TestServer(t *testing.T) {
@@ -32,9 +33,10 @@ func TestServer(t *testing.T) {
// TODO(bep) not sure why server tests have started to fail on the Windows CI server.
t.Skip("Skip server test on appveyor")
}
assert := require.New(t)
dir, err := createSimpleTestSite(t)
assert.NoError(err)
c := qt.New(t)
dir, clean, err := createSimpleTestSite(t, testSiteConfig{})
defer clean()
c.Assert(err, qt.IsNil)
// Let us hope that this port is available on all systems ...
port := 1331
@@ -53,7 +55,7 @@ func TestServer(t *testing.T) {
go func() {
_, err = cmd.ExecuteC()
assert.NoError(err)
c.Assert(err, qt.IsNil)
}()
// There is no way to know exactly when the server is ready for connections.
@@ -62,15 +64,15 @@ func TestServer(t *testing.T) {
time.Sleep(2 * time.Second)
resp, err := http.Get("http://localhost:1331/")
assert.NoError(err)
c.Assert(err, qt.IsNil)
defer resp.Body.Close()
homeContent := helpers.ReaderToString(resp.Body)
assert.Contains(homeContent, "List: Hugo Commands")
c.Assert(homeContent, qt.Contains, "List: Hugo Commands")
c.Assert(homeContent, qt.Contains, "Environment: development")
// Stop the server.
stop <- true
}
func TestFixURL(t *testing.T) {
@@ -95,24 +97,37 @@ func TestFixURL(t *testing.T) {
{"No config", "", "", true, 1313, "//localhost:1313/"},
}
for i, test := range tests {
b := newCommandsBuilder()
s := b.newServerCmd()
v := viper.New()
baseURL := test.CLIBaseURL
v.Set("baseURL", test.CfgBaseURL)
s.serverAppend = test.AppendPort
s.serverPort = test.Port
result, err := s.fixURL(v, baseURL, s.serverPort)
if err != nil {
t.Errorf("Test #%d %s: unexpected error %s", i, test.TestName, err)
}
if result != test.Result {
t.Errorf("Test #%d %s: expected %q, got %q", i, test.TestName, test.Result, result)
}
for _, test := range tests {
t.Run(test.TestName, func(t *testing.T) {
b := newCommandsBuilder()
s := b.newServerCmd()
v := config.New()
baseURL := test.CLIBaseURL
v.Set("baseURL", test.CfgBaseURL)
s.serverAppend = test.AppendPort
s.serverPort = test.Port
result, err := s.fixURL(v, baseURL, s.serverPort)
if err != nil {
t.Errorf("Unexpected error %s", err)
}
if result != test.Result {
t.Errorf("Expected %q, got %q", test.Result, result)
}
})
}
}
func TestRemoveErrorPrefixFromLog(t *testing.T) {
c := qt.New(t)
content := `ERROR 2018/10/07 13:11:12 Error while rendering "home": template: _default/baseof.html:4:3: executing "main" at <partial "logo" .>: error calling partial: template: partials/logo.html:5:84: executing "partials/logo.html" at <$resized.AHeight>: can't evaluate field AHeight in type *resource.Image
ERROR 2018/10/07 13:11:12 Rebuild failed: logged 1 error(s)
`
withoutError := removeErrorPrefixFromLog(content)
c.Assert(strings.Contains(withoutError, "ERROR"), qt.Equals, false)
}
func isWindowsCI() bool {
return runtime.GOOS == "windows" && os.Getenv("CI") != ""
}
+10 -9
View File
@@ -33,14 +33,14 @@ func newStaticSyncer(c *commandeer) (*staticSyncer, error) {
}
func (s *staticSyncer) isStatic(filename string) bool {
return s.c.hugo.BaseFs.SourceFilesystems.IsStatic(filename)
return s.c.hugo().BaseFs.SourceFilesystems.IsStatic(filename)
}
func (s *staticSyncer) syncsStaticEvents(staticEvents []fsnotify.Event) error {
c := s.c
syncFn := func(sourceFs *filesystems.SourceFilesystem) (uint64, error) {
publishDir := c.hugo.PathSpec.PublishDir
publishDir := c.hugo().PathSpec.PublishDir
// If root, remove the second '/'
if publishDir == "//" {
publishDir = helpers.FilePathSeparator
@@ -53,11 +53,12 @@ func (s *staticSyncer) syncsStaticEvents(staticEvents []fsnotify.Event) error {
syncer := fsync.NewSyncer()
syncer.NoTimes = c.Cfg.GetBool("noTimes")
syncer.NoChmod = c.Cfg.GetBool("noChmod")
syncer.ChmodFilter = chmodFilter
syncer.SrcFs = sourceFs.Fs
syncer.DestFs = c.Fs.Destination
// prevent spamming the log on changes
logger := helpers.NewDistinctFeedbackLogger()
logger := helpers.NewDistinctErrorLogger()
for _, ev := range staticEvents {
// Due to our approach of layering both directories and the content's rendered output
@@ -78,8 +79,9 @@ func (s *staticSyncer) syncsStaticEvents(staticEvents []fsnotify.Event) error {
fromPath := ev.Name
relPath := sourceFs.MakePathRelative(fromPath)
if relPath == "" {
relPath, found := sourceFs.MakePathRelative(fromPath)
if !found {
// Not member of this virtual host.
continue
}
@@ -105,10 +107,10 @@ func (s *staticSyncer) syncsStaticEvents(staticEvents []fsnotify.Event) error {
logger.Println("Syncing", relPath, "to", publishDir)
if err := syncer.Sync(filepath.Join(publishDir, relPath), relPath); err != nil {
c.Logger.ERROR.Println(err)
c.logger.Errorln(err)
}
} else {
c.Logger.ERROR.Println(err)
c.logger.Errorln(err)
}
continue
@@ -117,7 +119,7 @@ func (s *staticSyncer) syncsStaticEvents(staticEvents []fsnotify.Event) error {
// For all other event operations Hugo will sync static.
logger.Println("Syncing", relPath, "to", publishDir)
if err := syncer.Sync(filepath.Join(publishDir, relPath), relPath); err != nil {
c.Logger.ERROR.Println(err)
c.logger.Errorln(err)
}
}
@@ -126,5 +128,4 @@ func (s *staticSyncer) syncsStaticEvents(staticEvents []fsnotify.Event) error {
_, err := c.doWithPublishDirs(syncFn)
return err
}
+2 -26
View File
@@ -14,12 +14,7 @@
package commands
import (
"runtime"
"strings"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/hugolib"
"github.com/gohugoio/hugo/resource/tocss/scss"
"github.com/gohugoio/hugo/common/hugo"
"github.com/spf13/cobra"
jww "github.com/spf13/jwalterweatherman"
)
@@ -45,24 +40,5 @@ func newVersionCmd() *versionCmd {
}
func printHugoVersion() {
program := "Hugo Static Site Generator"
version := "v" + helpers.CurrentHugoVersion.String()
if hugolib.CommitHash != "" {
version += "-" + strings.ToUpper(hugolib.CommitHash)
}
if scss.Supports() {
version += "/extended"
}
osArch := runtime.GOOS + "/" + runtime.GOARCH
var buildDate string
if hugolib.BuildDate != "" {
buildDate = hugolib.BuildDate
} else {
buildDate = "unknown"
}
jww.FEEDBACK.Println(program, version, osArch, "BuildDate:", buildDate)
jww.FEEDBACK.Println(hugo.BuildVersionString())
}
+112
View File
@@ -0,0 +1,112 @@
// Copyright 2019 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 collections
import (
"fmt"
"reflect"
)
// Append appends from to a slice to and returns the resulting slice.
// If length of from is one and the only element is a slice of same type as to,
// it will be appended.
func Append(to interface{}, from ...interface{}) (interface{}, error) {
tov, toIsNil := indirect(reflect.ValueOf(to))
toIsNil = toIsNil || to == nil
var tot reflect.Type
if !toIsNil {
if tov.Kind() != reflect.Slice {
return nil, fmt.Errorf("expected a slice, got %T", to)
}
tot = tov.Type().Elem()
toIsNil = tov.Len() == 0
if len(from) == 1 {
fromv := reflect.ValueOf(from[0])
if fromv.Kind() == reflect.Slice {
if toIsNil {
// If we get nil []string, we just return the []string
return from[0], nil
}
fromt := reflect.TypeOf(from[0]).Elem()
// If we get []string []string, we append the from slice to to
if tot == fromt {
return reflect.AppendSlice(tov, fromv).Interface(), nil
} else if !fromt.AssignableTo(tot) {
// Fall back to a []interface{} slice.
return appendToInterfaceSliceFromValues(tov, fromv)
}
}
}
}
if toIsNil {
return Slice(from...), nil
}
for _, f := range from {
fv := reflect.ValueOf(f)
if !fv.Type().AssignableTo(tot) {
// Fall back to a []interface{} slice.
tov, _ := indirect(reflect.ValueOf(to))
return appendToInterfaceSlice(tov, from...)
}
tov = reflect.Append(tov, fv)
}
return tov.Interface(), nil
}
func appendToInterfaceSliceFromValues(slice1, slice2 reflect.Value) ([]interface{}, error) {
var tos []interface{}
for _, slice := range []reflect.Value{slice1, slice2} {
for i := 0; i < slice.Len(); i++ {
tos = append(tos, slice.Index(i).Interface())
}
}
return tos, nil
}
func appendToInterfaceSlice(tov reflect.Value, from ...interface{}) ([]interface{}, error) {
var tos []interface{}
for i := 0; i < tov.Len(); i++ {
tos = append(tos, tov.Index(i).Interface())
}
tos = append(tos, from...)
return tos, nil
}
// indirect is borrowed from the Go stdlib: 'text/template/exec.go'
// TODO(bep) consolidate
func indirect(v reflect.Value) (rv reflect.Value, isNil bool) {
for ; v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface; v = v.Elem() {
if v.IsNil() {
return v, true
}
if v.Kind() == reflect.Interface && v.NumMethod() > 0 {
break
}
}
return v, false
}
+90
View File
@@ -0,0 +1,90 @@
// Copyright 2018 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 collections
import (
"html/template"
"testing"
qt "github.com/frankban/quicktest"
)
func TestAppend(t *testing.T) {
t.Parallel()
c := qt.New(t)
for _, test := range []struct {
start interface{}
addend []interface{}
expected interface{}
}{
{[]string{"a", "b"}, []interface{}{"c"}, []string{"a", "b", "c"}},
{[]string{"a", "b"}, []interface{}{"c", "d", "e"}, []string{"a", "b", "c", "d", "e"}},
{[]string{"a", "b"}, []interface{}{[]string{"c", "d", "e"}}, []string{"a", "b", "c", "d", "e"}},
{[]string{"a"}, []interface{}{"b", template.HTML("c")}, []interface{}{"a", "b", template.HTML("c")}},
{nil, []interface{}{"a", "b"}, []string{"a", "b"}},
{nil, []interface{}{nil}, []interface{}{nil}},
{[]interface{}{}, []interface{}{[]string{"c", "d", "e"}}, []string{"c", "d", "e"}},
{
tstSlicers{&tstSlicer{"a"}, &tstSlicer{"b"}},
[]interface{}{&tstSlicer{"c"}},
tstSlicers{&tstSlicer{"a"}, &tstSlicer{"b"}, &tstSlicer{"c"}},
},
{
&tstSlicers{&tstSlicer{"a"}, &tstSlicer{"b"}},
[]interface{}{&tstSlicer{"c"}},
tstSlicers{
&tstSlicer{"a"},
&tstSlicer{"b"},
&tstSlicer{"c"},
},
},
{
testSlicerInterfaces{&tstSlicerIn1{"a"}, &tstSlicerIn1{"b"}},
[]interface{}{&tstSlicerIn1{"c"}},
testSlicerInterfaces{&tstSlicerIn1{"a"}, &tstSlicerIn1{"b"}, &tstSlicerIn1{"c"}},
},
//https://github.com/gohugoio/hugo/issues/5361
{
[]string{"a", "b"},
[]interface{}{tstSlicers{&tstSlicer{"a"}, &tstSlicer{"b"}}},
[]interface{}{"a", "b", &tstSlicer{"a"}, &tstSlicer{"b"}},
},
{
[]string{"a", "b"},
[]interface{}{&tstSlicer{"a"}},
[]interface{}{"a", "b", &tstSlicer{"a"}},
},
// Errors
{"", []interface{}{[]string{"a", "b"}}, false},
// No string concatenation.
{
"ab",
[]interface{}{"c"},
false,
},
} {
result, err := Append(test.start, test.addend...)
if b, ok := test.expected.(bool); ok && !b {
c.Assert(err, qt.Not(qt.IsNil))
continue
}
c.Assert(err, qt.IsNil)
c.Assert(result, qt.DeepEquals, test.expected)
}
}
+21
View File
@@ -0,0 +1,21 @@
// Copyright 2018 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 collections contains common Hugo functionality related to collection
// handling.
package collections
// Grouper defines a very generic way to group items by a given key.
type Grouper interface {
Group(key interface{}, items interface{}) (interface{}, error)
}
+20
View File
@@ -0,0 +1,20 @@
// Copyright 2020 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 collections
type Order interface {
// Ordinal is a zero-based ordinal that represents the order of an object
// in a collection.
Ordinal() int
}
+66
View File
@@ -0,0 +1,66 @@
// Copyright 2018 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 collections
import (
"reflect"
)
// Slicer defines a very generic way to create a typed slice. This is used
// in collections.Slice template func to get types such as Pages, PageGroups etc.
// instead of the less useful []interface{}.
type Slicer interface {
Slice(items interface{}) (interface{}, error)
}
// Slice returns a slice of all passed arguments.
func Slice(args ...interface{}) interface{} {
if len(args) == 0 {
return args
}
first := args[0]
firstType := reflect.TypeOf(first)
if firstType == nil {
return args
}
if g, ok := first.(Slicer); ok {
v, err := g.Slice(args)
if err == nil {
return v
}
// If Slice fails, the items are not of the same type and
// []interface{} is the best we can do.
return args
}
if len(args) > 1 {
// This can be a mix of types.
for i := 1; i < len(args); i++ {
if firstType != reflect.TypeOf(args[i]) {
// []interface{} is the best we can do
return args
}
}
}
slice := reflect.MakeSlice(reflect.SliceOf(firstType), len(args), len(args))
for i, arg := range args {
slice.Index(i).Set(reflect.ValueOf(arg))
}
return slice.Interface()
}
+124
View File
@@ -0,0 +1,124 @@
// Copyright 2019 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 collections
import (
"errors"
"testing"
qt "github.com/frankban/quicktest"
)
var (
_ Slicer = (*tstSlicer)(nil)
_ Slicer = (*tstSlicerIn1)(nil)
_ Slicer = (*tstSlicerIn2)(nil)
_ testSlicerInterface = (*tstSlicerIn1)(nil)
_ testSlicerInterface = (*tstSlicerIn1)(nil)
)
type testSlicerInterface interface {
Name() string
}
type testSlicerInterfaces []testSlicerInterface
type tstSlicerIn1 struct {
TheName string
}
type tstSlicerIn2 struct {
TheName string
}
type tstSlicer struct {
TheName string
}
func (p *tstSlicerIn1) Slice(in interface{}) (interface{}, error) {
items := in.([]interface{})
result := make(testSlicerInterfaces, len(items))
for i, v := range items {
switch vv := v.(type) {
case testSlicerInterface:
result[i] = vv
default:
return nil, errors.New("invalid type")
}
}
return result, nil
}
func (p *tstSlicerIn2) Slice(in interface{}) (interface{}, error) {
items := in.([]interface{})
result := make(testSlicerInterfaces, len(items))
for i, v := range items {
switch vv := v.(type) {
case testSlicerInterface:
result[i] = vv
default:
return nil, errors.New("invalid type")
}
}
return result, nil
}
func (p *tstSlicerIn1) Name() string {
return p.TheName
}
func (p *tstSlicerIn2) Name() string {
return p.TheName
}
func (p *tstSlicer) Slice(in interface{}) (interface{}, error) {
items := in.([]interface{})
result := make(tstSlicers, len(items))
for i, v := range items {
switch vv := v.(type) {
case *tstSlicer:
result[i] = vv
default:
return nil, errors.New("invalid type")
}
}
return result, nil
}
type tstSlicers []*tstSlicer
func TestSlice(t *testing.T) {
t.Parallel()
c := qt.New(t)
for i, test := range []struct {
args []interface{}
expected interface{}
}{
{[]interface{}{"a", "b"}, []string{"a", "b"}},
{[]interface{}{&tstSlicer{"a"}, &tstSlicer{"b"}}, tstSlicers{&tstSlicer{"a"}, &tstSlicer{"b"}}},
{[]interface{}{&tstSlicer{"a"}, "b"}, []interface{}{&tstSlicer{"a"}, "b"}},
{[]interface{}{}, []interface{}{}},
{[]interface{}{nil}, []interface{}{nil}},
{[]interface{}{5, "b"}, []interface{}{5, "b"}},
{[]interface{}{&tstSlicerIn1{"a"}, &tstSlicerIn2{"b"}}, testSlicerInterfaces{&tstSlicerIn1{"a"}, &tstSlicerIn2{"b"}}},
{[]interface{}{&tstSlicerIn1{"a"}, &tstSlicer{"b"}}, []interface{}{&tstSlicerIn1{"a"}, &tstSlicer{"b"}}},
} {
errMsg := qt.Commentf("[%d] %v", i, test.args)
result := Slice(test.args...)
c.Assert(test.expected, qt.DeepEquals, result, errMsg)
}
}
+25
View File
@@ -0,0 +1,25 @@
// Copyright 2020 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 constants
// Error IDs.
// Do not change these values.
const (
ErrIDAmbigousDisableKindTaxonomy = "error-disable-taxonomy"
ErrIDAmbigousOutputKindTaxonomy = "error-output-taxonomy"
// IDs for remote errors in tpl/data.
ErrRemoteGetJSON = "error-remote-getjson"
ErrRemoteGetCSV = "error-remote-getcsv"
)
+266
View File
@@ -0,0 +1,266 @@
// Copyright 2018 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 herrors contains common Hugo errors and error related utilities.
package herrors
import (
"io"
"io/ioutil"
"path/filepath"
"strings"
"github.com/gohugoio/hugo/common/text"
"github.com/spf13/afero"
)
// LineMatcher contains the elements used to match an error to a line
type LineMatcher struct {
Position text.Position
Error error
LineNumber int
Offset int
Line string
}
// LineMatcherFn is used to match a line with an error.
type LineMatcherFn func(m LineMatcher) bool
// SimpleLineMatcher simply matches by line number.
var SimpleLineMatcher = func(m LineMatcher) bool {
return m.Position.LineNumber == m.LineNumber
}
var _ text.Positioner = ErrorContext{}
// ErrorContext contains contextual information about an error. This will
// typically be the lines surrounding some problem in a file.
type ErrorContext struct {
// If a match will contain the matched line and up to 2 lines before and after.
// Will be empty if no match.
Lines []string
// The position of the error in the Lines above. 0 based.
LinesPos int
position text.Position
// The lexer to use for syntax highlighting.
// https://gohugo.io/content-management/syntax-highlighting/#list-of-chroma-highlighting-languages
ChromaLexer string
}
// Position returns the text position of this error.
func (e ErrorContext) Position() text.Position {
return e.position
}
var _ causer = (*ErrorWithFileContext)(nil)
// ErrorWithFileContext is an error with some additional file context related
// to that error.
type ErrorWithFileContext struct {
cause error
ErrorContext
}
func (e *ErrorWithFileContext) Error() string {
pos := e.Position()
if pos.IsValid() {
return pos.String() + ": " + e.cause.Error()
}
return e.cause.Error()
}
func (e *ErrorWithFileContext) Cause() error {
return e.cause
}
// WithFileContextForFile will try to add a file context with lines matching the given matcher.
// If no match could be found, the original error is returned with false as the second return value.
func WithFileContextForFile(e error, realFilename, filename string, fs afero.Fs, matcher LineMatcherFn) (error, bool) {
f, err := fs.Open(filename)
if err != nil {
return e, false
}
defer f.Close()
return WithFileContext(e, realFilename, f, matcher)
}
// WithFileContextForFileDefault tries to add file context using the default line matcher.
func WithFileContextForFileDefault(err error, filename string, fs afero.Fs) error {
err, _ = WithFileContextForFile(
err,
filename,
filename,
fs,
SimpleLineMatcher)
return err
}
// WithFileContextForFile will try to add a file context with lines matching the given matcher.
// If no match could be found, the original error is returned with false as the second return value.
func WithFileContext(e error, realFilename string, r io.Reader, matcher LineMatcherFn) (error, bool) {
if e == nil {
panic("error missing")
}
le := UnwrapFileError(e)
if le == nil {
var ok bool
if le, ok = ToFileError("", e).(FileError); !ok {
return e, false
}
}
var errCtx ErrorContext
posle := le.Position()
if posle.Offset != -1 {
errCtx = locateError(r, le, func(m LineMatcher) bool {
if posle.Offset >= m.Offset && posle.Offset < m.Offset+len(m.Line) {
lno := posle.LineNumber - m.Position.LineNumber + m.LineNumber
m.Position = text.Position{LineNumber: lno}
}
return matcher(m)
})
} else {
errCtx = locateError(r, le, matcher)
}
pos := &errCtx.position
if pos.LineNumber == -1 {
return e, false
}
pos.Filename = realFilename
if le.Type() != "" {
errCtx.ChromaLexer = chromaLexerFromType(le.Type())
} else {
errCtx.ChromaLexer = chromaLexerFromFilename(realFilename)
}
return &ErrorWithFileContext{cause: e, ErrorContext: errCtx}, true
}
// UnwrapErrorWithFileContext tries to unwrap an ErrorWithFileContext from err.
// It returns nil if this is not possible.
func UnwrapErrorWithFileContext(err error) *ErrorWithFileContext {
for err != nil {
switch v := err.(type) {
case *ErrorWithFileContext:
return v
case causer:
err = v.Cause()
default:
return nil
}
}
return nil
}
func chromaLexerFromType(fileType string) string {
switch fileType {
case "html", "htm":
return "go-html-template"
}
return fileType
}
func extNoDelimiter(filename string) string {
return strings.TrimPrefix(filepath.Ext(filename), ".")
}
func chromaLexerFromFilename(filename string) string {
if strings.Contains(filename, "layouts") {
return "go-html-template"
}
ext := extNoDelimiter(filename)
return chromaLexerFromType(ext)
}
func locateErrorInString(src string, matcher LineMatcherFn) ErrorContext {
return locateError(strings.NewReader(src), &fileError{}, matcher)
}
func locateError(r io.Reader, le FileError, matches LineMatcherFn) ErrorContext {
if le == nil {
panic("must provide an error")
}
errCtx := ErrorContext{position: text.Position{LineNumber: -1, ColumnNumber: 1, Offset: -1}, LinesPos: -1}
b, err := ioutil.ReadAll(r)
if err != nil {
return errCtx
}
pos := &errCtx.position
lepos := le.Position()
lines := strings.Split(string(b), "\n")
if lepos.ColumnNumber >= 0 {
pos.ColumnNumber = lepos.ColumnNumber
}
lineNo := 0
posBytes := 0
for li, line := range lines {
lineNo = li + 1
m := LineMatcher{
Position: le.Position(),
Error: le,
LineNumber: lineNo,
Offset: posBytes,
Line: line,
}
if errCtx.LinesPos == -1 && matches(m) {
pos.LineNumber = lineNo
break
}
posBytes += len(line)
}
if pos.LineNumber != -1 {
low := pos.LineNumber - 3
if low < 0 {
low = 0
}
if pos.LineNumber > 2 {
errCtx.LinesPos = 2
} else {
errCtx.LinesPos = pos.LineNumber - 1
}
high := pos.LineNumber + 2
if high > len(lines) {
high = len(lines)
}
errCtx.Lines = lines[low:high]
}
return errCtx
}
+128
View File
@@ -0,0 +1,128 @@
// Copyright 2018 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 herrors contains common Hugo errors and error related utilities.
package herrors
import (
"strings"
"testing"
qt "github.com/frankban/quicktest"
)
func TestErrorLocator(t *testing.T) {
c := qt.New(t)
lineMatcher := func(m LineMatcher) bool {
return strings.Contains(m.Line, "THEONE")
}
lines := `LINE 1
LINE 2
LINE 3
LINE 4
This is THEONE
LINE 6
LINE 7
LINE 8
`
location := locateErrorInString(lines, lineMatcher)
c.Assert(location.Lines, qt.DeepEquals, []string{"LINE 3", "LINE 4", "This is THEONE", "LINE 6", "LINE 7"})
pos := location.Position()
c.Assert(pos.LineNumber, qt.Equals, 5)
c.Assert(location.LinesPos, qt.Equals, 2)
c.Assert(locateErrorInString(`This is THEONE`, lineMatcher).Lines, qt.DeepEquals, []string{"This is THEONE"})
location = locateErrorInString(`L1
This is THEONE
L2
`, lineMatcher)
c.Assert(location.Position().LineNumber, qt.Equals, 2)
c.Assert(location.LinesPos, qt.Equals, 1)
c.Assert(location.Lines, qt.DeepEquals, []string{"L1", "This is THEONE", "L2", ""})
location = locateErrorInString(`This is THEONE
L2
`, lineMatcher)
c.Assert(location.LinesPos, qt.Equals, 0)
c.Assert(location.Lines, qt.DeepEquals, []string{"This is THEONE", "L2", ""})
location = locateErrorInString(`L1
This THEONE
`, lineMatcher)
c.Assert(location.Lines, qt.DeepEquals, []string{"L1", "This THEONE", ""})
c.Assert(location.LinesPos, qt.Equals, 1)
location = locateErrorInString(`L1
L2
This THEONE
`, lineMatcher)
c.Assert(location.Lines, qt.DeepEquals, []string{"L1", "L2", "This THEONE", ""})
c.Assert(location.LinesPos, qt.Equals, 2)
location = locateErrorInString("NO MATCH", lineMatcher)
c.Assert(location.Position().LineNumber, qt.Equals, -1)
c.Assert(location.LinesPos, qt.Equals, -1)
c.Assert(len(location.Lines), qt.Equals, 0)
lineMatcher = func(m LineMatcher) bool {
return m.LineNumber == 6
}
location = locateErrorInString(`A
B
C
D
E
F
G
H
I
J`, lineMatcher)
c.Assert(location.Lines, qt.DeepEquals, []string{"D", "E", "F", "G", "H"})
c.Assert(location.Position().LineNumber, qt.Equals, 6)
c.Assert(location.LinesPos, qt.Equals, 2)
// Test match EOF
lineMatcher = func(m LineMatcher) bool {
return m.LineNumber == 4
}
location = locateErrorInString(`A
B
C
`, lineMatcher)
c.Assert(location.Lines, qt.DeepEquals, []string{"B", "C", ""})
c.Assert(location.Position().LineNumber, qt.Equals, 4)
c.Assert(location.LinesPos, qt.Equals, 2)
offsetMatcher := func(m LineMatcher) bool {
return m.Offset == 1
}
location = locateErrorInString(`A
B
C
D
E`, offsetMatcher)
c.Assert(location.Lines, qt.DeepEquals, []string{"A", "B", "C", "D"})
c.Assert(location.Position().LineNumber, qt.Equals, 2)
c.Assert(location.LinesPos, qt.Equals, 1)
}
+90
View File
@@ -0,0 +1,90 @@
// Copyright 2018 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 herrors contains common Hugo errors and error related utilities.
package herrors
import (
"bytes"
"errors"
"fmt"
"io"
"os"
"runtime"
"runtime/debug"
"strconv"
_errors "github.com/pkg/errors"
)
// As defined in https://godoc.org/github.com/pkg/errors
type causer interface {
Cause() error
}
type stackTracer interface {
StackTrace() _errors.StackTrace
}
// PrintStackTraceFromErr prints the error's stack trace to stdoud.
func PrintStackTraceFromErr(err error) {
FprintStackTraceFromErr(os.Stdout, err)
}
// FprintStackTraceFromErr prints the error's stack trace to w.
func FprintStackTraceFromErr(w io.Writer, err error) {
if err, ok := err.(stackTracer); ok {
for _, f := range err.StackTrace() {
fmt.Fprintf(w, "%+s:%d\n", f, f)
}
}
}
// PrintStackTrace prints the current stacktrace to w.
func PrintStackTrace(w io.Writer) {
buf := make([]byte, 1<<16)
runtime.Stack(buf, true)
fmt.Fprintf(w, "%s", buf)
}
// ErrorSender is a, typically, non-blocking error handler.
type ErrorSender interface {
SendError(err error)
}
// Recover is a helper function that can be used to capture panics.
// Put this at the top of a method/function that crashes in a template:
// defer herrors.Recover()
func Recover(args ...interface{}) {
if r := recover(); r != nil {
fmt.Println("ERR:", r)
args = append(args, "stacktrace from panic: \n"+string(debug.Stack()), "\n")
fmt.Println(args...)
}
}
// Get the current goroutine id. Used only for debugging.
func GetGID() uint64 {
b := make([]byte, 64)
b = b[:runtime.Stack(b, false)]
b = bytes.TrimPrefix(b, []byte("goroutine "))
b = b[:bytes.IndexByte(b, ' ')]
n, _ := strconv.ParseUint(string(b), 10, 64)
return n
}
// ErrFeatureNotAvailable denotes that a feature is unavailable.
//
// We will, at least to begin with, make some Hugo features (SCSS with libsass) optional,
// and this error is used to signal those situations.
var ErrFeatureNotAvailable = errors.New("this feature is not available in your current Hugo version, see https://goo.gl/YMrWcn for more information")
+131
View File
@@ -0,0 +1,131 @@
// Copyright 2018 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 herrors
import (
"encoding/json"
"github.com/gohugoio/hugo/common/text"
"github.com/pkg/errors"
)
var _ causer = (*fileError)(nil)
// FileError represents an error when handling a file: Parsing a config file,
// execute a template etc.
type FileError interface {
error
text.Positioner
// A string identifying the type of file, e.g. JSON, TOML, markdown etc.
Type() string
}
var _ FileError = (*fileError)(nil)
type fileError struct {
position text.Position
fileType string
cause error
}
// Position returns the text position of this error.
func (e fileError) Position() text.Position {
return e.position
}
func (e *fileError) Type() string {
return e.fileType
}
func (e *fileError) Error() string {
if e.cause == nil {
return ""
}
return e.cause.Error()
}
func (f *fileError) Cause() error {
return f.cause
}
// NewFileError creates a new FileError.
func NewFileError(fileType string, offset, lineNumber, columnNumber int, err error) FileError {
pos := text.Position{Offset: offset, LineNumber: lineNumber, ColumnNumber: columnNumber}
return &fileError{cause: err, fileType: fileType, position: pos}
}
// UnwrapFileError tries to unwrap a FileError from err.
// It returns nil if this is not possible.
func UnwrapFileError(err error) FileError {
for err != nil {
switch v := err.(type) {
case FileError:
return v
case causer:
err = v.Cause()
default:
return nil
}
}
return nil
}
// ToFileErrorWithOffset will return a new FileError with a line number
// with the given offset from the original.
func ToFileErrorWithOffset(fe FileError, offset int) FileError {
pos := fe.Position()
return ToFileErrorWithLineNumber(fe, pos.LineNumber+offset)
}
// ToFileErrorWithOffset will return a new FileError with the given line number.
func ToFileErrorWithLineNumber(fe FileError, lineNumber int) FileError {
pos := fe.Position()
pos.LineNumber = lineNumber
return &fileError{cause: fe, fileType: fe.Type(), position: pos}
}
// ToFileError will convert the given error to an error supporting
// the FileError interface.
func ToFileError(fileType string, err error) FileError {
for _, handle := range lineNumberExtractors {
lno, col := handle(err)
offset, typ := extractOffsetAndType(err)
if fileType == "" {
fileType = typ
}
if lno > 0 || offset != -1 {
return NewFileError(fileType, offset, lno, col, err)
}
}
// Fall back to the pointing to line number 1.
return NewFileError(fileType, -1, 1, 1, err)
}
func extractOffsetAndType(e error) (int, string) {
e = errors.Cause(e)
switch v := e.(type) {
case *json.UnmarshalTypeError:
return int(v.Offset), "json"
case *json.SyntaxError:
return int(v.Offset), "json"
default:
return -1, ""
}
}
+54
View File
@@ -0,0 +1,54 @@
// Copyright 2018 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 herrors
import (
"testing"
"github.com/pkg/errors"
qt "github.com/frankban/quicktest"
)
func TestToLineNumberError(t *testing.T) {
t.Parallel()
c := qt.New(t)
for i, test := range []struct {
in error
offset int
lineNumber int
columnNumber int
}{
{errors.New("no line number for you"), 0, 1, 1},
{errors.New(`template: _default/single.html:4:15: executing "_default/single.html" at <.Titles>: can't evaluate field Titles in type *hugolib.PageOutput`), 0, 4, 15},
{errors.New("parse failed: template: _default/bundle-resource-meta.html:11: unexpected in operand"), 0, 11, 1},
{errors.New(`failed:: template: _default/bundle-resource-meta.html:2:7: executing "main" at <.Titles>`), 0, 2, 7},
{errors.New(`failed to load translations: (6, 7): was expecting token =, but got "g" instead`), 0, 6, 7},
} {
got := ToFileError("template", test.in)
errMsg := qt.Commentf("[%d][%T]", i, got)
le, ok := got.(FileError)
c.Assert(ok, qt.Equals, true)
c.Assert(ok, qt.Equals, true, errMsg)
pos := le.Position()
c.Assert(pos.LineNumber, qt.Equals, test.lineNumber, errMsg)
c.Assert(pos.ColumnNumber, qt.Equals, test.columnNumber, errMsg)
c.Assert(errors.Cause(got), qt.Not(qt.IsNil))
}
}
+77
View File
@@ -0,0 +1,77 @@
// Copyright 2018 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 herrors
import (
"regexp"
"strconv"
"github.com/pkg/errors"
"github.com/pelletier/go-toml/v2"
)
var lineNumberExtractors = []lineNumberExtractor{
// Template/shortcode parse errors
newLineNumberErrHandlerFromRegexp(".*:(\\d+):(\\d*):"),
newLineNumberErrHandlerFromRegexp(".*:(\\d+):"),
// TOML parse errors
tomlLineNumberExtractor,
// YAML parse errors
newLineNumberErrHandlerFromRegexp("line (\\d+):"),
// i18n bundle errors
newLineNumberErrHandlerFromRegexp("\\((\\d+),\\s(\\d*)"),
}
type lineNumberExtractor func(e error) (int, int)
var tomlLineNumberExtractor = func(e error) (int, int) {
e = errors.Cause(e)
if terr, ok := e.(*toml.DecodeError); ok {
return terr.Position()
}
return -1, -1
}
func newLineNumberErrHandlerFromRegexp(expression string) lineNumberExtractor {
re := regexp.MustCompile(expression)
return extractLineNo(re)
}
func extractLineNo(re *regexp.Regexp) lineNumberExtractor {
return func(e error) (int, int) {
if e == nil {
panic("no error")
}
col := 1
s := e.Error()
m := re.FindStringSubmatch(s)
if len(m) >= 2 {
lno, _ := strconv.Atoi(m[1])
if len(m) > 2 {
col, _ = strconv.Atoi(m[2])
}
if col <= 0 {
col = 1
}
return lno, col
}
return -1, col
}
}
+45
View File
@@ -0,0 +1,45 @@
// Copyright 2020 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 hexec
import (
"context"
"os/exec"
"github.com/cli/safeexec"
)
// SafeCommand is a wrapper around os/exec Command which uses a LookPath
// implementation that does not search in current directory before looking in PATH.
// See https://github.com/cli/safeexec and the linked issues.
func SafeCommand(name string, arg ...string) (*exec.Cmd, error) {
bin, err := safeexec.LookPath(name)
if err != nil {
return nil, err
}
return exec.Command(bin, arg...), nil
}
// SafeCommandContext wraps CommandContext
// See SafeCommand for more context.
func SafeCommandContext(ctx context.Context, name string, arg ...string) (*exec.Cmd, error) {
bin, err := safeexec.LookPath(name)
if err != nil {
return nil, err
}
return exec.CommandContext(ctx, bin, arg...), nil
}
+126
View File
@@ -0,0 +1,126 @@
// Copyright 2019 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 hreflect contains reflect helpers.
package hreflect
import (
"reflect"
"github.com/gohugoio/hugo/common/types"
)
// TODO(bep) replace the private versions in /tpl with these.
// IsNumber returns whether the given kind is a number.
func IsNumber(kind reflect.Kind) bool {
return IsInt(kind) || IsUint(kind) || IsFloat(kind)
}
// IsInt returns whether the given kind is an int.
func IsInt(kind reflect.Kind) bool {
switch kind {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return true
default:
return false
}
}
// IsUint returns whether the given kind is an uint.
func IsUint(kind reflect.Kind) bool {
switch kind {
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
return true
default:
return false
}
}
// IsFloat returns whether the given kind is a float.
func IsFloat(kind reflect.Kind) bool {
switch kind {
case reflect.Float32, reflect.Float64:
return true
default:
return false
}
}
// IsTruthful returns whether in represents a truthful value.
// See IsTruthfulValue
func IsTruthful(in interface{}) bool {
switch v := in.(type) {
case reflect.Value:
return IsTruthfulValue(v)
default:
return IsTruthfulValue(reflect.ValueOf(in))
}
}
var zeroType = reflect.TypeOf((*types.Zeroer)(nil)).Elem()
// IsTruthfulValue returns whether the given value has a meaningful truth value.
// This is based on template.IsTrue in Go's stdlib, but also considers
// IsZero and any interface value will be unwrapped before it's considered
// for truthfulness.
//
// Based on:
// https://github.com/golang/go/blob/178a2c42254166cffed1b25fb1d3c7a5727cada6/src/text/template/exec.go#L306
func IsTruthfulValue(val reflect.Value) (truth bool) {
val = indirectInterface(val)
if !val.IsValid() {
// Something like var x interface{}, never set. It's a form of nil.
return
}
if val.Type().Implements(zeroType) {
return !val.Interface().(types.Zeroer).IsZero()
}
switch val.Kind() {
case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
truth = val.Len() > 0
case reflect.Bool:
truth = val.Bool()
case reflect.Complex64, reflect.Complex128:
truth = val.Complex() != 0
case reflect.Chan, reflect.Func, reflect.Ptr, reflect.Interface:
truth = !val.IsNil()
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
truth = val.Int() != 0
case reflect.Float32, reflect.Float64:
truth = val.Float() != 0
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
truth = val.Uint() != 0
case reflect.Struct:
truth = true // Struct values are always true.
default:
return
}
return
}
// Based on: https://github.com/golang/go/blob/178a2c42254166cffed1b25fb1d3c7a5727cada6/src/text/template/exec.go#L931
func indirectInterface(v reflect.Value) reflect.Value {
if v.Kind() != reflect.Interface {
return v
}
if v.IsNil() {
return reflect.Value{}
}
return v.Elem()
}
+42
View File
@@ -0,0 +1,42 @@
// Copyright 2019 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 hreflect
import (
"reflect"
"testing"
"time"
qt "github.com/frankban/quicktest"
)
func TestIsTruthful(t *testing.T) {
c := qt.New(t)
c.Assert(IsTruthful(true), qt.Equals, true)
c.Assert(IsTruthful(false), qt.Equals, false)
c.Assert(IsTruthful(time.Now()), qt.Equals, true)
c.Assert(IsTruthful(time.Time{}), qt.Equals, false)
}
func BenchmarkIsTruthFul(b *testing.B) {
v := reflect.ValueOf("Hugo")
b.ResetTimer()
for i := 0; i < b.N; i++ {
if !IsTruthfulValue(v) {
b.Fatal("not truthful")
}
}
}
+150
View File
@@ -0,0 +1,150 @@
// Copyright 2021 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 htime
import (
"strings"
"time"
"github.com/spf13/cast"
toml "github.com/pelletier/go-toml/v2"
"github.com/gohugoio/locales"
)
var (
longDayNames = []string{
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
}
shortDayNames = []string{
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat",
}
shortMonthNames = []string{
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
}
longMonthNames = []string{
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
}
)
func NewTimeFormatter(ltr locales.Translator) TimeFormatter {
if ltr == nil {
panic("must provide a locales.Translator")
}
return TimeFormatter{
ltr: ltr,
}
}
// TimeFormatter is locale aware.
type TimeFormatter struct {
ltr locales.Translator
}
func (f TimeFormatter) Format(t time.Time, layout string) string {
if layout == "" {
return ""
}
if layout[0] == ':' {
// It may be one of Hugo's custom layouts.
switch strings.ToLower(layout[1:]) {
case "date_full":
return f.ltr.FmtDateFull(t)
case "date_long":
return f.ltr.FmtDateLong(t)
case "date_medium":
return f.ltr.FmtDateMedium(t)
case "date_short":
return f.ltr.FmtDateShort(t)
case "time_full":
return f.ltr.FmtTimeFull(t)
case "time_long":
return f.ltr.FmtTimeLong(t)
case "time_medium":
return f.ltr.FmtTimeMedium(t)
case "time_short":
return f.ltr.FmtTimeShort(t)
}
}
s := t.Format(layout)
monthIdx := t.Month() - 1 // Month() starts at 1.
dayIdx := t.Weekday()
s = strings.ReplaceAll(s, longMonthNames[monthIdx], f.ltr.MonthWide(t.Month()))
if !strings.Contains(s, f.ltr.MonthWide(t.Month())) {
s = strings.ReplaceAll(s, shortMonthNames[monthIdx], f.ltr.MonthAbbreviated(t.Month()))
}
s = strings.ReplaceAll(s, longDayNames[dayIdx], f.ltr.WeekdayWide(t.Weekday()))
if !strings.Contains(s, f.ltr.WeekdayWide(t.Weekday())) {
s = strings.ReplaceAll(s, shortDayNames[dayIdx], f.ltr.WeekdayAbbreviated(t.Weekday()))
}
return s
}
func ToTimeInDefaultLocationE(i interface{}, location *time.Location) (tim time.Time, err error) {
switch vv := i.(type) {
case toml.LocalDate:
return vv.AsTime(location), nil
case toml.LocalDateTime:
return vv.AsTime(location), nil
// issue #8895
// datetimes parsed by `go-toml` have empty zone name
// convert back them into string and use `cast`
case time.Time:
i = vv.Format(time.RFC3339)
}
return cast.ToTimeInDefaultLocationE(i, location)
}
+148
View File
@@ -0,0 +1,148 @@
// Copyright 2021 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 htime
import (
"testing"
"time"
qt "github.com/frankban/quicktest"
translators "github.com/gohugoio/localescompressed"
)
func TestTimeFormatter(t *testing.T) {
c := qt.New(t)
june06, _ := time.Parse("2006-Jan-02", "2018-Jun-06")
june06 = june06.Add(7777 * time.Second)
jan06, _ := time.Parse("2006-Jan-02", "2018-Jan-06")
jan06 = jan06.Add(32 * time.Second)
mondayNovemberFirst, _ := time.Parse("2006-Jan-02", "2021-11-01")
mondayNovemberFirst = mondayNovemberFirst.Add(33 * time.Second)
c.Run("Norsk nynorsk", func(c *qt.C) {
f := NewTimeFormatter(translators.GetTranslator("nn"))
c.Assert(f.Format(june06, "Monday Jan 2 2006"), qt.Equals, "onsdag juni 6 2018")
c.Assert(f.Format(june06, "Mon January 2 2006"), qt.Equals, "on. juni 6 2018")
c.Assert(f.Format(june06, "Mon Mon"), qt.Equals, "on. on.")
})
c.Run("Custom layouts Norsk nynorsk", func(c *qt.C) {
f := NewTimeFormatter(translators.GetTranslator("nn"))
c.Assert(f.Format(june06, ":date_full"), qt.Equals, "onsdag 6. juni 2018")
c.Assert(f.Format(june06, ":date_long"), qt.Equals, "6. juni 2018")
c.Assert(f.Format(june06, ":date_medium"), qt.Equals, "6. juni 2018")
c.Assert(f.Format(june06, ":date_short"), qt.Equals, "06.06.2018")
c.Assert(f.Format(june06, ":time_full"), qt.Equals, "kl. 02:09:37 UTC")
c.Assert(f.Format(june06, ":time_long"), qt.Equals, "02:09:37 UTC")
c.Assert(f.Format(june06, ":time_medium"), qt.Equals, "02:09:37")
c.Assert(f.Format(june06, ":time_short"), qt.Equals, "02:09")
})
c.Run("Custom layouts English", func(c *qt.C) {
f := NewTimeFormatter(translators.GetTranslator("en"))
c.Assert(f.Format(june06, ":date_full"), qt.Equals, "Wednesday, June 6, 2018")
c.Assert(f.Format(june06, ":date_long"), qt.Equals, "June 6, 2018")
c.Assert(f.Format(june06, ":date_medium"), qt.Equals, "Jun 6, 2018")
c.Assert(f.Format(june06, ":date_short"), qt.Equals, "6/6/18")
c.Assert(f.Format(june06, ":time_full"), qt.Equals, "2:09:37 am UTC")
c.Assert(f.Format(june06, ":time_long"), qt.Equals, "2:09:37 am UTC")
c.Assert(f.Format(june06, ":time_medium"), qt.Equals, "2:09:37 am")
c.Assert(f.Format(june06, ":time_short"), qt.Equals, "2:09 am")
})
c.Run("English", func(c *qt.C) {
f := NewTimeFormatter(translators.GetTranslator("en"))
c.Assert(f.Format(june06, "Monday Jan 2 2006"), qt.Equals, "Wednesday Jun 6 2018")
c.Assert(f.Format(june06, "Mon January 2 2006"), qt.Equals, "Wed June 6 2018")
c.Assert(f.Format(june06, "Mon Mon"), qt.Equals, "Wed Wed")
})
c.Run("Weekdays German", func(c *qt.C) {
tr := translators.GetTranslator("de")
f := NewTimeFormatter(tr)
// Issue #9107
for i, weekDayWideGerman := range []string{"Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"} {
date := mondayNovemberFirst.Add(time.Duration(i*24) * time.Hour)
c.Assert(tr.WeekdayWide(date.Weekday()), qt.Equals, weekDayWideGerman)
c.Assert(f.Format(date, "Monday"), qt.Equals, weekDayWideGerman)
}
for i, weekDayAbbreviatedGerman := range []string{"Mo.", "Di.", "Mi.", "Do.", "Fr.", "Sa.", "So."} {
date := mondayNovemberFirst.Add(time.Duration(i*24) * time.Hour)
c.Assert(tr.WeekdayAbbreviated(date.Weekday()), qt.Equals, weekDayAbbreviatedGerman)
c.Assert(f.Format(date, "Mon"), qt.Equals, weekDayAbbreviatedGerman)
}
})
c.Run("Months German", func(c *qt.C) {
tr := translators.GetTranslator("de")
f := NewTimeFormatter(tr)
// Issue #9107
for i, monthWideNorway := range []string{"Januar", "Februar", "März", "April", "Mai", "Juni", "Juli"} {
date := jan06.Add(time.Duration(i*24*31) * time.Hour)
c.Assert(tr.MonthWide(date.Month()), qt.Equals, monthWideNorway)
c.Assert(f.Format(date, "January"), qt.Equals, monthWideNorway)
}
})
}
func BenchmarkTimeFormatter(b *testing.B) {
june06, _ := time.Parse("2006-Jan-02", "2018-Jun-06")
b.Run("Native", func(b *testing.B) {
for i := 0; i < b.N; i++ {
got := june06.Format("Monday Jan 2 2006")
if got != "Wednesday Jun 6 2018" {
b.Fatalf("invalid format, got %q", got)
}
}
})
b.Run("Localized", func(b *testing.B) {
f := NewTimeFormatter(translators.GetTranslator("nn"))
b.ResetTimer()
for i := 0; i < b.N; i++ {
got := f.Format(june06, "Monday Jan 2 2006")
if got != "onsdag juni 6 2018" {
b.Fatalf("invalid format, got %q", got)
}
}
})
b.Run("Localized Custom", func(b *testing.B) {
f := NewTimeFormatter(translators.GetTranslator("nn"))
b.ResetTimer()
for i := 0; i < b.N; i++ {
got := f.Format(june06, ":date_medium")
if got != "6. juni 2018" {
b.Fatalf("invalid format, got %q", got)
}
}
})
}
+91
View File
@@ -0,0 +1,91 @@
// Copyright 2019 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 hugio
import (
"io"
"io/ioutil"
"os"
"path/filepath"
"github.com/pkg/errors"
"github.com/spf13/afero"
)
// CopyFile copies a file.
func CopyFile(fs afero.Fs, from, to string) error {
sf, err := fs.Open(from)
if err != nil {
return err
}
defer sf.Close()
df, err := fs.Create(to)
if err != nil {
return err
}
defer df.Close()
_, err = io.Copy(df, sf)
if err != nil {
return err
}
si, err := fs.Stat(from)
if err != nil {
err = fs.Chmod(to, si.Mode())
if err != nil {
return err
}
}
return nil
}
// CopyDir copies a directory.
func CopyDir(fs afero.Fs, from, to string, shouldCopy func(filename string) bool) error {
fi, err := os.Stat(from)
if err != nil {
return err
}
if !fi.IsDir() {
return errors.Errorf("%q is not a directory", from)
}
err = fs.MkdirAll(to, 0777) // before umask
if err != nil {
return err
}
entries, _ := ioutil.ReadDir(from)
for _, entry := range entries {
fromFilename := filepath.Join(from, entry.Name())
toFilename := filepath.Join(to, entry.Name())
if entry.IsDir() {
if shouldCopy != nil && !shouldCopy(fromFilename) {
continue
}
if err := CopyDir(fs, fromFilename, toFilename, shouldCopy); err != nil {
return err
}
} else {
if err := CopyFile(fs, fromFilename, toFilename); err != nil {
return err
}
}
}
return nil
}
@@ -1,4 +1,4 @@
// Copyright 2018 The Hugo Authors. All rights reserved.
// Copyright 2019 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.
@@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package resource
package hugio
import (
"io"
@@ -31,7 +31,13 @@ type ReadSeekCloser interface {
io.Closer
}
// ReadSeekCloserProvider provides a ReadSeekCloser.
type ReadSeekCloserProvider interface {
ReadSeekCloser() (ReadSeekCloser, error)
}
// ReadSeekerNoOpCloser implements ReadSeekCloser by doing nothing in Close.
// TODO(bep) rename this and similar to ReadSeekerNopCloser, naming used in stdlib, which kind of makes sense.
type ReadSeekerNoOpCloser struct {
ReadSeeker
}
+76
View File
@@ -0,0 +1,76 @@
// Copyright 2018 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 hugio
import (
"io"
"io/ioutil"
)
type multiWriteCloser struct {
io.Writer
closers []io.WriteCloser
}
func (m multiWriteCloser) Close() error {
var err error
for _, c := range m.closers {
if closeErr := c.Close(); err != nil {
err = closeErr
}
}
return err
}
// NewMultiWriteCloser creates a new io.WriteCloser that duplicates its writes to all the
// provided writers.
func NewMultiWriteCloser(writeClosers ...io.WriteCloser) io.WriteCloser {
writers := make([]io.Writer, len(writeClosers))
for i, w := range writeClosers {
writers[i] = w
}
return multiWriteCloser{Writer: io.MultiWriter(writers...), closers: writeClosers}
}
// ToWriteCloser creates an io.WriteCloser from the given io.Writer.
// If it's not already, one will be created with a Close method that does nothing.
func ToWriteCloser(w io.Writer) io.WriteCloser {
if rw, ok := w.(io.WriteCloser); ok {
return rw
}
return struct {
io.Writer
io.Closer
}{
w,
ioutil.NopCloser(nil),
}
}
// ToReadCloser creates an io.ReadCloser from the given io.Reader.
// If it's not already, one will be created with a Close method that does nothing.
func ToReadCloser(r io.Reader) io.ReadCloser {
if rc, ok := r.(io.ReadCloser); ok {
return rc
}
return struct {
io.Reader
io.Closer
}{
r,
ioutil.NopCloser(nil),
}
}
+153
View File
@@ -0,0 +1,153 @@
// Copyright 2018 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 hugo
import (
"fmt"
"html/template"
"os"
"path/filepath"
"runtime/debug"
"sort"
"strings"
"github.com/gohugoio/hugo/hugofs/files"
"github.com/spf13/afero"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/hugofs"
)
const (
EnvironmentDevelopment = "development"
EnvironmentProduction = "production"
)
var (
// commitHash contains the current Git revision.
// Use mage to build to make sure this gets set.
commitHash string
// buildDate contains the date of the current build.
buildDate string
// vendorInfo contains vendor notes about the current build.
vendorInfo string
)
// Info contains information about the current Hugo environment
type Info struct {
CommitHash string
BuildDate string
// The build environment.
// Defaults are "production" (hugo) and "development" (hugo server).
// This can also be set by the user.
// It can be any string, but it will be all lower case.
Environment string
}
// Version returns the current version as a comparable version string.
func (i Info) Version() VersionString {
return CurrentVersion.Version()
}
// Generator a Hugo meta generator HTML tag.
func (i Info) Generator() template.HTML {
return template.HTML(fmt.Sprintf(`<meta name="generator" content="Hugo %s" />`, CurrentVersion.String()))
}
func (i Info) IsProduction() bool {
return i.Environment == EnvironmentProduction
}
func (i Info) IsExtended() bool {
return IsExtended
}
// NewInfo creates a new Hugo Info object.
func NewInfo(environment string) Info {
if environment == "" {
environment = EnvironmentProduction
}
return Info{
CommitHash: commitHash,
BuildDate: buildDate,
Environment: environment,
}
}
func GetExecEnviron(workDir string, cfg config.Provider, fs afero.Fs) []string {
env := os.Environ()
nodepath := filepath.Join(workDir, "node_modules")
if np := os.Getenv("NODE_PATH"); np != "" {
nodepath = workDir + string(os.PathListSeparator) + np
}
config.SetEnvVars(&env, "NODE_PATH", nodepath)
config.SetEnvVars(&env, "PWD", workDir)
config.SetEnvVars(&env, "HUGO_ENVIRONMENT", cfg.GetString("environment"))
fis, err := afero.ReadDir(fs, files.FolderJSConfig)
if err == nil {
for _, fi := range fis {
key := fmt.Sprintf("HUGO_FILE_%s", strings.ReplaceAll(strings.ToUpper(fi.Name()), ".", "_"))
value := fi.(hugofs.FileMetaInfo).Meta().Filename
config.SetEnvVars(&env, key, value)
}
}
return env
}
// GetDependencyList returns a sorted dependency list on the format package="version".
// It includes both Go dependencies and (a manually maintained) list of C(++) dependencies.
func GetDependencyList() []string {
var deps []string
formatDep := func(path, version string) string {
return fmt.Sprintf("%s=%q", path, version)
}
if IsExtended {
deps = append(
deps,
// TODO(bep) consider adding a DepsNonGo() method to these upstream projects.
formatDep("github.com/sass/libsass", "3.6.5"),
formatDep("github.com/webmproject/libwebp", "v1.2.0"),
)
}
bi, ok := debug.ReadBuildInfo()
if !ok {
return deps
}
for _, dep := range bi.Deps {
deps = append(deps, formatDep(dep.Path, dep.Version))
}
sort.Strings(deps)
return deps
}
// IsRunningAsTest reports whether we are running as a test.
func IsRunningAsTest() bool {
for _, arg := range os.Args {
if strings.HasPrefix(arg, "-test") {
return true
}
}
return false
}
+39
View File
@@ -0,0 +1,39 @@
// Copyright 2018 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 hugo
import (
"fmt"
"testing"
qt "github.com/frankban/quicktest"
)
func TestHugoInfo(t *testing.T) {
c := qt.New(t)
hugoInfo := NewInfo("")
c.Assert(hugoInfo.Version(), qt.Equals, CurrentVersion.Version())
c.Assert(fmt.Sprintf("%T", VersionString("")), qt.Equals, fmt.Sprintf("%T", hugoInfo.Version()))
c.Assert(hugoInfo.CommitHash, qt.Equals, commitHash)
c.Assert(hugoInfo.BuildDate, qt.Equals, buildDate)
c.Assert(hugoInfo.Environment, qt.Equals, "production")
c.Assert(string(hugoInfo.Generator()), qt.Contains, fmt.Sprintf("Hugo %s", hugoInfo.Version()))
c.Assert(hugoInfo.IsProduction(), qt.Equals, true)
c.Assert(hugoInfo.IsExtended(), qt.Equals, IsExtended)
devHugoInfo := NewInfo("development")
c.Assert(devHugoInfo.IsProduction(), qt.Equals, false)
}
@@ -11,13 +11,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// +build windows
// +build extended
package commands
package hugo
const (
ansiEsc = ""
clearLine = ""
hideCursor = ""
showCursor = ""
)
var IsExtended = true
@@ -11,13 +11,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// +build !windows
// +build !extended
package commands
package hugo
const (
ansiEsc = "\u001B"
clearLine = "\r\033[K"
hideCursor = ansiEsc + "[?25l"
showCursor = ansiEsc + "[?25h"
)
var IsExtended = false
+89 -41
View File
@@ -1,4 +1,4 @@
// Copyright 2015 The Hugo Authors. All rights reserved.
// Copyright 2018 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.
@@ -11,18 +11,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package helpers
package hugo
import (
"fmt"
"io"
"runtime"
"strings"
"github.com/gohugoio/hugo/compare"
"github.com/spf13/cast"
)
// HugoVersion represents the Hugo build version.
type HugoVersion struct {
// Version represents the Hugo build version.
type Version struct {
// Major and minor version.
Number float32
@@ -35,32 +37,34 @@ type HugoVersion struct {
}
var (
_ compare.Eqer = (*HugoVersionString)(nil)
_ compare.Comparer = (*HugoVersionString)(nil)
_ compare.Eqer = (*VersionString)(nil)
_ compare.Comparer = (*VersionString)(nil)
)
type HugoVersionString string
func (v HugoVersion) String() string {
return hugoVersion(v.Number, v.PatchLevel, v.Suffix)
func (v Version) String() string {
return version(v.Number, v.PatchLevel, v.Suffix)
}
func (v HugoVersion) Version() HugoVersionString {
return HugoVersionString(v.String())
// Version returns the Hugo version.
func (v Version) Version() VersionString {
return VersionString(v.String())
}
func (h HugoVersionString) String() string {
// VersionString represents a Hugo version string.
type VersionString string
func (h VersionString) String() string {
return string(h)
}
// Implements compare.Comparer
func (h HugoVersionString) Compare(other interface{}) int {
v := MustParseHugoVersion(h.String())
// Compare implements the compare.Comparer interface.
func (h VersionString) Compare(other interface{}) int {
v := MustParseVersion(h.String())
return compareVersionsWithSuffix(v.Number, v.PatchLevel, v.Suffix, other)
}
// Implements compare.Eqer
func (h HugoVersionString) Eq(other interface{}) bool {
// Eq implements the compare.Eqer interface.
func (h VersionString) Eq(other interface{}) bool {
s, err := cast.ToStringE(other)
if err != nil {
return false
@@ -70,9 +74,9 @@ func (h HugoVersionString) Eq(other interface{}) bool {
var versionSuffixes = []string{"-test", "-DEV"}
// ParseHugoVersion parses a version string.
func ParseHugoVersion(s string) (HugoVersion, error) {
var vv HugoVersion
// ParseVersion parses a version string.
func ParseVersion(s string) (Version, error) {
var vv Version
for _, suffix := range versionSuffixes {
if strings.HasSuffix(s, suffix) {
vv.Suffix = suffix
@@ -88,10 +92,10 @@ func ParseHugoVersion(s string) (HugoVersion, error) {
return vv, nil
}
// MustParseHugoVersion parses a version string
// MustParseVersion parses a version string
// and panics if any error occurs.
func MustParseHugoVersion(s string) HugoVersion {
vv, err := ParseHugoVersion(s)
func MustParseVersion(s string) Version {
vv, err := ParseVersion(s)
if err != nil {
panic(err)
}
@@ -99,37 +103,60 @@ func MustParseHugoVersion(s string) HugoVersion {
}
// ReleaseVersion represents the release version.
func (v HugoVersion) ReleaseVersion() HugoVersion {
func (v Version) ReleaseVersion() Version {
v.Suffix = ""
return v
}
// Next returns the next Hugo release version.
func (v HugoVersion) Next() HugoVersion {
return HugoVersion{Number: v.Number + 0.01}
func (v Version) Next() Version {
return Version{Number: v.Number + 0.01}
}
// Prev returns the previous Hugo release version.
func (v HugoVersion) Prev() HugoVersion {
return HugoVersion{Number: v.Number - 0.01}
func (v Version) Prev() Version {
return Version{Number: v.Number - 0.01}
}
// NextPatchLevel returns the next patch/bugfix Hugo version.
// This will be a patch increment on the previous Hugo version.
func (v HugoVersion) NextPatchLevel(level int) HugoVersion {
return HugoVersion{Number: v.Number - 0.01, PatchLevel: level}
func (v Version) NextPatchLevel(level int) Version {
return Version{Number: v.Number - 0.01, PatchLevel: level}
}
// CurrentHugoVersion represents the current build version.
// This should be the only one.
var CurrentHugoVersion = HugoVersion{
Number: 0.45,
PatchLevel: 0,
Suffix: "",
// BuildVersionString creates a version string. This is what you see when
// running "hugo version".
func BuildVersionString() string {
// program := "Hugo Static Site Generator"
program := "hugo"
version := "v" + CurrentVersion.String()
if commitHash != "" {
version += "-" + strings.ToUpper(commitHash)
}
if IsExtended {
version += "+extended"
}
osArch := runtime.GOOS + "/" + runtime.GOARCH
date := buildDate
if date == "" {
date = "unknown"
}
versionString := fmt.Sprintf("%s %s %s BuildDate=%s",
program, version, osArch, date)
if vendorInfo != "" {
versionString += " VendorInfo=" + vendorInfo
}
return versionString
}
func hugoVersion(version float32, patchVersion int, suffix string) string {
if patchVersion > 0 {
func version(version float32, patchVersion int, suffix string) string {
if patchVersion > 0 || version > 0.53 {
return fmt.Sprintf("%.2f.%d%s", version, patchVersion, suffix)
}
return fmt.Sprintf("%.2f%s", version, suffix)
@@ -140,7 +167,7 @@ func hugoVersion(version float32, patchVersion int, suffix string) string {
// It returns -1 if the given version is less than, 0 if equal and 1 if greater than
// the running version.
func CompareVersion(version interface{}) int {
return compareVersionsWithSuffix(CurrentHugoVersion.Number, CurrentHugoVersion.PatchLevel, CurrentHugoVersion.Suffix, version)
return compareVersionsWithSuffix(CurrentVersion.Number, CurrentVersion.PatchLevel, CurrentVersion.Suffix, version)
}
func compareVersions(inVersion float32, inPatchVersion int, in interface{}) int {
@@ -166,7 +193,7 @@ func compareVersionsWithSuffix(inVersion float32, inPatchVersion int, suffix str
return -1
}
v, err := ParseHugoVersion(s)
v, err := ParseVersion(s)
if err != nil {
return -1
}
@@ -215,3 +242,24 @@ func compareFloatVersions(version float32, v float32) int {
}
return 1
}
func GoMinorVersion() int {
return goMinorVersion(runtime.Version())
}
func goMinorVersion(version string) int {
if strings.HasPrefix(version, "devel") {
return 9999 // magic
}
var major, minor int
var trailing string
n, err := fmt.Sscanf(version, "go%d.%d%s", &major, &minor, &trailing)
if n == 2 && err == io.EOF {
// Means there were no trailing characters (i.e., not an alpha/beta)
err = nil
}
if err != nil {
return 0
}
return minor
}
@@ -11,22 +11,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package pagemeta
package hugo
import (
"time"
)
type URLPath struct {
URL string
Permalink string
Slug string
Section string
}
type PageDates struct {
Date time.Time
Lastmod time.Time
PublishDate time.Time
ExpiryDate time.Time
// CurrentVersion represents the current build version.
// This should be the only one.
var CurrentVersion = Version{
Number: 0.90,
PatchLevel: 0,
Suffix: "",
}
+89
View File
@@ -0,0 +1,89 @@
// Copyright 2015 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 hugo
import (
"testing"
qt "github.com/frankban/quicktest"
)
func TestHugoVersion(t *testing.T) {
c := qt.New(t)
c.Assert(version(0.15, 0, "-DEV"), qt.Equals, "0.15-DEV")
c.Assert(version(0.15, 2, "-DEV"), qt.Equals, "0.15.2-DEV")
v := Version{Number: 0.21, PatchLevel: 0, Suffix: "-DEV"}
c.Assert(v.ReleaseVersion().String(), qt.Equals, "0.21")
c.Assert(v.String(), qt.Equals, "0.21-DEV")
c.Assert(v.Next().String(), qt.Equals, "0.22")
nextVersionString := v.Next().Version()
c.Assert(nextVersionString.String(), qt.Equals, "0.22")
c.Assert(nextVersionString.Eq("0.22"), qt.Equals, true)
c.Assert(nextVersionString.Eq("0.21"), qt.Equals, false)
c.Assert(nextVersionString.Eq(nextVersionString), qt.Equals, true)
c.Assert(v.NextPatchLevel(3).String(), qt.Equals, "0.20.3")
// We started to use full semver versions even for main
// releases in v0.54.0
v = Version{Number: 0.53, PatchLevel: 0}
c.Assert(v.String(), qt.Equals, "0.53")
c.Assert(v.Next().String(), qt.Equals, "0.54.0")
c.Assert(v.Next().Next().String(), qt.Equals, "0.55.0")
v = Version{Number: 0.54, PatchLevel: 0, Suffix: "-DEV"}
c.Assert(v.String(), qt.Equals, "0.54.0-DEV")
}
func TestCompareVersions(t *testing.T) {
c := qt.New(t)
c.Assert(compareVersions(0.20, 0, 0.20), qt.Equals, 0)
c.Assert(compareVersions(0.20, 0, float32(0.20)), qt.Equals, 0)
c.Assert(compareVersions(0.20, 0, float64(0.20)), qt.Equals, 0)
c.Assert(compareVersions(0.19, 1, 0.20), qt.Equals, 1)
c.Assert(compareVersions(0.19, 3, "0.20.2"), qt.Equals, 1)
c.Assert(compareVersions(0.19, 1, 0.01), qt.Equals, -1)
c.Assert(compareVersions(0, 1, 3), qt.Equals, 1)
c.Assert(compareVersions(0, 1, int32(3)), qt.Equals, 1)
c.Assert(compareVersions(0, 1, int64(3)), qt.Equals, 1)
c.Assert(compareVersions(0.20, 0, "0.20"), qt.Equals, 0)
c.Assert(compareVersions(0.20, 1, "0.20.1"), qt.Equals, 0)
c.Assert(compareVersions(0.20, 1, "0.20"), qt.Equals, -1)
c.Assert(compareVersions(0.20, 0, "0.20.1"), qt.Equals, 1)
c.Assert(compareVersions(0.20, 1, "0.20.2"), qt.Equals, 1)
c.Assert(compareVersions(0.21, 1, "0.22.1"), qt.Equals, 1)
c.Assert(compareVersions(0.22, 0, "0.22-DEV"), qt.Equals, -1)
c.Assert(compareVersions(0.22, 0, "0.22.1-DEV"), qt.Equals, 1)
c.Assert(compareVersionsWithSuffix(0.22, 0, "-DEV", "0.22"), qt.Equals, 1)
c.Assert(compareVersionsWithSuffix(0.22, 1, "-DEV", "0.22"), qt.Equals, -1)
c.Assert(compareVersionsWithSuffix(0.22, 1, "-DEV", "0.22.1-DEV"), qt.Equals, 0)
}
func TestParseHugoVersion(t *testing.T) {
c := qt.New(t)
c.Assert(MustParseVersion("0.25").String(), qt.Equals, "0.25")
c.Assert(MustParseVersion("0.25.2").String(), qt.Equals, "0.25.2")
c.Assert(MustParseVersion("0.25-test").String(), qt.Equals, "0.25-test")
c.Assert(MustParseVersion("0.25-DEV").String(), qt.Equals, "0.25-DEV")
}
func TestGoMinorVersion(t *testing.T) {
c := qt.New(t)
c.Assert(goMinorVersion("go1.12.5"), qt.Equals, 12)
c.Assert(goMinorVersion("go1.14rc1"), qt.Equals, 14)
c.Assert(GoMinorVersion() >= 11, qt.Equals, true)
}
+65
View File
@@ -0,0 +1,65 @@
// Copyright 2020 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 loggers
import (
"fmt"
"strings"
)
// IgnorableLogger is a logger that ignores certain log statements.
type IgnorableLogger interface {
Logger
Errorsf(statementID, format string, v ...interface{})
Apply(logger Logger) IgnorableLogger
}
type ignorableLogger struct {
Logger
statements map[string]bool
}
// NewIgnorableLogger wraps the given logger and ignores the log statement IDs given.
func NewIgnorableLogger(logger Logger, statements ...string) IgnorableLogger {
statementsSet := make(map[string]bool)
for _, s := range statements {
statementsSet[strings.ToLower(s)] = true
}
return ignorableLogger{
Logger: logger,
statements: statementsSet,
}
}
// Errorsf logs statementID as an ERROR if not configured as ignoreable.
func (l ignorableLogger) Errorsf(statementID, format string, v ...interface{}) {
if l.statements[statementID] {
// Ignore.
return
}
ignoreMsg := fmt.Sprintf(`
If you feel that this should not be logged as an ERROR, you can ignore it by adding this to your site config:
ignoreErrors = [%q]`, statementID)
format += ignoreMsg
l.Errorf(format, v...)
}
func (l ignorableLogger) Apply(logger Logger) IgnorableLogger {
return ignorableLogger{
Logger: logger,
statements: l.statements,
}
}
+309 -7
View File
@@ -1,4 +1,4 @@
// Copyright 2018 The Hugo Authors. All rights reserved.
// Copyright 2020 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.
@@ -14,24 +14,326 @@
package loggers
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"regexp"
"runtime"
"time"
"github.com/gohugoio/hugo/common/terminal"
jww "github.com/spf13/jwalterweatherman"
)
// Counts ERROR logs to the global jww logger.
var GlobalErrorCounter *jww.Counter
func init() {
GlobalErrorCounter = &jww.Counter{}
jww.SetLogListeners(jww.LogCounter(GlobalErrorCounter, jww.LevelError))
}
func LoggerToWriterWithPrefix(logger *log.Logger, prefix string) io.Writer {
return prefixWriter{
logger: logger,
prefix: prefix,
}
}
type prefixWriter struct {
logger *log.Logger
prefix string
}
func (w prefixWriter) Write(p []byte) (n int, err error) {
w.logger.Printf("%s: %s", w.prefix, p)
return len(p), nil
}
type Logger interface {
Printf(format string, v ...interface{})
Println(v ...interface{})
PrintTimerIfDelayed(start time.Time, name string)
Debug() *log.Logger
Debugf(format string, v ...interface{})
Debugln(v ...interface{})
Info() *log.Logger
Infof(format string, v ...interface{})
Infoln(v ...interface{})
Warn() *log.Logger
Warnf(format string, v ...interface{})
Warnln(v ...interface{})
Error() *log.Logger
Errorf(format string, v ...interface{})
Errorln(v ...interface{})
Errors() string
Out() io.Writer
Reset()
// Used in tests.
LogCounters() *LogCounters
}
type LogCounters struct {
ErrorCounter *jww.Counter
WarnCounter *jww.Counter
}
type logger struct {
*jww.Notepad
// The writer that represents stdout.
// Will be ioutil.Discard when in quiet mode.
out io.Writer
logCounters *LogCounters
// This is only set in server mode.
errors *bytes.Buffer
}
func (l *logger) Printf(format string, v ...interface{}) {
l.FEEDBACK.Printf(format, v...)
}
func (l *logger) Println(v ...interface{}) {
l.FEEDBACK.Println(v...)
}
func (l *logger) Debug() *log.Logger {
return l.DEBUG
}
func (l *logger) Debugf(format string, v ...interface{}) {
l.DEBUG.Printf(format, v...)
}
func (l *logger) Debugln(v ...interface{}) {
l.DEBUG.Println(v...)
}
func (l *logger) Infof(format string, v ...interface{}) {
l.INFO.Printf(format, v...)
}
func (l *logger) Infoln(v ...interface{}) {
l.INFO.Println(v...)
}
func (l *logger) Info() *log.Logger {
return l.INFO
}
func (l *logger) Warnf(format string, v ...interface{}) {
l.WARN.Printf(format, v...)
}
func (l *logger) Warnln(v ...interface{}) {
l.WARN.Println(v...)
}
func (l *logger) Warn() *log.Logger {
return l.WARN
}
func (l *logger) Errorf(format string, v ...interface{}) {
l.ERROR.Printf(format, v...)
}
func (l *logger) Errorln(v ...interface{}) {
l.ERROR.Println(v...)
}
func (l *logger) Error() *log.Logger {
return l.ERROR
}
func (l *logger) LogCounters() *LogCounters {
return l.logCounters
}
func (l *logger) Out() io.Writer {
return l.out
}
// PrintTimerIfDelayed prints a time statement to the FEEDBACK logger
// if considerable time is spent.
func (l *logger) PrintTimerIfDelayed(start time.Time, name string) {
elapsed := time.Since(start)
milli := int(1000 * elapsed.Seconds())
if milli < 500 {
return
}
l.Printf("%s in %v ms", name, milli)
}
func (l *logger) PrintTimer(start time.Time, name string) {
elapsed := time.Since(start)
milli := int(1000 * elapsed.Seconds())
l.Printf("%s in %v ms", name, milli)
}
func (l *logger) Errors() string {
if l.errors == nil {
return ""
}
return ansiColorRe.ReplaceAllString(l.errors.String(), "")
}
// Reset resets the logger's internal state.
func (l *logger) Reset() {
l.logCounters.ErrorCounter.Reset()
if l.errors != nil {
l.errors.Reset()
}
}
// NewLogger creates a new Logger for the given thresholds
func NewLogger(stdoutThreshold, logThreshold jww.Threshold, outHandle, logHandle io.Writer, saveErrors bool) Logger {
return newLogger(stdoutThreshold, logThreshold, outHandle, logHandle, saveErrors)
}
// NewDebugLogger is a convenience function to create a debug logger.
func NewDebugLogger() *jww.Notepad {
return jww.NewNotepad(jww.LevelDebug, jww.LevelError, os.Stdout, ioutil.Discard, "", log.Ldate|log.Ltime)
func NewDebugLogger() Logger {
return NewBasicLogger(jww.LevelDebug)
}
// NewWarningLogger is a convenience function to create a warning logger.
func NewWarningLogger() *jww.Notepad {
return jww.NewNotepad(jww.LevelWarn, jww.LevelError, os.Stdout, ioutil.Discard, "", log.Ldate|log.Ltime)
func NewWarningLogger() Logger {
return NewBasicLogger(jww.LevelWarn)
}
// NewInfoLogger is a convenience function to create a info logger.
func NewInfoLogger() Logger {
return NewBasicLogger(jww.LevelInfo)
}
// NewErrorLogger is a convenience function to create an error logger.
func NewErrorLogger() *jww.Notepad {
return jww.NewNotepad(jww.LevelError, jww.LevelError, os.Stdout, ioutil.Discard, "", log.Ldate|log.Ltime)
func NewErrorLogger() Logger {
return NewBasicLogger(jww.LevelError)
}
// NewBasicLogger creates a new basic logger writing to Stdout.
func NewBasicLogger(t jww.Threshold) Logger {
return newLogger(t, jww.LevelError, os.Stdout, ioutil.Discard, false)
}
// NewBasicLoggerForWriter creates a new basic logger writing to w.
func NewBasicLoggerForWriter(t jww.Threshold, w io.Writer) Logger {
return newLogger(t, jww.LevelError, w, ioutil.Discard, false)
}
var (
ansiColorRe = regexp.MustCompile("(?s)\\033\\[\\d*(;\\d*)*m")
errorRe = regexp.MustCompile("^(ERROR|FATAL|WARN)")
)
type ansiCleaner struct {
w io.Writer
}
func (a ansiCleaner) Write(p []byte) (n int, err error) {
return a.w.Write(ansiColorRe.ReplaceAll(p, []byte("")))
}
type labelColorizer struct {
w io.Writer
}
func (a labelColorizer) Write(p []byte) (n int, err error) {
replaced := errorRe.ReplaceAllStringFunc(string(p), func(m string) string {
switch m {
case "ERROR", "FATAL":
return terminal.Error(m)
case "WARN":
return terminal.Warning(m)
default:
return m
}
})
// io.MultiWriter will abort if we return a bigger write count than input
// bytes, so we lie a little.
_, err = a.w.Write([]byte(replaced))
return len(p), err
}
// InitGlobalLogger initializes the global logger, used in some rare cases.
func InitGlobalLogger(stdoutThreshold, logThreshold jww.Threshold, outHandle, logHandle io.Writer) {
outHandle, logHandle = getLogWriters(outHandle, logHandle)
jww.SetStdoutOutput(outHandle)
jww.SetLogOutput(logHandle)
jww.SetLogThreshold(logThreshold)
jww.SetStdoutThreshold(stdoutThreshold)
}
func getLogWriters(outHandle, logHandle io.Writer) (io.Writer, io.Writer) {
isTerm := terminal.IsTerminal(os.Stdout)
if logHandle != ioutil.Discard && isTerm {
// Remove any Ansi coloring from log output
logHandle = ansiCleaner{w: logHandle}
}
if isTerm {
outHandle = labelColorizer{w: outHandle}
}
return outHandle, logHandle
}
type fatalLogWriter int
func (s fatalLogWriter) Write(p []byte) (n int, err error) {
trace := make([]byte, 1500)
runtime.Stack(trace, true)
fmt.Printf("\n===========\n\n%s\n", trace)
os.Exit(-1)
return 0, nil
}
var fatalLogListener = func(t jww.Threshold) io.Writer {
if t != jww.LevelError {
// Only interested in ERROR
return nil
}
return new(fatalLogWriter)
}
func newLogger(stdoutThreshold, logThreshold jww.Threshold, outHandle, logHandle io.Writer, saveErrors bool) *logger {
errorCounter := &jww.Counter{}
warnCounter := &jww.Counter{}
outHandle, logHandle = getLogWriters(outHandle, logHandle)
listeners := []jww.LogListener{jww.LogCounter(errorCounter, jww.LevelError), jww.LogCounter(warnCounter, jww.LevelWarn)}
var errorBuff *bytes.Buffer
if saveErrors {
errorBuff = new(bytes.Buffer)
errorCapture := func(t jww.Threshold) io.Writer {
if t != jww.LevelError {
// Only interested in ERROR
return nil
}
return errorBuff
}
listeners = append(listeners, errorCapture)
}
return &logger{
Notepad: jww.NewNotepad(stdoutThreshold, logThreshold, outHandle, logHandle, "", log.Ldate|log.Ltime, listeners...),
out: outHandle,
logCounters: &LogCounters{
ErrorCounter: errorCounter,
WarnCounter: warnCounter,
},
errors: errorBuff,
}
}

Some files were not shown because too many files have changed in this diff Show More