Commit graph

4045 commits

Author SHA1 Message Date
Bjørn Erik Pedersen 5ed11edf5a
releaser: Update to Go 1.10 2018-02-21 08:52:44 +01:00
Bjørn Erik Pedersen 799c654b0d resource: Preserve color palette for PNG images
This commit will force a reprocessing of PNG images with new names, so it is adviced to run a `hugo --gc` to remove stale files.

Fixes #4416
2018-02-19 20:15:58 +01:00
Curtis Timson faa3159e5e Fix typos in development contribution doc 2018-02-18 20:47:18 +01:00
Bjørn Erik Pedersen eaf573a277
Update dependencies
Closes #4418
2018-02-17 10:46:38 +01:00
Bjørn Erik Pedersen 3ced6f8d47
magefile: Disable Go 1.10 gofmt check for now 2018-02-17 01:24:07 +01:00
Bjørn Erik Pedersen a3f26e5636
Second try: Update to Go 1.10 (!) 2018-02-17 00:35:22 +01:00
Bjørn Erik Pedersen 0c452c6e7d
Revert "Update to Go 1.10 (!)"
This reverts commit ff10c15a93.
2018-02-16 23:42:42 +01:00
Bjørn Erik Pedersen ff10c15a93
Update to Go 1.10 (!)
See https://blog.golang.org/go1.10
2018-02-16 23:29:51 +01:00
Bjørn Erik Pedersen efd506314a
Merge branch 'release-0.36.1' 2018-02-15 10:13:09 +01:00
hugoreleaser 8de91da74f releaser: Prepare repository for 0.37-DEV
[ci skip]
2018-02-15 09:10:09 +00:00
hugoreleaser 25e88ccabe releaser: Add release notes to /docs for release of 0.36.1
[ci skip]
2018-02-15 09:07:43 +00:00
hugoreleaser 19228ed83c releaser: Bump versions for release of 0.36.1
[ci skip]
2018-02-15 09:07:43 +00:00
Bjørn Erik Pedersen a1f40084f9
Release 0.36.1 2018-02-15 10:03:24 +01:00
hugoreleaser d7bf9d4daa releaser: Add release notes draft for 0.36.1
Rename to *-ready.md to continue. [ci skip]
2018-02-15 08:51:22 +00:00
Bjørn Erik Pedersen 53e661e7c9
releaser: Update to Go 1.9.4 2018-02-15 09:43:03 +01:00
Bjørn Erik Pedersen fc23a80ffd
Bump Travis/Snapcraft to Go 1.9.4 2018-02-15 09:43:03 +01:00
Bjørn Erik Pedersen d8fdffb552
resource: Fix multi-threaded image processing issue
When doing something like this with the same image from a partial used in, say, both the home page and the single page:

```bash
{{ with $img }}
{{ $big := .Fill "1024x512 top" }}
{{ $small := $big.Resize "512x" }}
{{ end }}
```

There would be timing issues making Hugo in some cases try to process the same image with the same instructions in parallel.

You would experience errors of type:

```bash
png: invalid format: not enough pixel data
```

This commit works around that by adding a mutex per image. This should also improve the performance, sligthly, as it avoids duplicate work.

The current workaround before this fix is to always operate on the original:

```bash
{{ with $img }}
{{ $big := .Fill "1024x512 top" }}
{{ $small := .Fill "512x256 top" }}
{{ end }}
```

Fixes #4404
2018-02-15 09:41:29 +01:00
Bjørn Erik Pedersen 2851af0225
resource: Improve error processing error message 2018-02-15 09:41:29 +01:00
Bjørn Erik Pedersen 08521dac83
hugolib: Improve error message in .Render 2018-02-15 09:41:29 +01:00
Bjørn Erik Pedersen 58382e9572 resource: Fix multi-threaded image processing issue
When doing something like this with the same image from a partial used in, say, both the home page and the single page:

```bash
{{ with $img }}
{{ $big := .Fill "1024x512 top" }}
{{ $small := $big.Resize "512x" }}
{{ end }}
```

There would be timing issues making Hugo in some cases try to process the same image with the same instructions in parallel.

You would experience errors of type:

```bash
png: invalid format: not enough pixel data
```

This commit works around that by adding a mutex per image. This should also improve the performance, sligthly, as it avoids duplicate work.

The current workaround before this fix is to always operate on the original:

```bash
{{ with $img }}
{{ $big := .Fill "1024x512 top" }}
{{ $small := .Fill "512x256 top" }}
{{ end }}
```

Fixes #4404
2018-02-14 20:59:02 +01:00
Bjørn Erik Pedersen 53dac9a506
resource: Improve error processing error message 2018-02-13 09:14:44 +01:00
Bjørn Erik Pedersen 4edb4bcc65
hugolib: Improve error message in .Render 2018-02-13 09:01:47 +01:00
Bjørn Erik Pedersen 0816a97a46
parser: Add WARNING for integer YAML keys
```bash
benchmark                                               old ns/op     new ns/op     delta
BenchmarkStringifyMapKeysStringsOnlyInterfaceMaps-4     3053          2015          -34.00%
BenchmarkStringifyMapKeysStringsOnlyStringMaps-4        5.23          5.18          -0.96%
BenchmarkStringifyMapKeysIntegers-4                     2320          5177          +123.15%

benchmark                                               old allocs     new allocs     delta
BenchmarkStringifyMapKeysStringsOnlyInterfaceMaps-4     6              6              +0.00%
BenchmarkStringifyMapKeysStringsOnlyStringMaps-4        0              0              +0.00%
BenchmarkStringifyMapKeysIntegers-4                     6              14             +133.33%

benchmark                                               old bytes     new bytes     delta
BenchmarkStringifyMapKeysStringsOnlyInterfaceMaps-4     1008          1008          +0.00%
BenchmarkStringifyMapKeysStringsOnlyStringMaps-4        0             0             +0.00%
BenchmarkStringifyMapKeysIntegers-4                     1008          1776          +76.19%
```
Closes #4393
2018-02-12 19:16:12 +01:00
Bjørn Erik Pedersen 10a917dfdc
parser: Tune stringifyMapKeys
```bash
benchmark                                               old ns/op     new ns/op     delta
BenchmarkStringifyMapKeysStringsOnlyInterfaceMaps-4     3269          3053          -6.61%
BenchmarkStringifyMapKeysStringsOnlyStringMaps-4        4.79          5.23          +9.19%
BenchmarkStringifyMapKeysIntegers-4                     2707          2320          -14.30%

benchmark                                               old allocs     new allocs     delta
BenchmarkStringifyMapKeysStringsOnlyInterfaceMaps-4     16             6              -62.50%
BenchmarkStringifyMapKeysStringsOnlyStringMaps-4        0              0              +0.00%
BenchmarkStringifyMapKeysIntegers-4                     16             6              -62.50%

benchmark                                               old bytes     new bytes     delta
BenchmarkStringifyMapKeysStringsOnlyInterfaceMaps-4     1080          1008          -6.67%
BenchmarkStringifyMapKeysStringsOnlyStringMaps-4        0             0             +0.00%
BenchmarkStringifyMapKeysIntegers-4                     1080          1008          -6.67%
```
2018-02-12 19:14:02 +01:00
Bjørn Erik Pedersen d4beef0d2b
parser: Rename stringifyYAMLMapKeys to stringifyMapKeys 2018-02-12 18:17:25 +01:00
Bjørn Erik Pedersen 51213e0be1
parser: Add benchmarks for stringifyYAMLMapKeys
```bash
BenchmarkStringifyMapKeysStringsOnlyInterfaceMaps-4       500000              3269 ns/op            1080 B/op         16 allocs/op
BenchmarkStringifyMapKeysStringsOnlyStringMaps-4        300000000                4.79 ns/op            0 B/op          0 allocs/op
BenchmarkStringifyMapKeysIntegers-4                       500000              2707 ns/op            1080 B/op         16 allocs/op
```
2018-02-12 18:16:48 +01:00
Vas Sudanagunta 1fa2417777 Add support for YAML array data files
* Unmarshaled YAML arrays indistinguishable from JSON arrays.
* Fixes #3890
2018-02-12 17:14:40 +01:00
Vas Sudanagunta bb549a0d57 Account for array type data in data dir merge/override logic
* Fixes #4366

* Error message to console for unsupported data types
2018-02-12 17:14:40 +01:00
Vas Sudanagunta 82eefded13 hugolib: Refactor tests for JSON, YAML and TOML equivalency, add coverage
The same code now cycles through equivalent JSON, YAML and TOML data sets,
verifying output both proper and identical. Coverage increased by applying
previous tests for one format to the others.

More DRY. Added tests for numeric and bool value types.
2018-02-12 17:14:40 +01:00
Vas Sudanagunta e172834993 hugolib: Re-enable YAML data tests disabled in f554503f
Also gave basic tests for JSON, YAML and TOML identical inputs and expected outputs, a step toward JSON, YAML and TOML equivalency (see https://github.com/gohugoio/hugo/issues/4393#issuecomment-364437785).
2018-02-12 17:14:40 +01:00
Bjørn Erik Pedersen b5cb8866e9
Merge commit '9cc9bab46288d8d5f9fda7009c5f746258cec1b4' 2018-02-10 12:52:31 +01:00
Bjørn Erik Pedersen 9cc9bab462 Squashed 'docs/' changes from 2fc775dec..f97826a17
f97826a17 Merge commit '12ecbf4a1b05c2794281f47909c836b1a005bc19'
12ecbf4a1 Squashed 'themes/gohugoioTheme/' changes from ecad8247..fe71e360
aaa7ac214 Ignore .DS_Store files
0e023ca12 Remove comments in showcase front matter
f3ba5ac87 Hartwell Insurance showcase
47aefdbda Remove unnecessary duplicated words
612693b4f Some minor language fixes
a833ba15b Spelling
5972e70a9 Revert "showcase: Even smaller file"
3479b975e showcase: Even smaller file
2272e0b83 showcase: Reduce image size
718c3c3e5 Spelling
0b954eccb showcase: Pace copy-edits
baded8064 showcase: Pace
842c1cedf Add a Showcase copyright notice
c5963edaa Update installing
4fa0b0d73 Add link to showcase template
d0f303916 Add some showcase guide content
c809789b1 Add srcset to the showcase screenshots
49d875904 Start of a template
1153de221 Clean resouerces
69f00df4c Remove the showcases
653ad5bcd Add a simple byline
c5342b5e5 Regenerate image after rebase
b80669b34 Bump version in config.toml
cd5c79c67 Fix an issue where whitespace wrap caused scrollbars on some browsers
f00547e98 Add section to the title element
aa10defed Iterating on Showcase (#330)
76a0bfbc3 Add some dummy content to some of the showcase pages
66f68964d Standardize showcase metadata
627ffa6d4 Adjust showcase image size on front page
cbc3efece Redo some showcase images
054b54cb6 Use .RelPermalink and not .URL
82ba5f1c6 Add resources
d1415795b Move showcase items in list view to a template in the layout
f34620e90 Tweak details box for mobile
df6a0bf24 Include images that changed from the column shift
02036581f Improve showcase single layout
5f7730c89 Improve styling of showcase prev/next buttons
a2b2f7731 Remove extra div that was breaking mobile layout of the showcase
b172fe5f4 Add block class to to images on mobile so they behave as expected
a4ebfec86 Add a proper RSS feed to home page
0524479e0 Move showcase images to proper Resources
0544b57df Convert showcase pages to bundles
8febaab2b Add Showcase to Home page and internal pages
26d1f4542 Fix baseURL in Netlify deploy previews
046497616 Revert "Try to fix the Netlify preview baseURL setup"
80dce17ca Revert "Add some temporary baseURL debug"
8617e8692 Add some temporary baseURL debug
371e56bce Try to fix the Netlify preview baseURL setup
1b70b3f18 Add Netlify CMS to Frontends list
d6184e71d Fix menu for "What is Hugo" page
1ae83ad3e Fix mobile menu display so it shows on mid-size displays
f60e1f750 Edited slight typo, added "of"
56b906667 Fix typo
c5bea5cbd Release 0.36
00539094e releaser: Prepare repository for 0.37-DEV
b222cbdf2 releaser: Add release notes to /docs for release of 0.36
e59d1d766 releaser: Bump versions for release of 0.36
9620aa002 docs: Add documentation for smart cropping etc.
91c3801f1 Merge commit 'c305e44f5f081e4436195923a4593e396f07cd49'
8e71ff60b releaser: Prepare repository for 0.36-DEV

git-subtree-dir: docs
git-subtree-split: f97826a17209fe3e153b7f5bbf69c511e4e13203
2018-02-10 12:51:31 +01:00
Bjørn Erik Pedersen d382502d6d tpl/transform: Add template func for TOML/JSON/YAML docs examples conversion
Usage:

```html
{{ "title = \"Hello World\"" | transform.Remarshal "json" | safeHTML }}
```

Fixes #4389
2018-02-10 12:36:31 +01:00
Kaushal Modi 2e95ec6844 Add "target" and "rel" parameters to figure shortcode
Also:

- Remove unnecessary space from `figure` tag if no class is specified.
  - Update related tests.
- Add test cases for the changes made to the figure shortcode.
- Document the newly added target and rel parameters
- Add more detail to the documentation of all figure shortcode parameters.
2018-02-09 22:27:58 +01:00
Kaushal Modi 76d38d5e53 Use more canonical "twitter:image" property, not "twitter:image:src"
This change is made in the "twitter_cards" internal template.

References:

- https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary-card-with-large-image
- https://twittercommunity.com/t/twitter-image-src-or-twitter-image/16085/7
2018-02-09 20:27:09 +01:00
Bjørn Erik Pedersen f554503fef
hugolib: Temp. disable some YAML data tests
They fail.

We will have to think about this.

See #4393
2018-02-09 12:32:45 +01:00
Dawid Gaweł 16a5c74519 parser: Fix YAML maps key type
Recurse through result of yaml package parsing and change all
maps from map[interface{}]interface{} to map[string]interface{}
making them jsonable and sortable.

Fixes #2441, #4083
2018-02-09 10:27:17 +01:00
Bjørn Erik Pedersen 49b98975be
releaser: Update to Go 1.9.4 2018-02-08 19:25:02 +01:00
Bjørn Erik Pedersen 0de375a7e7
Bump Travis/Snapcraft to Go 1.9.4 2018-02-07 21:45:53 +01:00
hugoreleaser e02ee7d6ad releaser: Prepare repository for 0.37-DEV
[ci skip]
2018-02-05 15:24:52 +00:00
hugoreleaser 18e3657a2a releaser: Add release notes to /docs for release of 0.36
[ci skip]
2018-02-05 15:22:26 +00:00
hugoreleaser 4bc8727fc6 releaser: Bump versions for release of 0.36
[ci skip]
2018-02-05 15:22:26 +00:00
Bjørn Erik Pedersen a9a0190b13
Release 0.336 2018-02-05 16:16:46 +01:00
hugoreleaser 742deaa3d0 releaser: Add release notes draft for 0.36
Rename to *-ready.md to continue. [ci skip]
2018-02-05 14:56:39 +00:00
Bjørn Erik Pedersen 694c0fd763
docs: Add documentation for smart cropping etc. 2018-02-05 15:04:07 +01:00
Bjørn Erik Pedersen 15ff076572
Merge commit 'c305e44f5f081e4436195923a4593e396f07cd49' 2018-02-05 14:24:24 +01:00
Bjørn Erik Pedersen c305e44f5f Squashed 'docs/' changes from dce236ad1..2fc775dec
2fc775dec Fix allLanguages code
dc6bfbedb Fix header level
6d652458c Fixed typo in docs.
2da6518be Fix broken build in previous commit
eabe7a40b Move some release notes to bundles to test the resource setup
34f2a41f2 Add featured image to news articles
bba1104b8 Update index.md
62bb8d826 Bundless > bundles
afea67773 Release notes spelling
f66d13af2 Release Hugo 0.35
613c50cdd releaser: Add release notes to /docs for release of 0.35
c9f7fd637 releaser: Bump versions for release of 0.35
360296c34 docs: Regenerate CLI docs
0d688633f Merge commit '337d0c5f516ee085205e8abefdb7f87e6d33ca05'
8fc9e325b command: Remove undraft command
f8cc6d51f docs: Re-generate CLI docs
556ea887a releaser: Prepare repository for 0.35-DEV

git-subtree-dir: docs
git-subtree-split: 2fc775dece2c5a76aaa3855b6dd054fd74c8738d
2018-02-05 14:24:00 +01:00
Bjørn Erik Pedersen 722086b4ed
resource: Add smart cropping
This commit `smart` as a new and default anchor in `Fill`.

So:

```html
{{ $image.Fill "200x200" }}
```

Is, with default configuration, the same as:

```html
{{ $image.Fill "200x200" "smart" }}
```

You can change this default in your `config.toml`:

```toml
[imaging]
[imaging]
resampleFilter = "box"

quality = 68

anchor = "Smart"
```

Fixes #4375
2018-02-05 13:59:15 +01:00
Cameron Moore 084cf4191b tpl: Ensure site templates can override theme templates
The tplimpl package was misusing the TemplateLookupDescriptor.WorkingDir
field from the output package. By incorrectly setting it to the theme
directory instead of the site root, the user is unable to override theme
templates in some situations.

Fixes #3505
2018-02-05 08:38:04 +01:00
Cameron Moore fc06d5c18b hugolib: Add additional test to TestTemplateLookupOrder
Add an additional test to "Variant 4, theme, use site base" to also test
for the index.html base (from by testing of #3505).  Also add a "name"
field to the test cases to make it easier to know which test is failing
versus just getting a slice index.
2018-02-05 08:38:04 +01:00