internal

package
v0.0.0-...-9fe6296 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// YYYY-MM-DD: 2022-03-23
	YYYYMMDD = "2006-01-02"
	// 24h hh:mm:ss: 14:23:20
	HHMMSS24h = "15:04:05"
)

Variables

This section is empty.

Functions

func GetYaml

func GetYaml(str string) string

func IncludeNote

func IncludeNote(filters map[string]string, note Node, logger *log.Logger) bool

func MDToHTML

func MDToHTML(input []byte) (string, error)

func NewCollector

func NewCollector(root, ext string) *collector

func NewNoteService

func NewNoteService(logger *log.Logger, repo NodeRepository) *noteService

func NewSearcher

func NewSearcher(nodes []FileNode) *searcher

func NewTemplateParser

func NewTemplateParser(pathTmp, templateName string) *parser

func NewTimeId

func NewTimeId() string

func ParseNodeToHTML

func ParseNodeToHTML(node FileNode, templateFile string) ([]byte, error)

Types

type FileNode

type FileNode struct {
	Filename string
	Path     string
	Content  []byte
	Parent   string
	Size     int64
	Meta     Meta
}
func (n *FileNode) Links() ([]string, error)

func (*FileNode) Name

func (n *FileNode) Name() string

func (*FileNode) ToMap

func (n *FileNode) ToMap() map[string]string

type Filter

type Filter struct {
	Field string
	Value string
}

type INode

type INode interface {
	Name() string
}

type Meta

type Meta struct {
	Title string
	Tags  any
}

type Metadata

type Metadata struct {
	Title string
	Tags  string
}

func ExtractMetadata

func ExtractMetadata(content string) (Metadata, error)

func (*Metadata) GetTags

func (m *Metadata) GetTags() []string

func (*Metadata) IncludeTags

func (m *Metadata) IncludeTags(str string) bool

Include tags check that all tags are included in the metadata

type Node

type Node struct {
	Id      int32
	Title   string
	Content string
	Type    NodeType
	// contains filtered or unexported fields
}

func NewNote

func NewNote(title, content string) (Node, error)

type NodeRepository

type NodeRepository interface {
	Save(Node) error
	GetNodes() ([]Node, error)
}

func NewFsRepo

func NewFsRepo(logger *log.Logger, dirRoot string) NodeRepository

func NewSqliteNodeRepo

func NewSqliteNodeRepo(path string) NodeRepository

type NodeType

type NodeType string
const (
	TypeNote NodeType = "note"
)

type NoteService

type NoteService interface {
	New(title, content string) (Node, error)
	ListAll() ([]Node, error)
	ListAllTags() (map[string]int, error)
	GetByTitle(title string) (Node, error)
	Find([]Filter) ([]Node, error)
}

type Searcher

type Searcher interface {
	File(filename string) (FileNode, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL