summaryrefslogtreecommitdiffstats
path: root/source
AgeCommit message (Collapse)Author
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
2015-02-17Suppress errors for symbolic links witch point to a file.René Jochum
2014-12-10ERROR-log on symbolic linksbep
filepath.Walk does not follow symbolic links. There's no easy fix for that outside of Go, so the best we can do for now is to give notice to the end user by ERROR log statements. This commit also fixes a related panic situation in GenerateTemplateNameFrom when the layout dir was a symbolic link. Fixes #283
2014-12-09Fix various Windows-issuesbep
File handling was broken on Windows. This commit contains a revision of the path handling with separation of file paths and urls where needed. There may be remaining issues and there may be better ways to do this, but it is easier to start that refactoring job with a set of passing tests. Fixes #687 Fixes #660
2014-11-18Fix broken convertbep
The front matter convert-feature didn't work. It placed converted content in the wrong directory. This commit fixes this by doing the smallest and safest change possible; the path logic here should maybe be revisited and generalized. Fixes #643
2014-11-13convert path 2 filepathJoel Scoble
2014-11-04Source files can provide content as String or Bytes or Readerspf13
2014-10-16Big refactor of how source files are used. Also added default destination ↵spf13
extension option.
2014-04-26Don't process dotfilesChristoph Burgdorf
This commit makes it so that not only files but also folders which start with a dot are ignored. Fixes #239