titlecase

package
v0.0.0-...-4a854fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2020 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package titlecase provides a helper function for transforming an arbitrary text into a capitalized version, as described by NY Times Manual of Style.

Additional hooks can be supplied to modify the standard behaviour, see Convert documentation for further details.

Original Perl version by: John Gruber http://daringfireball.net/ 10 May 2008 Python version by Stuart Colville http://muffinresearch.co.uk

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(text string, preHook PreHook, postHook PostHook) string

Convert changes input string to conform to the NY Times Manual of Style.

If preHook and/or postHook arguments are not nil, they will be run, respectively, before and after the standard transformations.

Both hook functions should return a transformed version of the string. Additionally, preHook returns true if the returned string is final, or false if it should still be run through standard transformations.

Types

type PostHook

type PostHook func(word string, allCaps bool) string

PostHook defines Convert post hook function signature

type PreHook

type PreHook func(word string, allCaps bool) (string, bool)

PreHook defines Convert per hook function signature

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL