aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/index/index.go
diff options
context:
space:
mode:
authorJP Appel <jeanpierre.appel01@gmail.com>2025-08-02 14:04:45 -0400
committerJP Appel <jeanpierre.appel01@gmail.com>2025-08-02 14:04:45 -0400
commitf14c466d5d5d1f1a68153162349a74a154bcb535 (patch)
tree1b2c9723f4c1f73a92b6ce544c96bae35ebcc9fe /pkg/index/index.go
parent6a65be22a5e3434e8ca925ec40162c560e1dd612 (diff)
Add initial todos for new heading category
The heading category is planned to be backed by a single db text column. The column will be a concatenation of all ATX style heading matches, with a newline delimiter.
Diffstat (limited to 'pkg/index/index.go')
-rw-r--r--pkg/index/index.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/index/index.go b/pkg/index/index.go
index b354bbf..b79ef2f 100644
--- a/pkg/index/index.go
+++ b/pkg/index/index.go
@@ -23,6 +23,7 @@ import (
var ErrHeaderParse error = errors.New("Unable to parse YAML header")
var linkRegex *regexp.Regexp
+// TODO: add headings field
type Document struct {
Path string `yaml:"-" json:"path"`
Title string `yaml:"title" json:"title"`
@@ -41,6 +42,7 @@ type ParseOpts struct {
IgnoreDateError bool
IgnoreMetaError bool
IgnoreHidden bool
+ // TODO: add IgnoreHeadings
}
type InfoPath struct {
@@ -75,6 +77,7 @@ var _ yaml.BytesMarshaler = (*Document)(nil)
func (doc *Document) MarshalYAML() ([]byte, error) {
return yaml.Marshal(yaml.MapSlice{
{Key: "path", Value: doc.Path},
+ // TODO: add headings
{Key: "title", Value: doc.Title},
{Key: "date", Value: doc.Date},
{Key: "filetime", Value: doc.FileTime},
@@ -209,6 +212,7 @@ func (doc Document) Equal(other Document) bool {
}
}
+ // TODO: handle headings
return true
}
@@ -377,6 +381,7 @@ func NewDocCmp(field string, reverse bool) (func(*Document, *Document) int, bool
return func(a, b *Document) int {
return descMod * strings.Compare(a.OtherMeta, b.OtherMeta)
}, true
+ // TODO: add headings
}
return nil, false
@@ -408,6 +413,7 @@ func ParseDoc(path string, opts ParseOpts) (*Document, error) {
return nil, errors.Join(ErrHeaderParse, err)
}
+ // TODO: parse headings simultaneously with links
if opts.ParseLinks {
var buf bytes.Buffer
f.Seek(pos, io.SeekStart)