summaryrefslogtreecommitdiffstats
path: root/hugolib/scratch.go
AgeCommit message (Collapse)Author
2018-07-06Add a newScratch template funcBjørn Erik Pedersen
Fixes #4685
2018-03-17hugolib: Add Reset method to delete key from Scratchcmal
2017-06-13all: Update import paths to gohugoio/hugoBjørn Erik Pedersen
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
2016-03-24Do not use defer for unlocking in ScratchBjørn Erik Pedersen
It is a fairly costly operation: ``` benchmark old ns/op new ns/op delta BenchmarkScratchGet-4 109 31.6 -71.01% benchmark old allocs new allocs delta BenchmarkScratchGet-4 0 0 +0.00% benchmark old bytes new bytes delta BenchmarkScratchGet-4 0 0 +0.00% ´´´
2016-03-23hugolib: Some more Golint fixesBjørn Erik Pedersen
2016-03-21Protect against concurrent Scratch read and writeBjørn Erik Pedersen
Fixes #2005
2016-03-06Add list support in ScratchBjørn Erik Pedersen
2016-02-06Apply gofmt -sBjørn Erik Pedersen
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-02Add map support to scratchMarek Janda
2015-01-31Add writable context to Nodebep
The variable scope in the Go templates makes it hard, if possible at all, to write templates with counter variables or similar state. This commit fixes that by adding a writable context to Node, backed by a map: Scratch. This context has three methods, Get, Set and Add. The Add is tailored for counter variables, but can be used for any built-in numeric values or strings.