Skip to content

Commit

Permalink
tpl: Add humanize func and cleanup lint
Browse files Browse the repository at this point in the history
Add humanize (inflect.Humanize) to the template funcMap.  Documentation and
tests are included.

Various code cleanups of the template funcs:

- Break pluralize and singularize out into stand-alone funcs.
- Sort the list of funcMap entries.
- Add some minimal godoc comments to all public funcs.
- Fix some issues found by golint and grind.
  • Loading branch information
moorereason authored and bep committed Feb 6, 2016
1 parent e95f3af commit 45df459
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 105 deletions.
10 changes: 10 additions & 0 deletions docs/content/templates/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,16 @@ Takes a string of code and a language, uses Pygments to return the syntax highli
Used in the [highlight shortcode](/extras/highlighting/).


### humanize
Humanize returns the humanized version of a string with the first letter capitalized.

e.g.
```
{{humanize "my-first-post"}} → "My first post"
{{humanize "myCamelPost"}} → "My camel post"
```


### lower
Converts all characters in string to lowercase.

Expand Down
Loading

0 comments on commit 45df459

Please sign in to comment.