Commit graph

13 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
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 973393c99e Create template clone for late template execution
Fixing some breaking blogs on Go 1.6

Fixes #1879
2016-03-09 14:37:58 +01:00
Anthony Fok 8509727fe8 Add copyright header to that source files that don’t have one.
See #1646
2015-12-10 15:19:38 -07:00
spf13 a584ff207b Stop Viper from leaking across many of the tests (now tests pass regardless of order tested) 2015-05-20 02:21:21 -04:00
bep beb4ab162d Make RSS output test more realistic
By setting a non-default RSS uri config value.
2015-05-08 20:33:37 +02:00
Dana H. P'Simer fd08e16ec8 Add RSSUri to specify the name of the RSS file 2015-05-07 22:20:00 +02:00
Kartik Singhal 596d679386 Various fixes in RSS feed generation
- Prevent `.xml` generation for root section
- Remove redundant check for DisableRSS
- Fix permalinks for rel="alternate"
- Rename generated xml file to <type>/index.xml
- Add required description element in default template
- Make default RSS template validate on w3c (timezone format is still an issue)

Conflicts:
	hugolib/site.go
2014-11-17 18:55:40 -05:00
spf13 4dcf734acd Updating tests to use new Targets & Writers and switch to using Afero.MemMapFs for more accurate tests. 2014-11-04 00:41:47 -05:00
spf13 9a83f7a01b Fixing all tests to pass with new Viper Config 2014-04-07 11:44:51 -04:00
Mike Keesey 2540d884d8 Fixing issues go vet reports. 2014-03-01 09:56:17 -05:00
Caleb Spare 6da23f7449 Gofmt
Command: `gofmt -l -s -w .`
2013-12-16 17:40:10 -05:00
Noah Campbell 1cebce12ad Adding RSS test case.
Checks to make sure the xml document starts with <?xml.  Previously, the
html translate package would write additional details into the document
that caused it to fail.
2013-11-05 07:03:02 +00:00