Commit graph

3846 commits

Author SHA1 Message Date
Bjørn Erik Pedersen 02f2735f68
tpl/strings: Fix broken test 2017-12-17 18:06:55 +01:00
Victor Kropp 22cd89adc4 Make chomp return the type it receives
fixes #2187
2017-12-16 23:59:36 +01:00
Bjørn Erik Pedersen db4b7a5c67 Reuse the BlackFriday instance when possible
This is in heavy use in rendering, so this makes a difference:

```bash
benchmark                                                                                    old ns/op     new ns/op     delta
BenchmarkSiteBuilding/TOML,num_langs=1,num_pages=500,tags_per_page=5,shortcodes,render-4     124551144     107743429     -13.49%

benchmark                                                                                    old allocs     new allocs     delta
BenchmarkSiteBuilding/TOML,num_langs=1,num_pages=500,tags_per_page=5,shortcodes,render-4     528684         435118         -17.70%

benchmark                                                                                    old bytes     new bytes     delta
BenchmarkSiteBuilding/TOML,num_langs=1,num_pages=500,tags_per_page=5,shortcodes,render-4     53306848      45147832      -15.31%
```
2017-12-16 19:44:33 +01:00
Ivan Vyshnevskyi 2511498608 livereload: Fix host comparison when ports aren't present
Compare the original hosts from 'Origin' and 'Host' headers before
attempting to do a port-less comparison.  This helps in the case when
hugo server was started with a '--port=80' so both headers do not
contain a port.

Fixes #4141
2017-12-16 19:06:00 +01:00
Richard Metzler 9df3736fec Add .Title and .Page to MenuEntry
It uses `title` if configured on the menu entry. If not, it uses the `Page.Title` when possible.

Fixes #2784
2017-12-15 18:49:21 +01:00
Bjørn Erik Pedersen 243694102a Remove the goroutines from the shortcode lexer
It was clever, but storing the items in a slice is faster -- and it gives room to more goroutines in other places.

```bash
benchmark                     old ns/op     new ns/op     delta
BenchmarkShortcodeLexer-4     180173        79614         -55.81%

benchmark                     old allocs     new allocs     delta
BenchmarkShortcodeLexer-4     309            328            +6.15%

benchmark                     old bytes     new bytes     delta
BenchmarkShortcodeLexer-4     35456         47008         +32.58%
```
2017-12-07 23:08:25 +01:00
Bjørn Erik Pedersen 3153526161
mage: Do not run Go Fmt check on Go tip 2017-12-07 22:38:54 +01:00
Bjørn Erik Pedersen fdbef2a81c
Adjust the stale setup 2017-12-06 14:03:04 +01:00
Bjørn Erik Pedersen 426ac9c18e
Add Github stale bot config 2017-12-06 10:03:25 +01:00
Bjørn Erik Pedersen 84805a68ca
Use StopTimer in site benchmarks 2017-12-05 16:17:11 +01:00
Bjørn Erik Pedersen a2d81ce983
Add output formats definition to benchmarks 2017-12-02 12:05:12 +01:00
Bjørn Erik Pedersen 051fa343d0
Improve site benchmarks 2017-12-02 11:44:36 +01:00
Christian Nolte 23f69efb39 Fix context of opengraph video range
Fixes #4136
2017-12-01 20:59:11 +01:00
Brian Chen e69da7a4cb Add Pandoc support, refactor external helpers
Recognize the Pandoc format under the file extension .pandoc or .pdc,
and shell out to pandoc as an external helper to format Pandoc content.

Refactor out repeated code with external helpers. Change the error
output formatting. I did not see any of the external helpers print the
string "<input>" to represent stdin as a file; just prepending the file
name to error output is more general and doesn't sacrifice that much in
terms of readability.

Closes #234
2017-11-30 12:15:52 +01:00
Bjørn Erik Pedersen e7652180a1
vendor: Fix Humanize for multi-byte runes
Fixes #4133
2017-11-28 21:16:01 +01:00
Bjørn Erik Pedersen 7989210120
vendor: Update Chroma to v0.2.0
Closes #4087
2017-11-27 17:16:42 +01:00
Chase Adams 7f2ae3ef39 vendor: update goorgeous@v1.1.0 2017-11-27 17:12:22 +01:00
hugoreleaser 8a8ba63c7e releaser: Prepare repository for 0.32-DEV
[ci skip]
2017-11-27 11:27:33 +00:00
hugoreleaser c1c04d74a0 releaser: Add release notes to /docs for release of 0.31.1
[ci skip]
2017-11-27 11:26:08 +00:00
hugoreleaser aa68205d16 releaser: Bump versions for release of 0.31.1
[ci skip]
2017-11-27 11:26:08 +00:00
Bjørn Erik Pedersen 94115888e3
Release 0.31.1 2017-11-27 12:18:44 +01:00
hugoreleaser bf8aa4ac5a releaser: Add release notes draft for 0.31.1
Rename to *-ready.md to continue. [ci skip]
2017-11-27 10:33:13 +00:00
Bjørn Erik Pedersen 6d79beb5f6
tpl/images: Close image file 2017-11-25 18:38:33 +01:00
Bjørn Erik Pedersen 8afd7d9ceb commands: Fix broken --appendPort=false
Also make sure to log the correct server URL to the console.

Fixes #4111
2017-11-24 11:29:01 +01:00
hugoreleaser 42fbf15fb7 releaser: Prepare repository for 0.32-DEV
[ci skip]
2017-11-20 10:30:09 +00:00
hugoreleaser 288723a049 releaser: Add release notes to /docs for release of 0.31
[ci skip]
2017-11-20 10:28:21 +00:00
hugoreleaser f4b416bbef releaser: Bump versions for release of 0.31
[ci skip]
2017-11-20 10:28:21 +00:00
Bjørn Erik Pedersen 058f25146c
Release 0.31 2017-11-20 11:24:19 +01:00
hugoreleaser 3dd7e8b7a7
releaser: Add release notes draft for 0.31
Rename to *-ready.md to continue. [ci skip]
2017-11-20 11:22:36 +01:00
Bjørn Erik Pedersen 14786c4d8f
Merge commit '30c0d485eaff6d70df1be0353911ddca485d52bf' 2017-11-20 11:19:16 +01:00
Bjørn Erik Pedersen 30c0d485ea Squashed 'docs/' changes from a042b67b5..3e663efb2
3e663efb2 Add poster for Hugo 0.31 release
b3c98ba65 Add doc about the new static dir support
2e62e4bdf Update multilingual docs for Hugo 0.31
8eff394b3 commands: Regenerate

git-subtree-dir: docs
git-subtree-split: 3e663efb2b149e243b6ecfdc439a2a2be573987f
2017-11-20 11:19:16 +01:00
Bjørn Erik Pedersen 089fe49309 hugolib: Make sure everything ends up in its lang root in multihost mode
Fixes #4105
2017-11-20 11:17:46 +01:00
Bjørn Erik Pedersen 118b83d74b
helpers: Properly handle []interface{} as staticDir
And now with a proper integration test ...
2017-11-19 15:44:20 +01:00
Bjørn Erik Pedersen adbd5bc47f
source: Enable disabled test 2017-11-19 14:35:49 +01:00
Bjørn Erik Pedersen c1d325934e helpers: Remove (now) unused GetStaticDir
* In Hugo there is no single static dir
* It was used as a filter in the content dir, which makes no sense since any overlap here is impossible
2017-11-19 14:03:21 +01:00
Bjørn Erik Pedersen d99db71ab5
livereload: Fix recently broken window.location.reload logic
Closes #4100
2017-11-18 10:54:07 +01:00
Bjørn Erik Pedersen 503ca6de6c Fix broken shortcodes for Ace and Amber
Fixes #4051
2017-11-18 10:41:31 +01:00
Bjørn Erik Pedersen b3daa1f4bf hugolib: Fix .IsTranslated with identical filenames
This commit refines the key used to map translations:

* Use `translationKey` set in front matter
* Fall back to path + base filename (i.e. the filename without extension and language code)

Note that the Page Kinde will be prepended to both cases above. It does not make sense to have a section as translation for the home page.

Fixes #2699
2017-11-17 19:46:32 +01:00
Bjørn Erik Pedersen df1677a6e8
Merge commit '05e42bc643f1840ed2ad9c2eff82a269d1381683' 2017-11-17 13:48:33 +01:00
Bjørn Erik Pedersen 05e42bc643 Squashed 'docs/' changes from e65df1059..a042b67b5
a042b67b5 Update installation instructions for Fedora, CentOS, Red Hat
e99dcb0b5 Document `:sections` placeholder for permalinks
f33c88a27 Fix and clarify documentation about Blackfriday extensions (mask)
5cab109c2 Add .Page.File documentation
62df7bb80 Add .Page.CurrentSection and .Page.Sections documentation
60b4414de Add .Page.Dir documentation
22038d1a8 shortcode-templates.md: Update year example
850d5ca41 Add note about theme versions in hosting-on-netlify.md
0509b8055 Update permalink example URL
c68d61d3a Mention the available 'width' argument in 'figure' shortcode
ed83b483a Update Nanobox deployment tutorial
a7422f35d shortcode-templates.md: Remove stray period
af2905fe4 Fix order of releases in news section
19d3ea064 Bump to 0.30.2
bbfa10343 Merge branch 'next'
36ed7cbe4 releaser: Prepare repository for 0.31-DEV
f689770f6 releaser: Add release notes to /docs for release of 0.30.2
0045e712a releaser: Bump versions for release of 0.30.2
a9efc3bbd Add slug to 0.30.1 relnotes
9cf47a4a1 Release 0.30.1
1fa0bb23d releaser: Prepare repository for 0.31-DEV
5582208b6 releaser: Add release notes to /docs for release of 0.30.1
09693d155 releaser: Bump versions for release of 0.30.1
58adf5d0d Merge commit '325009c3fd4ac90021897b7e3e025c14e70ce162'
4ef5dcb9b releaser: Prepare repository for 0.31-DEV
02938a788 releaser: Add release notes to /docs for release of 0.30.1
7cfd01fc6 releaser: Bump versions for release of 0.30.1
db3a68e24 Fix typo
95a5d8b46 Fix format of summaryLength in TOML example config
2ad649a92 Make terms in taxonomy examples more coherent
1fac1e662 Make a link specifically point to Pygments HTML Formatter docs
11ae6be03 Fix minor typos in v0.30 release notes

git-subtree-dir: docs
git-subtree-split: a042b67b5b8834ee8292849708cba724f5d6644e
2017-11-17 13:46:40 +01:00
Bjørn Erik Pedersen 0a81a6b4ba output: Fall back to unstranslated base template
Fixes #3893
2017-11-17 13:08:18 +01:00
Bjørn Erik Pedersen 60dfb9a6e0 Add support for multiple staticDirs
This commit adds support for multiple statDirs both on the global and language level.

A simple `config.toml` example:

```bash
staticDir = ["static1", "static2"]
[languages]
[languages.no]
staticDir = ["staticDir_override", "static_no"]
baseURL = "https://example.no"
languageName = "Norsk"
weight = 1
title = "På norsk"

[languages.en]
staticDir2 = "static_en"
baseURL = "https://example.com"
languageName = "English"
weight = 2
title = "In English"
```

In the above, with no theme used:

the English site will get its static files as a union of "static1", "static2" and "static_en". On file duplicates, the right-most version will win.
the Norwegian site will get its static files as a union of "staticDir_override" and "static_no".

This commit also concludes the Multihost support in #4027.

Fixes #36
Closes #4027
2017-11-17 11:01:46 +01:00
Bjørn Erik Pedersen 2e0465764b Add multilingual multihost support
This commit adds multihost support when more than one language is configured and `baseURL` is set per language.

Updates #4027
2017-11-17 11:01:46 +01:00
Bjørn Erik Pedersen 6233ddf9d1
tpl/partials: Fix the lock contention in cached partial
Fixes #4086
2017-11-16 11:59:45 +01:00
Bjørn Erik Pedersen e66d813bcb
gopkg: Update Chroma to get SVG support 2017-11-16 08:30:51 +01:00
Bjørn Erik Pedersen f5ed04bd4a
tpl/partials: Fix cache locking
To make sure a cached partial is ony executed  exactly once.

Performance same:

```bash
name                         old time/op    new time/op    delta
TemplateParamsKeysToLower-4    17.2µs ± 0%    16.5µs ± 0%   ~     (p=1.000 n=1+1)
Partial-4                      18.6µs ± 0%    19.4µs ± 0%   ~     (p=1.000 n=1+1)
PartialCached-4                64.2ns ± 0%    63.7ns ± 0%   ~     (p=1.000 n=1+1)

name                         old alloc/op   new alloc/op   delta
TemplateParamsKeysToLower-4    2.66kB ± 0%    2.66kB ± 0%   ~     (all equal)
Partial-4                      1.31kB ± 0%    1.31kB ± 0%   ~     (all equal)
PartialCached-4                 0.00B          0.00B        ~     (all equal)

name                         old allocs/op  new allocs/op  delta
TemplateParamsKeysToLower-4      92.0 ± 0%      92.0 ± 0%   ~     (all equal)
Partial-4                        41.0 ± 0%      41.0 ± 0%   ~     (all equal)
```
2017-11-16 01:23:37 +01:00
Bjørn Erik Pedersen 7730d683e8
tplimpl: Make partial benchmarks use RunParallel
See #4086
2017-11-16 01:13:07 +01:00
Bjørn Erik Pedersen bb048d811d
Use ms precision for static change logging 2017-11-15 08:52:29 +01:00
Bjørn Erik Pedersen 9299a16c99
circleci: Bump to Go 1.9.2
Closes #4064
2017-11-11 09:46:35 +01:00
Bjørn Erik Pedersen a9be687b81
hugolib: Pre-allocate some slices 2017-11-11 09:39:43 +01:00