Documentation ¶
Overview ¶
Package tools provides various methods for various things
Index ¶
- Variables
- func ArgsParser(s string) []string
- func CleanTag(s string) string
- func CreateSnippet(text, html string) string
- func GetHTMLAttributeVal(e *html.Node, key string) (string, error)
- func InArray(k string, arr []string) bool
- func ListUnsubscribeParser(v string) ([]string, error)
- func Normalize(s string) string
- func Plural(total int, singular, plural string) string
- func PrepareSocket(address string) error
- func RemoveMessageHeaders(msg []byte, headers []string) ([]byte, error)
- func SetTagCasing(s []string) []string
- func UnixSocket(address string) (string, fs.FileMode, bool)
- func UpdateMessageHeader(msg []byte, header, value string) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
var ( // TagsTitleCase enforces TitleCase on all tags TagsTitleCase bool )
Functions ¶
func ArgsParser ¶
ArgsParser will split a string by new words and quotes phrases
func CreateSnippet ¶ added in v1.9.5
CreateSnippet returns a message snippet. It will use the HTML version (if it exists) otherwise the text version.
func GetHTMLAttributeVal ¶
GetHTMLAttributeVal returns the value of an HTML Attribute, else an error. Returns a blank value if the attribute is set but empty.
func InArray ¶ added in v1.18.0
InArray tests if a string is within an array. It is not case sensitive.
func ListUnsubscribeParser ¶ added in v1.13.0
ListUnsubscribeParser will attempt to parse a `List-Unsubscribe` header and return a slide of addresses (mail & URLs)
func Normalize ¶ added in v1.18.7
Normalize will remove any extra spaces, remove newlines, and trim leading and trailing spaces
func Plural ¶ added in v1.18.0
Plural returns a singular or plural of a word together with the total
func PrepareSocket ¶ added in v1.21.0
PrepareSocket returns an error if an active socket file already exists
func RemoveMessageHeaders ¶
RemoveMessageHeaders scans a message for headers, if found them removes them. It will only remove a single instance of any given message header.
func SetTagCasing ¶ added in v1.18.0
SetTagCasing returns the slice of tags, title-casing if set
func UnixSocket ¶ added in v1.21.0
UnixSocket returns a path and a FileMode if the address is in the format of unix:<path>:<permission>
Types ¶
This section is empty.