Categorygithub.com/Defacto2/releaser
modulepackage
1.1.2
Repository: https://github.com/defacto2/releaser.git
Documentation: pkg.go.dev

# README

Defacto2 / releaser

Go Reference Go Report Card

A Go library for handling the formatting of Defacto2 releasers. See the reference documentation for additional usage and examples.

Releasers are the groups or organisations that create the art, music, demos, intros, cracks, etc. that are found on the Defacto2 website. They are also the sites and boards that have hosted the files and communities.

Usage

In your Go project, import the releaser library.

package main

import (
	"fmt"
	"path"

	"github.com/Defacto2/releaser"
)

func main() {
	// Clean the the string releaser name.
	name := releaser.Clean("  the  knightmare  bbs ")
	fmt.Println(name) // Output: Knightmare BBS

	// Format the releaser name for use in a database cell.
	data := releaser.Cell("  the  knightmare  bbs ")
	fmt.Println(data) // Output: KNIGHTMARE BBS

	// Format the releaser name into a URL path.
	urlPath := releaser.Obfuscate("the knightmare bbs")
	fmt.Println(urlPath) // Output: knightmare-bbs

	// Format the releaser name into a human readable string.
	const url1 = "https://defacto2.net/g/knightmare-bbs"
	name = releaser.Humanize(path.Base(url1))
	fmt.Println(name) // Output: Knightmare BBS

	// Format the releaser names into a HTML link description.
	const url2 = "https://defacto2.net/g/class*paradigm*razor-1911"
	name = releaser.Link(path.Base(url2))
	fmt.Println(name) // Output: Class + Paradigm + Razor 1911
}

# Packages

Package fix provides functions for cleaning and formatting strings of known words and group names.
Package initialism provides a list of alternative spellings, acronyms and initialisms for the named releasers.
Package name provides functionality for handling the URL path of a releaser.

# Functions

Cell formats the string to be used as a cell in a database table.
Clean fixes the malformed string and applies title case formatting.
Humanize deobfuscates the URL path and returns the formatted, human-readable group name.
Index deobfuscates the URL path and applies [releaser.Humanize] so that it can be stored in a database table as a releaser key and index in the database table.
Link deobfuscates the URL path and applies [releaser.Humanize].
Obfuscate cleans and formats the string for use as a URL path.
Title formats the string to be used as a title or the basis for a LIKE SQL query.