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
2022-05-25Fix Plainify edge casesBjørn Erik Pedersen
This commit replaces the main part of `helpers.StripHTML` with Go's implementation in its html/template package. It's a little slower, but correctness is more important: ```bash BenchmarkStripHTMLOld-10 680316 1764 ns/op 728 B/op 4 allocs/op BenchmarkStripHTMLNew-10 384520 3099 ns/op 2089 B/op 10 allocs/op ``` Fixes #9199 Fixes #9909 Closes #9410
2022-05-06Improve error messages, esp. when the server is runningBjørn Erik Pedersen
* Add file context to minifier errors when publishing * Misc fixes (see issues) * Allow custom server error template in layouts/server/error.html To get to this, this commit also cleans up and simplifies the code surrounding errors and files. This also removes the usage of `github.com/pkg/errors`, mostly because of https://github.com/pkg/errors/issues/223 -- but also because most of this is now built-in to Go. Fixes #9852 Fixes #9857 Fixes #9863
2022-05-06tpl: Improve godocBjørn Erik Pedersen
2022-03-18all: gofmt -w -r 'interface{} -> any' .Bjørn Erik Pedersen
Updates #9687
2022-02-26Remove the trailing new line in .CodeBjørn Erik Pedersen
Fixes #9572
2022-02-24Add Markdown diagrams and render hooks for code blocksBjørn Erik Pedersen
You can now create custom hook templates for code blocks, either one for all (`render-codeblock.html`) or for a given code language (e.g. `render-codeblock-go.html`). We also used this new hook to add support for diagrams in Hugo: * Goat (Go ASCII Tool) is built-in and enabled by default; just create a fenced code block with the language `goat` and start draw your Ascii diagrams. * Another popular alternative for diagrams in Markdown, Mermaid (supported by GitHub), can also be implemented with a simple template. See the Hugo documentation for more information. Updates #7765 Closes #9538 Fixes #9553 Fixes #8520 Fixes #6702 Fixes #9558
2021-08-01Fix error handling for the time func aliasBjørn Erik Pedersen
Fixes #8835
2021-06-14Misc config loading fixesBjørn Erik Pedersen
The main motivation behind this is simplicity and correctnes, but the new small config library is also faster: ``` BenchmarkDefaultConfigProvider/Viper-16 252418 4546 ns/op 2720 B/op 30 allocs/op BenchmarkDefaultConfigProvider/Custom-16 450756 2651 ns/op 1008 B/op 6 allocs/op ``` Fixes #8633 Fixes #8618 Fixes #8630 Updates #8591 Closes #6680 Closes #5192
2021-05-03tpl: Fix countwords to handle special charsJulien Midedji
Fixes #8479
2021-02-23tpl: Add method mappings for strings.Contains, strings.ContainsAnyBjørn Erik Pedersen
Just to confirm/document the function signature.
2021-01-08tpl: Do not return errors in substr for out-of-bounds casesCameron Moore
Most other substr implementations don't error out in out-of-bounds cases but simply return an empty string (or a value that's printed as an empty string). We'll follow their lead and not exit template execution. Allow the user decide what to do with the empty result. Fixes #8113
2021-01-08tpl: Add missing test scenario for strings.SubstrCameron Moore
2020-12-16all: Fix minor typosPhil Davis
2020-12-03all: Format code with gofumptBjørn Erik Pedersen
See https://github.com/mvdan/gofumpt
2020-12-02tpl: Fix substr when length parameter is zeroCameron Moore
When length parameter is zero, always return an empty string. Updates #7993
2020-11-28tpl: Refactor and fix substr logicCameron Moore
Fix miscalculations when start is negative. Results should now match PHP substr. Fixes #7993
2020-08-28tpl: Add limit support to replaceRECameron Moore
Go stdlib doesn't contain a limited replace in the regexp package, but we can accomplish the same thing with ReplaceAllStringFunc. Fixes #7586
2020-08-28tpl: Add limit option to replace template functionCameron Moore
Updates #7586
2020-07-03tpl/strings: Add strings.CountBjørn Erik Pedersen
Fixes #7453
2019-12-12Create lightweight forks of text/template and html/templateBjørn Erik Pedersen
This commit also removes support for Ace and Amber templates. Updates #6594
2019-08-12tests: Convert from testify to quicktestBjørn Erik Pedersen
2018-11-30tpl: Add godoc packages commentsCameron Moore
Also fix package name in tpl/templates.
2018-10-16commands: Show server error info in browserBjørn Erik Pedersen
The main item in this commit is showing of errors with a file context when running `hugo server`. This can be turned off: `hugo server --disableBrowserError` (can also be set in `config.toml`). But to get there, the error handling in Hugo needed a revision. There are some items left TODO for commits soon to follow, most notable errors in content and config files. Fixes #5284 Fixes #5290 See #5325 See #5324
2018-09-07tpl/strings: Add strings.FirstUpperBjørn Erik Pedersen
Fixes #5174
2018-06-04tpl/strings: strings.RuneCountDavid E. Wheeler
2018-06-03tpl/strings: Remove overflow check in strings.RepeatBjørn Erik Pedersen
The test fails on 32 bit systems. Let it panic instead.
2018-06-03tpl/strings: Adjust the overflow validation in strings.RepeatBjørn Erik Pedersen
This now matches the validation in the stdlib, but we return an error instead.
2018-06-03tpl: Add strings.RepeatDavid E. Wheeler
2017-12-17tpl/strings: Fix broken testBjørn Erik Pedersen
2017-12-17Make chomp return the type it receivesVictor Kropp
fixes #2187
2017-08-18tpl: Cleanup strings.TrimPrefix and TrimSuffixCameron Moore
These funcs were added during the move to namespaces but were undocumented. This commit fixes the order of the arguments and adds the funcs to the method mapping.
2017-08-18tpl: Add strings.TrimLeft and TrimRight Cameron Moore
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-07-31Make the title case style guide configurableBjørn Erik Pedersen
This works for the `title` func and the other places where Hugo makes title case. * AP style (new default) * Chicago style * Go style (what we have today) Fixes #989
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-05-20tpl: Make the Namespace func signature explicitBjørn Erik Pedersen
This makes it cleaner and avoids breaking client code, such as the docs helper JSON generator.
2017-05-02tpl: Add basic tests for all namespace init funcsCameron Moore
2017-05-01tpl: Add docshelper for template funcsBjørn Erik Pedersen
And fix some other minor related issues. Updates #3418
2017-05-01tpl: Fix the remaining template funcs namespace issuesBjørn Erik Pedersen
See #3042
2017-05-01tpl/strings: Make it a package that stands on its ownBjørn Erik Pedersen
See #3042
2017-04-30tpl: Add template function namespacesCameron Moore
This commit moves almost all of the template functions into separate packages under tpl/ and adds a namespace framework. All changes should be backward compatible for end users, as all existing function names in the template funcMap are left intact. Seq and DoArithmatic have been moved out of the helpers package and into template namespaces. Most of the tests involved have been refactored, and many new tests have been written. There's still work to do, but this is a big improvement. I got a little overzealous and added some new functions along the way: - strings.Contains - strings.ContainsAny - strings.HasSuffix - strings.TrimPrefix - strings.TrimSuffix Documentation is forthcoming. Fixes #3042