Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-09-26metrics: Add simple template metrics featureCameron Moore
2017-08-19tpl: Prepare for template metricsBjørn Erik Pedersen
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-13all: Update import paths to gohugoio/hugoBjørn Erik Pedersen
2017-05-13hugolib: Handle shortcode per output formatBjørn Erik Pedersen
This commit allows shortcode per output format, a typical use case would be the special AMP media tags. Note that this will only re-render the "overridden" shortcodes and only in pages where these are used, so performance in the normal case should not suffer. Closes #3220
2017-05-01tpl/collections: Make it a package that stands on its ownBjørn Erik Pedersen
See #3042
2017-04-05tpl: Fix nil pointer in Tree()Bjørn Erik Pedersen
Fixes #3285
2017-04-03tpl: Rework to handle both text and HTML templatesBjørn Erik Pedersen
Before this commit, Hugo used `html/template` for all Go templates. While this is a fine choice for HTML and maybe also RSS feeds, it is painful for plain text formats such as CSV, JSON etc. This commit fixes that by using the `IsPlainText` attribute on the output format to decide what to use. A couple of notes: * The above requires a nonambiguous template name to type mapping. I.e. `/layouts/_default/list.json` will only work if there is only one JSON output format, `/layouts/_default/list.mytype.json` will always work. * Ambiguous types will fall back to HTML. * Partials inherits the text vs HTML identificator of the container template. This also means that plain text templates can only include plain text partials. * Shortcode templates are, by definition, currently HTML templates only. Fixes #3221
2017-04-02Revert "tpl: Rework to handle both text and HTML templates"Bjørn Erik Pedersen
Will have to take another stab at this ... This reverts commit 5c5efa03d2512749950b0d05a7d4bde35ecbdc37. Closes #3260
2017-04-02tpl: Rework to handle both text and HTML templatesBjørn Erik Pedersen
Before this commit, Hugo used `html/template` for all Go templates. While this is a fine choice for HTML and maybe also RSS feeds, it is painful for plain text formats such as CSV, JSON etc. This commit fixes that by using the `IsPlainText` attribute on the output format to decide what to use. A couple of notes: * The above requires a nonambiguous template name to type mapping. I.e. `/layouts/_default/list.json` will only work if there is only one JSON output format, `/layouts/_default/list.mytype.json` will always work. * Ambiguous types will fall back to HTML. * Partials inherits the text vs HTML identificator of the container template. This also means that plain text templates can only include plain text partials. * Shortcode templates are, by definition, currently HTML templates only. Fixes #3221
2017-02-21tpl, hugolib: Fix live-reload of non-renderable content pagesBjørn Erik Pedersen
Fixes #3062
2017-02-17tpl: Refactor packageBjørn Erik Pedersen
Now: * The template API lives in /tpl * The rest lives in /tpl/tplimpl This is bound te be more improved in the future. Updates #2701
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-10hugolib: Fix error for non-renderable HTML content with shortcodesBjørn Erik Pedersen
This commit re-introduces template lookup order that was accidently removed as part of the template nonglobal refactoring. Fixes #3021
2017-02-07tpl: Must do a extra lookup of cloned base templatesBjørn Erik Pedersen
See #2549 Fixes #3013
2017-02-04all: Refactor to nonglobal file systemsBjørn Erik Pedersen
Updates #2701 Fixes #2951
2017-01-11Show full template errorBrad Peabody
2017-01-10 all: Refactor to nonglobal template handlingBjørn Erik Pedersen
Updates #2701
2017-01-07all: Refactor to non-global loggerBjørn Erik Pedersen
Note that this looks like overkill for just the logger, and that is correct, but this will make sense once we start with the template handling etc. Updates #2701
2016-12-15hugolib: Enable override of theme base template onlyBjørn Erik Pedersen
This commit fixes the base template lookup order to match the behaviour of regular templates. ``` 1. <current-path>/<template-name>-baseof.<suffix>, e.g. list-baseof.<suffix>. 2. <current-path>/baseof.<suffix> 3. _default/<template-name>-baseof.<suffix>, e.g. list-baseof.<suffix>. 4. _default/baseof.<suffix> For each of the steps above, it will first look in the project, then, if theme is set, in the theme's layouts folder. ``` Fixes #2783
2016-11-23hugolib, source, tpl: Fix docsbogem
See #2014
2016-11-22Fix case issues with ParamsBjørn Erik Pedersen
There are currently several Params and case related issues floating around in Hugo. This is very confusing for users and one of the most common support questions on the forum. And while there have been done some great leg work in Viper etc., this is of limited value since this and similar doesn't work: `Params.myCamelCasedParam` Hugo has control over all the template method invocations, and can take care of all the lower-casing of the map lookup keys. But that doesn't help with direct template lookups of type `Site.Params.TWITTER_CONFIG.USER_ID`. This commit solves that by doing some carefully crafted modifications of the templates' AST -- lowercasing the params keys. This is low-level work, but it's not like the template API wil change -- and this is important enough to defend such "bit fiddling". Tests are added for all the template engines: Go templates, Ace and Amber. Fixes #2615 Fixes #1129 Fixes #2590
2016-11-22Revert "Fix case issues with Params"Bjørn Erik Pedersen
This reverts commit 239c75c7f866e8970b794a9e7bac73de46052241. There is a ininite loop in there somewhere on my site that needs to be resolved.
2016-11-22Fix case issues with ParamsBjørn Erik Pedersen
There are currently several Params and case related issues floating around in Hugo. This is very confusing for users and one of the most common support questions on the forum. And while there have been done some great leg work in Viper etc., this is of limited value since this and similar doesn't work: `Params.myCamelCasedParam` Hugo has control over all the template method invocations, and can take care of all the lower-casing of the map lookup keys. But that doesn't help with direct template lookups of type `Site.Params.TWITTER_CONFIG.USER_ID`. This commit solves that by doing some carefully crafted modifications of the templates' AST -- lowercasing the params keys. This is low-level work, but it's not like the template API wil change -- and this is important enough to defend such "bit fiddling". Tests are added for all the template engines: Go templates, Ace and Amber. Fixes #2615 Fixes #1129 Fixes #2590
2016-10-26Make Amber read from the Afero source file systemBjørn Erik Pedersen
2016-10-25Add missing template error loggingBjørn Erik Pedersen
2016-10-24tpl: Fix commentBjørn Erik Pedersen
2016-10-24Avoid reading from Viper for path and URL funcsBjørn Erik Pedersen
The gain, given the "real sites benchmark" below, is obvious: ``` benchmark old ns/op new ns/op delta BenchmarkHugo-4 14497594101 13084156335 -9.75% benchmark old allocs new allocs delta BenchmarkHugo-4 57404335 48282002 -15.89% benchmark old bytes new bytes delta BenchmarkHugo-4 9933505624 9721984424 -2.13% ``` Fixes #2495
2016-10-14Add workaround for block template crashBjørn Erik Pedersen
Fixes #2549
2016-10-12tpl: Remove the spamming template errorsBjørn Erik Pedersen
Fixes #2343
2016-10-12tpl: Factor out double Lookup in executeTemplateCameron Moore
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-07-30Take 2: Load templates from the Afero source fsBjørn Erik Pedersen
See #2321
2016-07-30Load templates from the Afero source fsBjørn Erik Pedersen
Fixes #2321
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-25tpl: Small Golint fixesdigitalcraftsman
2016-03-15No block support in shortcodesBjørn Erik Pedersen
So no need to check them.
2016-03-10Add support for Go 1.6 block keyword in templatesBjørn Erik Pedersen
NOTE: Needs Go 1.6 to use the new feature. Fixes #1832
2016-03-09Create template clone for late template executionBjørn Erik Pedersen
Fixing some breaking blogs on Go 1.6 Fixes #1879
2016-03-04tpl: Unexport the rest of the internal template funcsBjørn Erik Pedersen
2016-02-28Revert "Create template clone for late template execution"Bjørn Erik Pedersen
This reverts commit 93b04e67f633e96484c29158cad00e86abe64c1e.
2016-02-28Create template clone for late template executionBjørn Erik Pedersen
Fixing some breaking blogs on Go 1.6 Fixes #1879
2016-01-06Replace *bytes.Buffer with io.Writer in renderingDaniel Martí
Found via github.com/mvdan/interfacer.
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-24Change the license to Apache 2.0Steve Francia
2015-11-16Fix trivial typos in codeAnthony Fok
2015-07-20On error, return error message, not nilScott C Wilson
2015-07-20Let Amber template call Hugo's custom functionsTatsushi Demachi
Amber doesn't share text/template `FuncMap` functions and has its own function list. This allows Amber to call Hugo's custom functions.
2015-07-19Fix name logic for Amber templatesBjørn Erik Pedersen
2015-06-25Use helpers.GetThemeDir() to find base templates.Jonathan Anderson
Now that we have the helpers.GetThemeDir() function, use it instead of calling directly into viper.