sz

package
v0.0.0-...-6f32e74 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: EUPL-1.2 Imports: 8 Imported by: 2

Documentation

Overview

Package sz contains zettel data handling as sx expressions.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Symbols for Metanodes
	SymMeta = sx.MakeSymbol("META")

	// Constant symbols for reference states.
	SymRefStateZettel = sx.MakeSymbol("ZETTEL")
	SymRefStateFound  = sx.MakeSymbol("FOUND")
	SymRefStateBroken = sx.MakeSymbol("BROKEN")
	SymRefStateBased  = sx.MakeSymbol("BASED")
	SymRefStateQuery  = sx.MakeSymbol("QUERY")

	// Symbols for metadata types.
	SymTypeCredential = sx.MakeSymbol("CREDENTIAL")
	SymTypeEmpty      = sx.MakeSymbol("EMPTY-STRING")
	SymTypeID         = sx.MakeSymbol("ZID")
	SymTypeIDSet      = sx.MakeSymbol("ZID-SET")
	SymTypeNumber     = sx.MakeSymbol("NUMBER")
	SymTypeString     = sx.MakeSymbol("STRING")
	SymTypeTagSet     = sx.MakeSymbol("TAG-SET")
	SymTypeTimestamp  = sx.MakeSymbol("TIMESTAMP")
	SymTypeURL        = sx.MakeSymbol("URL")
	SymTypeWord       = sx.MakeSymbol("WORD")
)

Various constants for Zettel data. They are technically variables. These are only Zettelstore-specific symbols. The more general symbols are defined in t73f.de/r/zsx

Functions

func GetReference

func GetReference(ref *sx.Pair) (*sx.Symbol, string)

GetReference returns the reference symbol and value.

func MakeReference

func MakeReference(sym *sx.Symbol, val string) *sx.Pair

MakeReference builds a reference node.

func ParseNoneBlocks

func ParseNoneBlocks(*input.Input) *sx.Pair

ParseNoneBlocks parses no block.

func ParsePlainBlocks

func ParsePlainBlocks(inp *input.Input, syntax string) *sx.Pair

ParsePlainBlocks parses the block as plain text with the given syntax.

func ScanReference

func ScanReference(s string) *sx.Pair

ScanReference scans a string and returns a reference.

This function is very specific for Zettelstore.

Types

type Meta

type Meta map[string]MetaValue

Meta map metadata keys to MetaValue.

func GetMetaContent

func GetMetaContent(zettel sx.Object) (Meta, *sx.Pair)

GetMetaContent returns the metadata and the content of a sz encoded zettel.

func MakeMeta

func MakeMeta(obj sx.Object) Meta

MakeMeta build a Meta based on a list of metadata objects.

func (Meta) GetPair

func (m Meta) GetPair(key string) *sx.Pair

GetPair return the metadata value associated with the given key, as a list of objects.

func (Meta) GetString

func (m Meta) GetString(key string) string

GetString return the metadata string value associated with the given key.

type MetaValue

type MetaValue struct {
	Type  string
	Key   string
	Value sx.Object
}

MetaValue is an extended metadata value:

  • Type: the type assiciated with the metata key
  • Key: the metadata key itself
  • Value: the metadata value as an (sx-) object.

Directories

Path Synopsis
Package zmk provides a parser for zettelmarkup.
Package zmk provides a parser for zettelmarkup.

Jump to

Keyboard shortcuts

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