From 6fb27781f9e6a992111fce91c8ffe67b496097e2 Mon Sep 17 00:00:00 2001 From: Kristian Borgwarth <10348902@pm.me> Date: Mon, 6 Apr 2026 22:41:46 +0200 Subject: [PATCH] ref(file_handling): consolidate modules related to file content manipulation --- core/file_handling/doc.go | 2 ++ .../parser.go => file_handling/frontmatter_parser.go} | 2 +- core/{frontmatter => file_handling}/slug.go | 2 +- core/{template => file_handling}/templater.go | 2 +- core/frontmatter/doc.go | 2 -- core/handlers/create_note_handler.go | 6 +++--- core/template/doc.go | 2 -- 7 files changed, 8 insertions(+), 10 deletions(-) create mode 100644 core/file_handling/doc.go rename core/{frontmatter/parser.go => file_handling/frontmatter_parser.go} (97%) rename core/{frontmatter => file_handling}/slug.go (93%) rename core/{template => file_handling}/templater.go (97%) delete mode 100644 core/frontmatter/doc.go delete mode 100644 core/template/doc.go diff --git a/core/file_handling/doc.go b/core/file_handling/doc.go new file mode 100644 index 0000000..f5f2eff --- /dev/null +++ b/core/file_handling/doc.go @@ -0,0 +1,2 @@ +// Package filehandling provides utilities for handling files, including reading, writing, and manipulating file contents. +package filehandling diff --git a/core/frontmatter/parser.go b/core/file_handling/frontmatter_parser.go similarity index 97% rename from core/frontmatter/parser.go rename to core/file_handling/frontmatter_parser.go index 9bcb523..1216b36 100644 --- a/core/frontmatter/parser.go +++ b/core/file_handling/frontmatter_parser.go @@ -1,4 +1,4 @@ -package frontmatter +package filehandling import ( "bytes" diff --git a/core/frontmatter/slug.go b/core/file_handling/slug.go similarity index 93% rename from core/frontmatter/slug.go rename to core/file_handling/slug.go index 894b782..11676f4 100644 --- a/core/frontmatter/slug.go +++ b/core/file_handling/slug.go @@ -1,4 +1,4 @@ -package frontmatter +package filehandling import ( "bytes" diff --git a/core/template/templater.go b/core/file_handling/templater.go similarity index 97% rename from core/template/templater.go rename to core/file_handling/templater.go index aee4505..c5aab0c 100644 --- a/core/template/templater.go +++ b/core/file_handling/templater.go @@ -1,4 +1,4 @@ -package template +package filehandling import ( "os" diff --git a/core/frontmatter/doc.go b/core/frontmatter/doc.go deleted file mode 100644 index b723de9..0000000 --- a/core/frontmatter/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package frontmatter contains utilities for parsing front matter from documents. -package frontmatter diff --git a/core/handlers/create_note_handler.go b/core/handlers/create_note_handler.go index 35d049a..416d818 100644 --- a/core/handlers/create_note_handler.go +++ b/core/handlers/create_note_handler.go @@ -5,7 +5,7 @@ import ( "encoding/json" "path/filepath" - "github.com/KristianJBorgwarth/dendrite.daemon/core/frontmatter" + filehandling "github.com/KristianJBorgwarth/dendrite.daemon/core/file_handling" "github.com/KristianJBorgwarth/dendrite.daemon/core/models" "github.com/KristianJBorgwarth/dendrite.daemon/core/template" "github.com/KristianJBorgwarth/dendrite.daemon/core/utils" @@ -34,7 +34,7 @@ func (h *CreateNoteHandler) Handle(ctx context.Context, raw json.RawMessage) (an return nil, err } - slug := frontmatter.Slugify(cmd.Title) + slug := filehandling.Slugify(cmd.Title) var templatePath string if cmd.TemplateName != "" { @@ -48,7 +48,7 @@ func (h *CreateNoteHandler) Handle(ctx context.Context, raw json.RawMessage) (an return nil, err } - tags, err := frontmatter.ParseTags(data) + tags, err := filehandling.ParseTags(data) if err != nil { return nil, err } diff --git a/core/template/doc.go b/core/template/doc.go deleted file mode 100644 index 66c2031..0000000 --- a/core/template/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package template provides implementations for generating notes from templates -package template