Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.