Commit graph

2148 commits

Author SHA1 Message Date
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
digitalcraftsman a89035bdaa docs: Mention CLA in the showcase contribution guidelines 2016-03-30 18:01:50 +02:00
Rob Muhlestein 6a3a6f683d docs: Remove incorrent reference to list.html 2016-03-30 17:54:31 +02:00
digitalcraftsman 93e41a1fb2 docs: Fix typo in templates/functions.md 2016-03-28 17:04:29 +02:00
Rob Muhlestein d65fbfe16c docs: Add surge.sh to main page of static site hosters
See #1994
2016-03-28 16:44:13 +02:00
Robert Basic effaf6c2c9 docs: Document GitHub flavoured code fences
Fixes #1259
2016-03-28 16:38:28 +02:00
Robert Basic e35a69216e docs: Document lastmod variable
Fixes #1351
2016-03-28 16:33:50 +02:00
Robert Basic 50506ebeac docs: Document the split function
Fixes #1997
2016-03-28 15:58:41 +02:00
Scopel Emanuele 4c95b70020 docs: Add silvergeko.it to the showcase 2016-03-28 14:48:01 +02:00
Robert Basic 79af7143c9 docs: Add robertbasic.com to the showcase 2016-03-27 19:52:07 +02:00
Bjørn Erik Pedersen dbfc7ea024 Fix error handling in SymbolicWalk 2016-03-25 18:18:39 +01:00
Bjørn Erik Pedersen bfe8009415 helpers: Fix SymbolicWalk for the root folder
handle the root folders themselves.

This commit fixes that.

Fixes #2018
2016-03-25 12:49:23 +01:00
digitalcraftsman 977b0e342c docs: Adapt commit message for showcase additions 2016-03-25 12:32:46 +01:00
digitalcraftsman 8890885a70 docs: Add search form powered by Algolia 2016-03-25 11:22:01 +01:00
Bjørn Erik Pedersen 8aec5ee2dd hugolib: Some more unexports 2016-03-25 03:12:31 +01:00
digitalcraftsman 7c81c86bdd commands: Apply Golint rules 2016-03-24 23:34:12 +01:00
digitalcraftsman 5d3705df16 helpers: Apply GoLint rules 2016-03-24 23:16:18 +01:00
digitalcraftsman 7fa2cec906 tpl: Small Golint fixes 2016-03-24 22:56:50 +01:00
Bjørn Erik Pedersen b71f391cd7 parser: Remove unused vars 2016-03-24 21:34:34 +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 3e77886aad helpers: Fix GoDoc in Hugo version constants 2016-03-24 14:27:36 +01:00
Bjørn Erik Pedersen a7953e25bb commands: Apply Golint rules to hugo.go 2016-03-24 14:24:22 +01:00
Bjørn Erik Pedersen 3bbfd99176 hugolib: Apply Golint rules to rss_test.go 2016-03-24 14:20:00 +01:00
Bjørn Erik Pedersen b8bf01cdc6 hugolib: Add missing GoDoc in pagination.go 2016-03-24 14:18:47 +01:00
Bjørn Erik Pedersen c2c73c2bd2 hugolib: Some more GoLint fixes 2016-03-24 14:11:04 +01:00
Bjørn Erik Pedersen 218fceac35 livereload: Add missing GoDoc 2016-03-24 14:05:08 +01:00
Bjørn Erik Pedersen e467d23374 hugoblib: Clean up the time tests 2016-03-24 13:30:08 +01:00
Bjørn Erik Pedersen 944090722e transform: Group vars and consts in chain_test 2016-03-23 21:55:14 +01:00
Bjørn Erik Pedersen c7869fd772 transform: Clean up the var naming mess in chain_test 2016-03-23 20:03:13 +01:00
Bjørn Erik Pedersen a6de8dfb42 hugolib: Some more Golint fixes 2016-03-23 17:17:54 +01:00
Bjørn Erik Pedersen dac34f9bfd hugolib: Fix spelling mistake 2016-03-23 17:12:47 +01:00
Bjørn Erik Pedersen c31fa378c7 hugolib: Add Godoc to pageSort 2016-03-23 17:11:29 +01:00
Bjørn Erik Pedersen c20dee9d7f parser: Make the constant vars ... constants 2016-03-23 15:05:32 +01:00
Bjørn Erik Pedersen bf76e74432 parser: Fix ALL_CAPS var names in test 2016-03-23 15:02:00 +01:00
Bjørn Erik Pedersen 1cb7ed6ac7 parser: Spring code cleaning 2016-03-23 14:51:16 +01:00
Bjørn Erik Pedersen 937592cb85 hugolib: Fix some more Golint warnings 2016-03-23 10:10:28 +01:00
Bjørn Erik Pedersen 8a60571fd2 helpers: Fix and add Godoc in path* 2016-03-23 10:03:29 +01:00
Bjørn Erik Pedersen 6ff2e1dbe7 helpers: Remove the else in MakePathSanitized 2016-03-23 09:45:18 +01:00
Bjørn Erik Pedersen faf2e50685 Do some minor code cleaning of Site
* Unexport some methods/fields
* Add some godoc

Still plenty to do here.
2016-03-23 09:43:04 +01:00
Bjørn Erik Pedersen 626874b94c transform: Golint fixes 2016-03-23 09:35:50 +01:00
Bjørn Erik Pedersen 672890339e target: Fix some Golint warnings 2016-03-23 00:44:51 +01:00
Bjørn Erik Pedersen dc7d8a9eac Spring cleaning of the menu code 2016-03-23 00:29:39 +01:00
Bjørn Erik Pedersen 4f00f1c94f heloers: Add a linefeed to make Golint happy 2016-03-23 00:07:44 +01:00
Bjørn Erik Pedersen 9cf93e11f8 commands: Fix remaining Golint warning 2016-03-23 00:06:10 +01:00
Bjørn Erik Pedersen da4d4164f1 utils: Add godoc 2016-03-23 00:04:28 +01:00