Commit graph

721 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
34f40044d7 Fix shortcode in markdown headers
This issue was introduced as a fix to shortcode not working in RST.

One could argue that Blackfriday and friends should handle `#` in titles, but that will be a discussion
for another day.

The new placeholder pattern should be RST safe and work with titles.

And now with a test so this doesn't break again.

Fixes #2192
Fixes #2209
Closes #2210
2016-06-15 09:12:07 +02:00
Bjørn Erik Pedersen
8588103316 Unexport ShouldBuild and AssertShouldBuild 2016-06-14 15:53:49 +02:00
Hanchen Wang
eeaafb4b26 hugolib: futureStats plural 2016-06-14 15:45:27 +02:00
Hanchen Wang
fb0c1350d4 hugolib: Handle unpecified date for IsFuture and IsExpired 2016-06-14 15:45:26 +02:00
Hanchen Wang
673e41bf6a hugolib: Add expiredStats to build feedback 2016-06-14 15:45:26 +02:00
Hanchen Wang
32c0e3fd1f hugolib: Bug fix futureStats 2016-06-14 15:45:26 +02:00
Hanchen Wang
4724a5794e hugolib: Refactor page.ShouldBuild and table driven test 2016-06-14 15:45:26 +02:00
Hanchen Wang
c1c8ecc9d6 hugolib: Add GroupByExpireDate function 2016-06-14 15:45:26 +02:00
Hanchen Wang
091915c75d hugolib: Add sort ByExpiryDate function 2016-06-14 15:45:25 +02:00
Hanchen Wang
6472f158a4 hugelib: Add expiredCount as a Site variable 2016-06-14 15:45:25 +02:00
Hanchen Wang
d4156e6127 hugolib: Support an expiration date 2016-06-14 15:45:25 +02:00
Sam Broughton
75deb923d9 Remove unneeded casts in page.getParam
Closes #2186
2016-06-09 15:40:06 +02:00
Bjørn Erik Pedersen
a7f51703c4 Add Hugo generator tag to home page if not present
Fixes #2182
2016-06-04 21:55:56 -04:00
Steve Francia
f94cd2813d Handle errors during rereading properly
Without this fix, any error during rereading would cause Hugo to hang.
Fixes #2168
Closes #2179
2016-06-02 23:47:30 +02:00
Bjørn Erik Pedersen
608cfe62cf Remove kr/pretty dependency
Fixes #2124
See https://github.com/kr/text/issues/6
2016-05-08 13:16:16 +02:00
Bjørn Erik Pedersen
10af906371 Add ByLastmod page sort 2016-04-22 20:43:18 +02:00
Sven Dowideit
22683a3b66 Make alias redirect output URL's relative
Closes #2093
2016-04-22 08:14:19 +02:00
Anthony Fok
9ddf52021b Update import path of fsnotify
Rename "gopkg.in/fsnotify.v1" to "github.com/fsnotify/fsnotify"
per upstream recommendation.

See https://github.com/fsnotify/fsnotify/issues/108 for rationale.
2016-04-20 22:28:26 +08:00
Bjørn Erik Pedersen
77159b4b9b Add some schemaless BaseURL tests
See #2085
2016-04-17 20:01:21 +02:00
Mattias Wadman
5d50c46482 Chomp Unicode BOM if present
Useful if using or sharing files with users that use editors that
append a unicode byte order marker header (like Windows notepad).

This will still assume files are UTF-8 encoded.

Closes #2075
2016-04-14 10:46:27 +02:00
Bjørn Erik Pedersen
206440eef2 Fix broken tests 2016-04-12 19:18:02 +02:00
Bjørn Erik Pedersen
c3d28d2897 Revert "Add Node.ID"
This reverts commit 5ef52294f9.
2016-04-12 18:11:52 +02:00
Bjørn Erik Pedersen
39c9ae3108 Revert "Use Node.ID for anchor ID"
This reverts commit cd558958a0.
2016-04-12 18:11:24 +02:00
Bjørn Erik Pedersen
cd558958a0 Use Node.ID for anchor ID
Fixes #2057
2016-04-11 13:17:25 +02:00
Bjørn Erik Pedersen
5ef52294f9 Add Node.ID
Fixes #2071
2016-04-11 11:49:02 +02:00
Bjørn Erik Pedersen
c0cf1a7e37 Fix section menus for lazy blogger
IsMenuCurrent was always returning false for the top level entries.

Fixes #2065
2016-04-10 13:49:32 +02:00
digitalcraftsman
b7efbdc12f hugolib: Add option to disable rendering of 404 page
Fixes #1889
Closes #2037
2016-04-09 20:25:59 +02:00
nitoyon
72bda5ad26 Move section initialization to Site.assembleSections
Closes #1527
2016-04-09 20:13:35 +02:00
Bjørn Erik Pedersen
8fe48a6576 Fix potential data race in test 2016-04-09 14:30:22 +02:00
ypnos
9f6b5ad3b4 Save auto-detected markup type in Page.Markup
If Page.Markup was not set by the user, it will now be set after
guessing from the file extension. This means, Page.Markup will be set in
any case. It can be used by a theme to differentiate between markup
types.

Fixes #1950
2016-04-09 00:48:53 +02:00
Bjørn Erik Pedersen
f2ff77f3ac Make Hugo build without Mercurial
By creating a fork of the Bitbucket inflect repo. It hasn't changed since 2013,
so it must be considered pretty stable.

Fixes #2062
2016-04-08 21:11:44 +02:00
Bjørn Erik Pedersen
1c3c148b38 hugolib: Un-export internal Site-methods
These are obviously internal and for the most part undocumented, creating lots of GoLint warnings.

See #1160
See #2014
2016-04-08 17:55:23 +02:00
Sven Dowideit
1648e327c0 Document and clean SourceRelativeLinksEval code 2016-04-07 20:10:38 +02:00
Bjørn Erik Pedersen
819271cb78 Re-export the methods used in page group tests 2016-04-07 18:44:58 +02:00
Bjørn Erik Pedersen
3950b1375c hugolib: Camelcase ALL_CAPS vars and const in tests
See #2014
2016-04-07 16:10:41 +02:00
Bjørn Erik Pedersen
05b888877d huglib: Add even more missing GoDoc
See #2014
2016-04-07 16:05:23 +02:00
Bjørn Erik Pedersen
ddd02b2f6a hugolib: Camel-case ALL_CAPS const in test 2016-04-07 15:22:41 +02:00
Bjørn Erik Pedersen
98ee8c3f7b hugolib: Add GoDoc to pageGroup.go
See #2014
2016-04-07 15:21:41 +02:00
Bjørn Erik Pedersen
54750b0780 Do not create robots.txt by default
Meny people, including me, have a custom robots.txt in static.

Also remove that option from the command line; it doesn't feel
important enough.

Fixes ##2049
2016-04-05 22:20:39 +02:00
Robert Basic
7d5c9fbf44 Make ByCount sort consistently
When two or more taxonomies have the same number of pages,
sort them by name to have consistent ByCount sorting of
taxonomies.

Fixes #1930
2016-04-02 22:59:10 +02:00
Bjørn Erik Pedersen
b678e90db7 Use to most specific interface in WriteDestPage 2016-04-02 00:04:08 +02:00
Bjørn Erik Pedersen
4f66f790b1 Add readFile template func
This also includes a refactor of the hugofs package and its usage.

The motivation for that is:

The Afero filesystems are brilliant. Hugo's way of adding a dozen of global variables for the different filesystems was a mistake. In readFile (and also in some other places in Hugo today) we need a way to restrict the access inside the working dir. We could use ioutil.ReadFile and implement the path checking, checking the base path and the dots ("..") etc. But it is obviously better to use an Afero BasePathFs combined witha ReadOnlyFs. We could create a use-once-filesystem and handle the initialization ourselves, but since this is also useful to others and the initialization depends on some other global state (which would mean to create a new file system on every invocation), we might as well do it properly and encapsulate the predefined set of filesystems. This change also leads the way, if needed, to encapsulate the file systems in a struct, making it possible to have several file system sets in action at once (parallel multilanguage site building? With Moore's law and all...)

Fixes #1551
2016-03-31 21:24:18 +02:00
Bjørn Erik Pedersen
8aec5ee2dd hugolib: Some more unexports 2016-03-25 03:12:31 +01:00
Bjørn Erik Pedersen
6dbae7b671 Be explicit about the type in Scratch test
A puzzle, but it sometimes produces a int64 as it is now.
2016-03-24 19:57:26 +01:00
Bjørn Erik Pedersen
d770130530 hugolib: Remove unused Tmpl on Page 2016-03-24 18:34:41 +01:00
Bjørn Erik Pedersen
c846b051f3 Do not use defer for unlocking in Scratch
It is a fairly costly operation:

```
benchmark                 old ns/op     new ns/op     delta
BenchmarkScratchGet-4     109           31.6          -71.01%

benchmark                 old allocs     new allocs     delta
BenchmarkScratchGet-4     0              0              +0.00%

benchmark                 old bytes     new bytes     delta
BenchmarkScratchGet-4     0             0             +0.00%
´´´
2016-03-24 16:03:31 +01:00
Bjørn Erik Pedersen
fa1a9653e5 hugolib: Taxonomy GoDoc cleanup 2016-03-24 16:01:25 +01:00
Bjørn Erik Pedersen
b5bced1db4 Add a simple benchmark for Scratch 2016-03-24 15:05:40 +01:00
Bjørn Erik Pedersen
7c84e6b3e3 hugolib: Even more Golint fixes 2016-03-24 14:42:03 +01:00
Bjørn Erik Pedersen
3bbfd99176 hugolib: Apply Golint rules to rss_test.go 2016-03-24 14:20:00 +01:00