jd

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JohnnyDecimalFilePattern = regexp.MustCompile(`^(\d{2})\.(\d{2})(\+\S+)?`)

JohnnyDecimalFilePattern matches a Johnny Decimal filename prefix like "15.23" or "15.23+JEM".

Functions

This section is empty.

Types

type JohnnyDecimal

type JohnnyDecimal struct {
	Area     string // Area range, e.g. "10-19"
	Category string // Category number, e.g. "15"
	ID       string // Full ID, e.g. "15.23"
	SubID    string // Optional sub-ID, e.g. "+JEM" or "+0001"
}

JohnnyDecimal represents a parsed Johnny Decimal ID with optional sub-ID.

func Parse

func Parse(filename string) (*JohnnyDecimal, error)

Parse parses a filename prefix like "15.23" or "15.23+JEM" and returns a JohnnyDecimal object. Returns an error if the filename does not match the Johnny Decimal pattern.

func (*JohnnyDecimal) EnsureFolders

func (jd *JohnnyDecimal) EnsureFolders(root string) (string, error)

EnsureFolders ensures the folder structure for the JohnnyDecimal object exists under root. It creates folders for Area, Category, ID, and optionally the SubID (extension). Returns the final folder path.

func (*JohnnyDecimal) FolderPath

func (jd *JohnnyDecimal) FolderPath() []string

FolderPath returns the folder path segments for this JohnnyDecimal object (Area, Category, ID).

func (*JohnnyDecimal) String

func (jd *JohnnyDecimal) String() string

String returns a formatted string representation of the JohnnyDecimal object for debugging.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL