Documentation
¶
Overview ¶
Package readme provides functions for reading and suggesting readme files.
Index ¶
- func IncompatibleANSI(r io.Reader) (bool, error)
- func List(content ...string) []string
- func ReadPool(art *models.File, download, extra dir.Directory) (*bytes.Buffer, *bytes.Buffer, error)
- func RemoveCtrls(b []byte) []byte
- func SortContent(content ...string) []string
- func Suggest(filename, group string, content ...string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IncompatibleANSI ¶
IncompatibleANSI scans for HTML incompatible, ANSI cursor escape codes in the reader.
func ReadPool ¶ added in v1.7.7
func ReadPool(art *models.File, download, extra dir.Directory) (*bytes.Buffer, *bytes.Buffer, error)
ReadPool returns the content of the readme file or the text of the file download. The first buffer is used for CP1252 and ISO-8859-1 texts while the second buffer is used for UTF-8 texts.
The CP1252 and ISO-8859-1 Buffer may also include a FILE_ID.DIZ prefixed metadata. However, the UTF-8 Buffer does get the FILE_ID.DIZ prefix.
func RemoveCtrls ¶
RemoveCtrls removes ANSI escape codes and converts Windows line endings to Unix.
func SortContent ¶
SortContent sorts the content list by the number of slashes in each string. It prioritizes strings with fewer slashes (i.e., closer to the root). If the number of slashes is the same, it sorts alphabetically.
func Suggest ¶
Suggest returns a suggested readme file name for the record. It prioritizes the filename and group name with a priority extension, such as ".nfo", ".txt", etc. If no priority extension is found, it will return the first text file in the content list.
The filename should be the name of the file archive artifact. The group should be a name or common abbreviation of the group that released the artifact. The content should be a list of files contained in the artifact.
This is a port of the CFML function, variables.findTextfile found in File.cfc.
Types ¶
This section is empty.