roam

package
v0.0.0-...-56ccd80 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Unlicense Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	age.Context
	cli.Context
}

Context contains the necessary values to manage org documents.

func NewContext

func NewContext() Context

NewContext returns a new roam context.

type Directory

type Directory struct {
	// Stubs contains a list of all files store in the directory.
	Stubs []Stub
	// contains filtered or unexported fields
}

Directory stores a bunch of roam documents. It only stores stubs so the documents can be loaded as needed.

func LoadDirectory

func LoadDirectory(ctx Context, root string) (*Directory, error)

LoadDirectory returns a roam directory for the path given.

func (Directory) Stub

func (dir Directory) Stub(id uuid.UUID) (*Stub, bool)

Stub returns the stub with the given ID.

type Document

type Document struct {
	Stub
	org.Document
}

Document is an org roam document. The metadata nodes have been parsed into the struct.

func Open

func Open(ctx Context, path string) (*Document, error)

Open takes in a path and returns a paresd org roam document.

func OpenStub

func OpenStub(ctx Context, stub Stub) (*Document, error)

OpenStub opens the full document that a stub points to.

type Stub

type Stub struct {
	// ID is the UUID of the org document from the top level propery drawer.
	ID uuid.UUID

	// Title is the title of the roam note.
	Title string

	// Slug is the key used in URLs that point to the document.
	Slug string

	// Tags are the filetags found.
	Tags []string

	// Description is the description of the document. This is assumed to be all
	// paragraph blocks that occur before the first headline.
	Description string

	// LastUpdated holds when the document was last updated.
	LastUpdated time.Time

	// Path is the location on disk that holds the full document
	Path string
}

Stub holds meta information about a document and is able to open the full document.

func ParseStub

func ParseStub(ctx Context, doc org.Document) (*Stub, error)

ParseStub parses the metadata out of an org document and returns a stub.

Jump to

Keyboard shortcuts

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