Documentation
¶
Overview ¶
Package bbcode provides shared BBCode cleanup and normalization primitives.
Index ¶
- func ConvertCodeToPre(value string) string
- func ConvertCodeToQuote(value string) string
- func ConvertCollapseToComparison(value string, spoilerHide string, collapses []string) string
- func ConvertComparisonToCentered(value string, maxWidth int) string
- func ConvertComparisonToCollapse(value string, maxWidth int) string
- func ConvertHideToSpoiler(value string) string
- func ConvertNamedSpoilerToNamedHide(value string) string
- func ConvertNamedSpoilerToNormalSpoiler(value string) string
- func ConvertPreToCode(value string) string
- func ConvertSpoilerToHide(value string) string
- func ConvertToAlign(value string) string
- func IsOnlyTags(value string) bool
- func NormalizeImageRawURL(value string) string
- func NormalizeNewlines(value string) string
- func RemoveColor(value string) string
- func RemoveExtraLines(value string) string
- func RemoveHide(value string) string
- func RemoveImageResize(value string) string
- func RemoveList(value string) string
- func RemoveSpoiler(value string) string
- func RemoveSub(value string) string
- func RemoveSup(value string) string
- type Artifact
- type Image
- type Note
- type Report
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertCodeToPre ¶
ConvertCodeToPre changes code tags to pre tags.
func ConvertCodeToQuote ¶
ConvertCodeToQuote changes code tags to quote tags.
func ConvertCollapseToComparison ¶
ConvertCollapseToComparison converts screenshot comparison collapses to BBCode comparisons.
func ConvertComparisonToCentered ¶
ConvertComparisonToCentered renders comparison blocks as centered screenshots.
func ConvertComparisonToCollapse ¶
ConvertComparisonToCollapse converts comparison blocks to spoilers.
func ConvertHideToSpoiler ¶
ConvertHideToSpoiler changes hide tags to spoiler tags.
func ConvertNamedSpoilerToNamedHide ¶
ConvertNamedSpoilerToNamedHide converts named spoilers to named hides.
func ConvertNamedSpoilerToNormalSpoiler ¶
ConvertNamedSpoilerToNormalSpoiler removes spoiler titles.
func ConvertPreToCode ¶
ConvertPreToCode changes pre tags to code tags.
func ConvertSpoilerToHide ¶
ConvertSpoilerToHide changes spoiler tags to hide tags.
func ConvertToAlign ¶
ConvertToAlign converts positional tags to align tags.
func IsOnlyTags ¶
IsOnlyTags reports whether value contains no text outside BBCode tags.
func NormalizeImageRawURL ¶
NormalizeImageRawURL expands supported thumbnail and viewer URLs to their full-size images, including image URLs wrapped by known wsrv proxies.
func NormalizeNewlines ¶
NormalizeNewlines decodes HTML entities and normalizes CRLF line endings.
func RemoveExtraLines ¶
RemoveExtraLines collapses three or more consecutive newlines.
func RemoveImageResize ¶
RemoveImageResize removes image tag attributes.
Types ¶
type Artifact ¶
type Artifact struct {
// Name is the suggested artifact filename.
Name string
// Kind categorizes the extracted artifact.
Kind string
// Content is the extracted artifact body.
Content string
}
Artifact contains auxiliary content extracted from a description.
type Image ¶
type Image struct {
// ImgURL is the BBCode-ready image URL, which may point at a thumbnail.
ImgURL string
// RawURL is the direct image URL.
RawURL string
// WebURL is the image host's browser-facing page URL when available.
WebURL string
// Host is the normalized image-host name, such as "imgbb" or "pixhost".
Host string
}
Image describes an image extracted while cleaning a BBCode description.
type Note ¶
type Note struct {
// Kind categorizes the note for downstream handling.
Kind string
// Message contains caller-visible detail about the condition.
Message string
}
Note reports a non-fatal condition encountered while cleaning a description.
type Report ¶
type Report struct {
// Description is the normalized BBCode that remains after cleanup.
Description string
// Images contains images removed or identified during cleanup.
Images []Image
// Notes contains non-fatal cleanup diagnostics.
Notes []Note
// Artifacts contains auxiliary files extracted from the description.
Artifacts []Artifact
}
Report contains a cleaned description and content extracted during cleanup.
func CleanPTPDescription ¶
CleanPTPDescription removes tracker links, embedded MediaInfo, unsupported blocks, and known uploader signatures from a PTP-style description. It returns extracted images separately, preserves comparison blocks byte for byte, and omits a cleaned body that is blank or contains only BBCode tags.
func CleanUnit3DDescription ¶
CleanUnit3DDescription removes site-local links and image markup from a Unit3D description, returning the first non-poster image set separately from the cleaned body.