aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/index.go
diff options
context:
space:
mode:
authorJP Appel <jeanpierre.appel01@gmail.com>2025-08-05 12:03:32 -0400
committerJP Appel <jeanpierre.appel01@gmail.com>2025-08-05 12:03:32 -0400
commit62aeb1a0fb0a239f6193b7cb872787578480082c (patch)
tree889b9e3c3f27cbac2be335e30076a51fb548334a /cmd/index.go
parentf14c466d5d5d1f1a68153162349a74a154bcb535 (diff)
Add header parsing and improved link parsing
Diffstat (limited to 'cmd/index.go')
-rw-r--r--cmd/index.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd/index.go b/cmd/index.go
index f3fa23f..5183870 100644
--- a/cmd/index.go
+++ b/cmd/index.go
@@ -21,12 +21,17 @@ type IndexFlags struct {
func SetupIndexFlags(args []string, fs *flag.FlagSet, flags *IndexFlags) {
flags.ParseLinks = true
flags.ParseMeta = true
+ flags.ParseHeadings = true
fs.BoolVar(&flags.IgnoreDateError, "ignoreBadDates", false, "ignore malformed dates while indexing")
fs.BoolVar(&flags.IgnoreMetaError, "ignoreMetaError", false, "ignore errors while parsing general YAML header info")
fs.BoolFunc("ignoreMeta", "only parse title, authors, date, tags from YAML headers", func(s string) error {
flags.ParseMeta = false
return nil
})
+ fs.BoolFunc("ignoreHeadings", "don't parse file contents for section headings", func(s string) error {
+ flags.ParseHeadings = false
+ return nil
+ })
fs.BoolFunc("ignoreLinks", "don't parse file contents for links", func(s string) error {
flags.ParseLinks = false
return nil
@@ -126,6 +131,3 @@ func RunIndex(gFlags GlobalFlags, iFlags IndexFlags, db *data.Query) byte {
return 0
}
-
-func init() {
-}