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
path: root/tpl/math
AgeCommit message (Collapse)Author
2022-05-06tpl: Improve godocBjørn Erik Pedersen
2022-03-18all: gofmt -w -r 'interface{} -> any' .Bjørn Erik Pedersen
Updates #9687
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
2022-02-17tpl/partials: Make sure a cached partial is invoked only onceBjørn Erik Pedersen
This commit revises the locking strategy for `partialCached`. We have added a benchmark that may be a little artificial, but it should at least show that we're not losing any performance over this: ```bash name old time/op new time/op delta IncludeCached-10 12.2ms ± 2% 11.3ms ± 1% -7.36% (p=0.029 n=4+4) name old alloc/op new alloc/op delta IncludeCached-10 7.17MB ± 0% 5.09MB ± 0% -29.00% (p=0.029 n=4+4) name old allocs/op new allocs/op delta IncludeCached-10 128k ± 1% 70k ± 0% -45.42% (p=0.029 n=4+4) ``` This commit also revises the template metrics hints logic a little, and add a test for it, which output is currently this: ```bash cumulative average maximum cache percent cached total duration duration duration potential cached count count template ---------- -------- -------- --------- ------- ------ ----- -------- 163.334µs 163.334µs 163.334µs 0 0 0 1 index.html 23.749µs 5.937µs 19.916µs 25 50 2 4 partials/dynamic1.html 9.625µs 4.812µs 6.75µs 100 50 1 2 partials/static1.html 7.625µs 7.625µs 7.625µs 100 0 0 1 partials/static2.html ``` Some notes: * The duration now includes the cached invocations (which should be very short) * A cached template gets executed once before it gets cached, so the "percent cached" will never be 100. Fixes #4086 Fixes #9506
2021-08-01Fix error handling for the time func aliasBjørn Erik Pedersen
Fixes #8835
2021-05-28Add math.Max and math.MinJoe Mooring
Closes #8583
2020-12-16all: Fix minor typosPhil Davis
2020-12-03all: Format code with gofumptBjørn Erik Pedersen
See https://github.com/mvdan/gofumpt
2020-05-14Add math.PowJoe Mooring
Closes #7266
2020-02-25tpl: Add math.SqrtChris Dennis
Fixes #6941
2019-08-12tests: Convert from testify to quicktestBjørn Erik Pedersen
2019-03-24all: Apply staticcheck recommendationsBjørn Erik Pedersen
2018-11-30tpl: Add godoc packages commentsCameron Moore
Also fix package name in tpl/templates.
2018-07-06Add a newScratch template funcBjørn Erik Pedersen
Fixes #4685
2017-10-30tpl/math: Refactor Mod with castArtem Sidorenko
It makes the code smaller
2017-09-26tpl: Add math.Ceil, Floor, and Round to method mappingsCameron Moore
2017-09-24tpl: Add math.Ceil, Floor, and RoundCameron Moore
Ceil and Floor are frontends for the stdlib math functions. The Round implementation is essentially the same thing except that the Go stdlib doesn't include a Round implementation in a stable release yet. I've included the Round function slated for Go 1.10. Fixes #3883
2017-08-07all: Fix spellingBjørn Erik Pedersen
And some other minor issues.
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-03tpl/math: Add log functionArtem Sidorenko
It might be very useful for building tag clouds.
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/math: 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