Added String() implementation to Bible reference type.

This commit is contained in:
Benjamin A. Shelton 2026-10-09 11:09:57 -06:00
commit aa5615814a
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01

View file

@ -7,6 +7,7 @@ import (
"io"
"os"
"path/filepath"
"strconv"
"strings"
)
@ -86,6 +87,34 @@ func (r *BibleRef) Code() string {
return ""
}
func (r *BibleRef) String() string {
sb := &strings.Builder{}
if name, ok := titles[r.Code()]; ok {
sb.WriteString(name)
} else {
sb.WriteString("???")
}
sb.WriteString(" ")
if r.Chapter > 0 {
sb.WriteString(strconv.Itoa(r.Chapter))
}
if r.Verse > 0 {
sb.WriteString(strconv.Itoa(r.Verse))
} else {
if r.Verses.Start > 0 {
sb.WriteString(strconv.Itoa(r.Verses.Start))
if r.Verses.Stop > 0 {
} else {
}
}
}
return sb.String()
}
type Metadata struct {
ID string `json:"id"`
Name string `json:"name"`