Documentation ¶
Overview ¶
Package simple provides functions for handling string or integer input data.
Index ¶
- Constants
- Variables
- func AssetSrc(abs, dir, unid, ext string) string
- func BytesHuman(i int64) string
- func DemozooGetLink(filename, filesize, demozoo, unid any) template.HTML
- func DownloadB(i any) template.HTML
- func ImageSample(unid, previewDir string) template.HTML
- func ImageSampleStat(unid, previewDir string) bool
- func ImageXY(name string) [2]string
- func LinkID(id any, elem string) (string, error)
- func LinkPreviewTip(name, platform string) string
- func LinkRelations(val string) template.HTML
- func LinkRelr(name string) (string, error)
- func LinkSites(val string) template.HTML
- func MIME(name string) string
- func MagicAsTitle(name string) string
- func MakeLink(name, class string, performant bool) (string, error)
- func MkContent(src string) string
- func ReleaserPair(a, b any) [2]string
- func Releasers(prime, second string, magazine bool) template.HTML
- func Screenshot(unid, desc, previewDir string) template.HTML
- func StatHumanize(name string) (string, string, string)
- func Thumb(unid, desc, thumbDir string, bottom bool) template.HTML
- func ThumbSample(unid, thumbDir string) template.HTML
- func Updated(t any, s string) string
Constants ¶
const (
YYYYMMDD = "2006-Jan-02"
)
Variables ¶
var ( ErrLinkType = errors.New("the id value is an invalid type") ErrNegative = errors.New("value cannot be a negative number") )
Functions ¶
func AssetSrc ¶
ArtifactSrc returns a URL to an artifact asset with an cache busting hash. The named dir is the directory where the asset is stored, the unid is the unique identifier of the asset and the ext is the file extension of the expected asset.
func BytesHuman ¶
BytesHuman returns the file size for the file record.
func DemozooGetLink ¶
DemozooGetLink returns a HTML link to the Demozoo download links.
func ImageSample ¶
ImageSample returns a HTML image tag for the given unid.
func ImageSampleStat ¶
ImageSampleStat returns true if the image sample file exists and is not a 0 byte file.
func LinkID ¶
LinkID creates a URL to link to the record. The id is obfuscated to prevent direct linking. The elem is the element to link to, such as 'f' for file or 'd' for download.
func LinkPreviewTip ¶
LinkPreviewTip returns a tooltip to describe the preview link.
func LinkRelations ¶
LinkRelations returns a collection of HTML anchor links that point to artifacts.
The val string is a list of artifact descriptions and their URL ID separated by a semicolon ";". Multiple artifact entries are separated by a pipe "|".
For example, "NFO;9f1c2|Intro;a92116e".
func LinkSites ¶
LinkSites returns a collection of HTML anchor links that point to websites.
The val string is a list of website descriptions and their URL ID separated by a semicolon ";". Multiple website entries are separated by a pipe "|".
For example, "Site;example.com|Documentation;example.com/doc".
func MagicAsTitle ¶
MagicAsTitle returns the magic number description for the named file.
func MakeLink ¶
MakeLink returns a HTML anchor link to the named group page. When the performant flag is false, the link will apply additional typography to the group name. But this should not be used for large lists of links as it will significantly slow down the page rendering.
For example supplying the name "tport"
- with performant false will return a link displaying "tPORt"
- with performant true will return a link displaying "Tport"
func MkContent ¶
MkContent makes and/or returns a distinct directory path in the temp directory that is used to extract the contents of the content of the file download archive. To make the directory distinct it is prefixed with the basename of the src file.
func ReleaserPair ¶
ReleaserPair returns the primary and secondary releaser groups as two strings.
func Screenshot ¶
Screenshot returns a picture elment with screenshots for the given unid. The unid is the filename of the screenshot image without an extension. The desc is the description of the image used for the alt attribute in the img tag. Supported formats are webp, png, jpg and avif.
func StatHumanize ¶
StatHumanize returns the last modified date, size in bytes and size formatted of the named file.
func Thumb ¶
Thumb returns a HTML image tag or picture element for the given unid. The unid is the filename of the thumbnail image without an extension. The desc is the description of the image.
func ThumbSample ¶
ThumbSample returns a HTML image tag for the given unid.
Types ¶
This section is empty.