From bc5e2d841fd1fa621f707a3c1e0d16fb1e1854e5 Mon Sep 17 00:00:00 2001 From: Cameron Moore Date: Fri, 5 Feb 2016 00:05:04 -0600 Subject: [PATCH] tpl: Add humanize func and cleanup lint 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. --- content/templates/functions.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/content/templates/functions.md b/content/templates/functions.md index 62228632b..f5b254a7c 100644 --- a/content/templates/functions.md +++ b/content/templates/functions.md @@ -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.