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 IsDir(path string) bool
- func IsFile(path string) bool
- func ListUnsubscribeParser(v string) ([]string, error)
- func Normalize(s string) string
- func OverrideFromHeader(msg []byte, address string) ([]byte, error)
- func Plural(total int, singular, plural string) string
- func PrepareSocket(address string) error
- func RemoveMessageHeaders(msg []byte, headers []string) ([]byte, error)
- func SafeUint64(i any) uint64
- func SetHTMLAttributeVal(n *html.Node, key, val string)
- func SetMessageHeader(msg []byte, header, value string) ([]byte, error)
- func SetTagCasing(s []string) []string
- func UnixSocket(address string) (string, fs.FileMode, bool)
- func WalkHTML(n *html.Node, fn func(*html.Node))
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 OverrideFromHeader ¶ added in v1.22.0
OverrideFromHeader scans a message for the From header and replaces it with a different email address.
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 SafeUint64 ¶ added in v1.27.2
SafeUint64 converts an int or int64 to uint64, ensuring it does not exceed the maximum value for uint64.
func SetHTMLAttributeVal ¶ added in v1.22.1
SetHTMLAttributeVal sets an attribute on a node.
func SetMessageHeader ¶ added in v1.23.0
SetMessageHeader scans a message for a header and updates its value if found. It does not consider multiple instances of the same header. If not found it will add the header to the beginning of the message.
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.