mirror of
https://github.com/gohugoio/hugo.git
synced 2025-03-19 14:12:54 +00:00
parent
74924dd50d
commit
751d4906ef
3 changed files with 14 additions and 1 deletions
|
@ -14,6 +14,7 @@ weight: 10
|
||||||
* We now use a custom-built `LazyFileReader` for reading file contents, which means we don't read media files in `/content` into memory anymore -- and file reading is now performed in parallel on multicore PCs. [1181](https://github.com/spf13/hugo/issues/1181)
|
* We now use a custom-built `LazyFileReader` for reading file contents, which means we don't read media files in `/content` into memory anymore -- and file reading is now performed in parallel on multicore PCs. [1181](https://github.com/spf13/hugo/issues/1181)
|
||||||
* Hugo is now built with `Go 1.5` which, among many other improvements, have fixed the last known data race in Hugo. [917] (https://github.com/spf13/hugo/issues/917)
|
* Hugo is now built with `Go 1.5` which, among many other improvements, have fixed the last known data race in Hugo. [917] (https://github.com/spf13/hugo/issues/917)
|
||||||
* Lots of fixes and improvements in the template funcs:
|
* Lots of fixes and improvements in the template funcs:
|
||||||
|
* The new `pluralize` template func.
|
||||||
* The `sort` template func now accepts field/key chaining arguments and pointer values. [1330](https://github.com/spf13/hugo/issues/1330)
|
* The `sort` template func now accepts field/key chaining arguments and pointer values. [1330](https://github.com/spf13/hugo/issues/1330)
|
||||||
* Several fixes for `slicestr` and `substr`, most importantly, they now have full `utf-8`-support. [1190](https://github.com/spf13/hugo/issues/1190) [1333](https://github.com/spf13/hugo/issues/1333) [1347](https://github.com/spf13/hugo/issues/1347)
|
* Several fixes for `slicestr` and `substr`, most importantly, they now have full `utf-8`-support. [1190](https://github.com/spf13/hugo/issues/1190) [1333](https://github.com/spf13/hugo/issues/1333) [1347](https://github.com/spf13/hugo/issues/1347)
|
||||||
* The new `last` template function allows the user to select the last `N` items of a slice. [1148](https://github.com/spf13/hugo/issues/1148)
|
* The new `last` template function allows the user to select the last `N` items of a slice. [1148](https://github.com/spf13/hugo/issues/1148)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
---
|
g---
|
||||||
aliases:
|
aliases:
|
||||||
- /layout/functions/
|
- /layout/functions/
|
||||||
date: 2013-07-01
|
date: 2013-07-01
|
||||||
|
@ -366,6 +366,10 @@ Runs the string through the Markdown processesor. The result will be declared as
|
||||||
|
|
||||||
e.g. `{{ .Title | markdownify }}`
|
e.g. `{{ .Title | markdownify }}`
|
||||||
|
|
||||||
|
### pluralize
|
||||||
|
Pluralize the given word with a set of common English pluralization rules.
|
||||||
|
|
||||||
|
e.g. `{{ "cat" | pluralize }}` → "cats"
|
||||||
|
|
||||||
### replace
|
### replace
|
||||||
Replaces all occurrences of the search string with the replacement string.
|
Replaces all occurrences of the search string with the replacement string.
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
package tpl
|
package tpl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bitbucket.org/pkg/inflect"
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -1371,6 +1372,13 @@ func init() {
|
||||||
"readDir": ReadDir,
|
"readDir": ReadDir,
|
||||||
"seq": helpers.Seq,
|
"seq": helpers.Seq,
|
||||||
"getenv": func(varName string) string { return os.Getenv(varName) },
|
"getenv": func(varName string) string { return os.Getenv(varName) },
|
||||||
|
"pluralize": func(in interface{}) (string, error) {
|
||||||
|
word, err := cast.ToStringE(in)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return inflect.Pluralize(word), nil
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue