Back to godoc.org
github.com/gohugoio/hugo/tpl/inflect

package inflect

v0.72.0
Latest Go to latest
Published: 4 days ago | License: Apache-2.0 | Module: github.com/gohugoio/hugo

Overview

Package inflect provides template functions for the inflection of words.

Index

type Namespace

type Namespace struct{}

Namespace provides template functions for the "inflect" namespace.

func New

func New() *Namespace

New returns a new instance of the inflect-namespaced template functions.

func (*Namespace) Humanize

func (ns *Namespace) Humanize(in interface{}) (string, error)

Humanize returns the humanized form of a single parameter.

If the parameter is either an integer or a string containing an integer value, the behavior is to add the appropriate ordinal.

Example:  "my-first-post" -> "My first post"
Example:  "103" -> "103rd"
Example:  52 -> "52nd"

func (*Namespace) Pluralize

func (ns *Namespace) Pluralize(in interface{}) (string, error)

Pluralize returns the plural form of a single word.

func (*Namespace) Singularize

func (ns *Namespace) Singularize(in interface{}) (string, error)

Singularize returns the singular form of a single word.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier