summaryrefslogtreecommitdiffstats
path: root/source
AgeCommit message (Collapse)Author
2017-09-29Clean up lint in various packagesCameron Moore
Changes fall into one of the following: - gofmt -s - receiver name is inconsistent - omit unused 2nd value from range - godoc comment formed incorrectly - err assigned and not used - if block ends with a return statement followed by else
2017-08-09source: Normalize UniqueID between Windows & LinuxMatthieu Harlé
2017-08-03Add some missing doc commentsJorin Vogel
As pointed out by the linter, some exported functions and types are missing doc comments. The linter warnings have been reduced from 194 to 116. Not all missing comments have been added in this commit though.
2017-06-13Run gofmt to get imports in line vs gohugoio/hugoBjørn Erik Pedersen
2017-06-13all: Update import paths to gohugoio/hugoBjørn Erik Pedersen
2017-06-07Revert "hugolib: Fix live-reload regression for add/removal of dirs"Bjørn Erik Pedersen
Never mind. The "adding dir" scenario didn't work anyway, so that will need another fix. This reverts commit 49a104309d53af243b32443a59bdc2a6fc9beeef. Closes ##3325
2017-06-07hugolib: Fix live-reload regression for add/removal of dirsBjørn Erik Pedersen
This reverts commit b5b6e81c0269abf9b0f4bc6a127744a25344e5c6. That change breaks watching of new directories (new dirs, deleted dirs). Reopens #3325 Fixes #3569
2017-05-30source: Cache language configBjørn Erik Pedersen
``` benchmark old ns/op new ns/op delta BenchmarkSiteBuilding/frontmatter=YAML|num_root_sections=1|num_pages=5000|tags_per_page=0|shortcodes=false|render=false-4 552742744 501838152 -9.21% benchmark old allocs new allocs delta BenchmarkSiteBuilding/frontmatter=YAML|num_root_sections=1|num_pages=5000|tags_per_page=0|shortcodes=false|render=false-4 3047393 2957378 -2.95% benchmark old bytes new bytes delta BenchmarkSiteBuilding/frontmatter=YAML|num_root_sections=1|num_pages=5000|tags_per_page=0|shortcodes=false|render=false-4 356533864 354291924 -0.63% ```
2017-04-22hugolib: Ignore non-source files on partial rebuildxofyarg
Partial rebuild does not have the same logic as normal rebuild on selecting which file to build. This change makes it possible to share the file select logic between two kinds of build. Fix #3325.
2017-02-17all: Refactor to nonglobal Viper, i18n etc.Bjørn Erik Pedersen
This is a final rewrite that removes all the global state in Hugo, which also enables the use if `t.Parallel` in tests. Updates #2701 Fixes #3016
2017-02-04all: Refactor to nonglobal file systemsBjørn Erik Pedersen
Updates #2701 Fixes #2951
2016-12-31docs, tpl: Fix documentation of UniqueIDdigitalcraftsman
See #2861
2016-12-31source: Make UniqueID ... uniqueBjørn Erik Pedersen
Fixes #2861
2016-11-23hugolib, source, tpl: Fix docsbogem
See #2014
2016-11-23helpers: Rename WalkRootTooShortError to ErrWalkRootTooShortbogem
Fix golint warning: helpers/path.go:473:5: error var WalkRootTooShortError should have name of the form ErrFoo See #2014
2016-11-22commands, hugolib, source, target, tpl: Get rid of some fmt statementsbogem
2016-11-15source, tpl: Fix staticcheck complaintsAlbert Nigmatzianov
tpl/template_funcs.go:1019:3: the surrounding loop is unconditionally terminated source/lazy_file_reader.go:66:5: err != nil is always true for all possible values ([nil:error] != [nil:error])
2016-11-01Fix page names that contain dotPrashant Karmakar
changes: - in hugolib/page.go, `func permalink` and `func TargetPath` Fixed the attempt to *replace* the extension of something that was *already* a basename. - in source/file.go, `func NewFile` added check for allowed languages before translating filename Fixes #2555
2016-10-28Make it clear that Path is relative to content rootBjørn Erik Pedersen
Fixes #2290
2016-10-24all: Unify case of config variable namesAlbert Nigmatzianov
All config variables starts with low-case and uses camelCase. If there is abbreviation at the beginning of the name, the whole abbreviation will be written in low-case. If there is abbreviation at the end of the name, the whole abbreviation will be written in upper-case. For example, rssURI.
2016-09-11Replace some leftover os.Stat with hugofs.SourceBjørn Erik Pedersen
2016-09-06Multilingual TODO-fixes, take 1Bjørn Erik Pedersen
See #2309
2016-09-06Optimize the multilanguage build processBjørn Erik Pedersen
Work In Progress! This commit makes a rework of the build and rebuild process to better suit a multi-site setup. This also includes a complete overhaul of the site tests. Previous these were a messy mix that were testing just small parts of the build chain, some of it testing code-paths not even used in "real life". Now all tests that depends on a built site follows the same and real production code path. See #2309 Closes #2211 Closes #477 Closes #1744
2016-09-06Add multilingual support in HugoAlexandre Bourget
Implements: * support to render: * content/post/whatever.en.md to /en/2015/12/22/whatever/index.html * content/post/whatever.fr.md to /fr/2015/12/22/whatever/index.html * gets enabled when `Multilingual:` is specified in config. * support having language switchers in templates, that know where the translated page is (with .Page.Translations) (when you're on /en/about/, you can have a "Francais" link pointing to /fr/a-propos/) * all translations are in the `.Page.Translations` map, including the current one. * easily tweak themes to support Multilingual mode * renders in a single swift, no need for two config files. Adds a couple of variables useful for multilingual sites Adds documentation (content/multilingual.md) Added language prefixing for all URL generation/permalinking see in the code base. Implements i18n. Leverages the great github.com/nicksnyder/go-i18n lib.. thanks Nick. * Adds "i18n" and "T" template functions..
2016-08-08source: Normalize file name to NFCKishin Yagami
Fixes #2203
2016-07-30Use the Afero source fs where relevantBjørn Erik Pedersen
Fixes #2319
2016-07-30Make LazyFileReader use the Afero source fsBjørn Erik Pedersen
Fixes #2317
2016-07-11Ignore emacs temp filesAlexandre Bourget
2016-06-25helpers: Remove ToReader funcsCameron Moore
Remove StringToReader and BytesToReader in favor of using the stdlib directly.
2016-04-07source: Add missing GoDoc in FileBjørn Erik Pedersen
See #2014
2016-03-31Add readFile template funcBjørn Erik Pedersen
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-22source: Consolidate if conditionssrinivasreddy
2016-03-21Add support for symbolic links for content, layout, static, themeBjørn Erik Pedersen
Note: This is for the content roots only, but that should satisfy most needs. Fixes #1855
2016-03-17source: Consolidate filepath.Split callssrinivasreddy
2016-03-14source: Remove unused codeBjørn Erik Pedersen
2016-01-26Read/reread individual source content filesSteve Francia
next is incremental conversion
2016-01-05Update and refactor to ack Go AuthorsCameron Moore
2015-12-10Add copyright header to that source files that don’t have one.Anthony Fok
See #1646
2015-12-07Fix copyright headers in source filesBjørn Erik Pedersen
Still need to add some missing headers and an AUTHORS file. See #1646
2015-11-23Change the license to Apache 2.0Steve Francia
2015-08-22Use LazyFileReader for reading file contentsTatsushi Demachi
Simple ioutil.ReadFile is used for reading file contents but it reads all of the file contents and copies them into the memory and is run in a single goroutine. It causes much memory consumption at copying media files in content directory to publish directory and it is not good at performance. This improves the both issue by replacing ReadFile with LazyFileReader. It postpones reading the file contents until it is really needed. As the result, actual file read is run in parallelized goroutine. It improves performance especially in a really big site. In addition, if this reader is called from io.Copy, it does not copy the file contents into the memory but just copies them into destination file. It improves much memory consumption issue when the site has many media files. Fix #1181
2015-08-22Add LazyFileReader type to source libraryTatsushi Demachi
LazyFileReader is an io.Reader implementation to postpone reading the file contents until it is really needed. It is introduced for improving performance and memory consumption at reading media files in content directory.
2015-07-21source/File: Fix data racesBjørn Erik Pedersen
2015-06-03Add some tests for IgnoreFilesbep
And log error on invalid regexp. See #1189
2015-06-03Rename WatchIgnoreFiles to IgnoreFilesbep
Because this isn't just about server and watching. See #1189
2015-06-03Add configurable list to ignore files in server watchbep
The following inside `config.toml` will ignore files ending with `.foo` and `.boo`. ``` watchIgnoreFiles = [ "\\.foo$", "\\.boo$" ] ``` The above is is a list of Reqular Expressions, but note the escaping of the `\` to make TOML happy. Fixes #1189
2015-03-12source: add some test cases for Filebep
2015-03-11Correct initialisms as suggested by golintAnthony Fok
First step to use initialisms that golint suggests, for example: Line 116: func GetHtmlRenderer should be GetHTMLRenderer as see on http://goreportcard.com/report/spf13/hugo Thanks to @bep for the idea! Note that command-line flags (cobra and pflag) as well as struct fields like .BaseUrl and .Url that are used in Go HTML templates need more work to maintain backward-compatibility, and thus are NOT yet dealt with in this commit. First step in fixing #959.
2015-03-07source: apply some Golint rulesbep
2015-03-05Apply gofmt -sbep