Documentation ¶
Overview ¶
Package utility contains utility functions used by the whole Documize ecosystem.
Index ¶
- func BeautifyFilename(fn string) string
- func Close(f interface{})
- func CommandWithTimeout(command *exec.Cmd, timeout time.Duration) ([]byte, error)
- func Conjoin(conj string, items []string) string
- func DecodeBase64(b []byte) ([]byte, error)
- func DecryptAES(text []byte) ([]byte, error)
- func EncodeBase64(b []byte) []byte
- func EscapeHTMLcomplexChars(s string) string
- func EscapeHTMLcomplexCharsByte(b []byte) []byte
- func GetRemoteIP(ip string) string
- func MakeAES(secret string) ([]byte, error)
- func MakeInitials(firstname, lastname string) string
- func MakeSlug(str string) string
- func Words(ch HTML, inSqBr int, testMode bool) ([]string, int, error)
- type HTML
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BeautifyFilename ¶
BeautifyFilename takes a filename and attempts to turn it into a readable form, as TitleCase natural language, suitable for the top level of a Document.
func Close ¶
func Close(f interface{})
Close is a convenience function to close an io.Closer, usually in a defer.
func CommandWithTimeout ¶
CommandWithTimeout runs a command but stops it if it does not finish within the timout above.
func DecodeBase64 ¶
DecodeBase64 is a convenience function to decode using StdEncoding.
func DecryptAES ¶
DecryptAES decrypts an AES encoded []byte, using a hard-wired key value, suitable for use when reading an authentication token.
func EncodeBase64 ¶
EncodeBase64 is a convenience function to encode using StdEncoding.
func EscapeHTMLcomplexChars ¶
EscapeHTMLcomplexChars looks for "complex" characters within HTML and replaces them with the HTML escape codes which describe them. "Complex" characters are those encoded in more than one byte by UTF8.
func EscapeHTMLcomplexCharsByte ¶
EscapeHTMLcomplexCharsByte looks for "complex" characters within HTML and replaces them with the HTML escape codes which describe them. "Complex" characters are those encoded in more than one byte by UTF8.
func GetRemoteIP ¶ added in v1.48.2
GetRemoteIP returns just the IP and not the port number
func MakeAES ¶
MakeAES creates an AES encryption of of a given string, using a hard-wired key value, suitable for use as an authentication token.
func MakeInitials ¶
MakeInitials returns user initials from firstname and lastname.