tools

package
v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package tools provides various methods for various things

Index

Constants

This section is empty.

Variables

View Source
var (

	// TagsTitleCase enforces TitleCase on all tags
	TagsTitleCase bool
)

Functions

func ArgsParser

func ArgsParser(s string) []string

ArgsParser will split a string by new words and quotes phrases

func CleanTag

func CleanTag(s string) string

CleanTag returns a clean tag, removing whitespace and invalid characters

func CreateSnippet added in v1.9.5

func CreateSnippet(text, html string) string

CreateSnippet returns a message snippet. It will use the HTML version (if it exists) otherwise the text version.

func GetHTMLAttributeVal

func GetHTMLAttributeVal(e *html.Node, key string) (string, error)

GetHTMLAttributeVal returns the value of an HTML Attribute, else an error. Returns a blank value if the attribute is set but empty.

func ListUnsubscribeParser added in v1.13.0

func ListUnsubscribeParser(v string) ([]string, error)

ListUnsubscribeParser will attempt to parse a `List-Unsubscribe` header and return a slide of addresses (mail & URLs)

func RemoveMessageHeaders

func RemoveMessageHeaders(msg []byte, headers []string) ([]byte, error)

RemoveMessageHeaders scans a message for headers, if found them removes them. It will only remove a single instance of any given message header.

func UpdateMessageHeader added in v1.9.9

func UpdateMessageHeader(msg []byte, header, value string) ([]byte, error)

UpdateMessageHeader scans a message for a header and updates its value if found.

Types

This section is empty.

Jump to

Keyboard shortcuts

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