token

package
v0.1.4-0...-8b98d0b Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingArgument error returned when and argument is missing in token.
	ErrMissingArgument = errors.New("missing argument")
	// ErrUnknownTokenType error returned when token type is not recognised by
	// token parser.
	ErrUnknownTokenType = errors.New("unknown token type")
)

ErrMissingArgument error returned when and argument is missing in token.

View Source
var ErrUnknownTimeTokenOperation = errors.New("unknown opperation")

ErrUnknownTimeTokenOperation unknown time token opp.

Functions

This section is empty.

Types

type Token

type Token struct {
	Type Type
	Args map[string]string
}

Token describes a single rat token. Rat tokens are special html tab like strings that when present nodes content have special handling. Mode detailed explication of what each token type does is available at TokenType constat's definitions comments. Tokens are in form of: <rat type key=value key=value> - type - the tokens type - key=value - 0 or more key value pairs.

func Parse

func Parse(raw string) (*Token, error)

Parse attempts to parse a new woken from raw string. The raw string commes from rat markdown AST parser and should not have start and end markers.

func (*Token) Render

func (t *Token) Render(
	root *jsonast.AstPart,
	rootMarkdownNode ast.Node,
	n *graph.Node,
	p graph.Provider,
	resolver *urlresolve.Resolver,
	r jsonast.Renderer,
) error

Render renders a token to JSON AST.

type Type

type Type string

Type describes rat token types.

const (
	// Graph tokens provide an overview of a nodes child nodes.
	// Graph tokens get substituted with a list tree of links to child nodes of
	// specified depth. Unlimited depth if omitted.
	Graph Type = "graph"
	// Todo searches for todos in child nodes and collects them
	// into a large singular todo. Token args can be used to specify search
	// options.
	//
	//nolint:godox
	Todo Type = "todo"
	// Kanban tokens provide a kanban board of child nodes.
	Kanban Type = "kanban"
	// Embed tokens allow embeding links.
	Embed Type = "embed"
	// Version token renders the rat server version as a in line code ast node.
	Version Type = "version"
	// Time token renders the result of different time calculations.
	Time Type = "time"
	// Graphic token renders a grapical representation of a nodes subgraph.
	Graphic Type = "graphic"
	// ToC token renders a table of contents of a node.
	ToC Type = "toc"
)

Jump to

Keyboard shortcuts

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