forked from gohugoio/hugo
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tpl/tplimpl: Reimplement the ".Params tolower" template transformer
All `.Params` are stored lowercase, but it should work to access them `.Page.camelCase` etc. There was, however, some holes in the logic with the old transformer. This commit fixes that by applying a blacklist instead of the old whitelist logic. `.Param` is a very distinct key. The original case will be kept in `.Data.Params.myParam`, but other than that it will be lowercased. This implementation is also faster: ```bash benchmark old ns/op new ns/op delta BenchmarkTemplateParamsKeysToLower-4 15237 9581 -37.12% benchmark old allocs new allocs delta BenchmarkTemplateParamsKeysToLower-4 92 40 -56.52% benchmark old bytes new bytes delta BenchmarkTemplateParamsKeysToLower-4 2656 1360 -48.80% ``` Fixes gohugoio#5068
- Loading branch information
Showing
2 changed files
with
92 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters