mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-14 00:16:45 +00:00
tpl: Modify tpl.humanize to ordinalize integer input
Add logic to tpl.humanize such that it understands input of int literals or strings which represent an integer. When tpl.humanize sees this type of input, it will use inflect.Ordinalize as opposed to the standard inflect.Humanize. Fixes #1886
This commit is contained in:
1 parent
655568258d
commit
a52a53a6d5
1 file changed
+4
-1
@@ -450,12 +450,15 @@ Used in the [highlight shortcode](/extras/highlighting/).
|
||||
|
||||
|
||||
### humanize
|
||||
Humanize returns the humanized version of a string with the first letter capitalized.
|
||||
Humanize returns the humanized version of an argument with the first letter capitalized.
|
||||
If the input is either an int64 value or the string representation of an integer, humanize returns the number with the proper ordinal appended.
|
||||
|
||||
e.g.
|
||||
```
|
||||
{{humanize "my-first-post"}} → "My first post"
|
||||
{{humanize "myCamelPost"}} → "My camel post"
|
||||
{{humanize "52"}} → "52nd"
|
||||
{{humanize 103}} → "103rd"
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user