tree

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultNodeKind = NodeKind("site")
View Source
const SiteNodeKind = NodeKind("site")

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseNode

type BaseNode struct {
	// contains filtered or unexported fields
}

func NewBaseNode

func NewBaseNode(path string, isDir bool) BaseNode

func (*BaseNode) AddAttrs

func (s *BaseNode) AddAttrs(key string, attrs any) error

func (*BaseNode) AppendChild

func (s *BaseNode) AppendChild(n Node)

func (*BaseNode) Attributes

func (s *BaseNode) Attributes() (map[string]map[string]any, error)

func (*BaseNode) Children

func (s *BaseNode) Children() []Node

func (*BaseNode) GetAttrs

func (s *BaseNode) GetAttrs(key string) (map[string]any, bool)

func (*BaseNode) IsDir

func (s *BaseNode) IsDir() bool

func (*BaseNode) Path

func (s *BaseNode) Path() string

type DefaultDir

type DefaultDir struct {
	BaseNode
}

func (*DefaultDir) Kind

func (*DefaultDir) Kind() NodeKind

type DefaultPage

type DefaultPage struct {
	BaseNode
	Parts PageNameParts
}

func NewDefaultPage

func NewDefaultPage(path string, parts PageNameParts) *DefaultPage

func (*DefaultPage) Kind

func (*DefaultPage) Kind() NodeKind

type Node

type Node interface {
	Kind() NodeKind
	Path() string
	IsDir() bool
	Children() []Node
	AppendChild(Node)
	AddAttrs(key string, attrs any) error
	GetAttrs(key string) (map[string]any, bool)
	Attributes() (map[string]map[string]any, error)
}

type NodeAttributes

type NodeAttributes struct {
	// contains filtered or unexported fields
}

func (*NodeAttributes) Add

func (a *NodeAttributes) Add(namespace any, attributes any) error

func (*NodeAttributes) Get

func (a *NodeAttributes) Get(namespace any) (map[string]any, bool)

func (*NodeAttributes) GetAll

func (a *NodeAttributes) GetAll(namespace any) ([]map[string]any, bool)

func (*NodeAttributes) Map

func (a *NodeAttributes) Map() (map[string]map[string]any, error)

type NodeKind

type NodeKind string

func (NodeKind) String

func (nk NodeKind) String() string

type PageFrontMatter

type PageFrontMatter struct {
	Title    string            `yaml:"title" mapstructure:"title"`
	Meta     []*PageMetaValue  `yaml:"meta" mapstructure:"meta"`
	Links    []*PageLinksValue `yaml:"links" mapstructure:"links"`
	Template string            `yaml:"template" mapstructure:"template"`
}

type PageLinksValue

type PageLinksValue struct {
	Rel  *string `yaml:"rel" mapstructure:"rel"`
	Href *string `yaml:"href" mapstructure:"href"`
	Type *string `yaml:"type" mapstructure:"type"`
	Page *string `yaml:"page" mapstructure:"page"`
	As   *string `yaml:"as" mapstructure:"as"`
}

type PageMetaValue

type PageMetaValue struct {
	Title    *string `yaml:"title" mapstructure:"title"`
	Property *string `yaml:"property" mapstructure:"property"`
	Content  *string `yaml:"content" mapstructure:"content"`
	Name     *string `yaml:"name" mapstructure:"name"`
}

type PageNameParts

type PageNameParts struct {
	Raw   string
	Ext   string
	Kind  string
	Slug  string
	Extra []string
}

func GetEntryNameParts

func GetEntryNameParts(name string) (PageNameParts, bool)

type Site

type Site struct {
	BaseNode
}

Root node

func (*Site) Kind

func (*Site) Kind() NodeKind

Jump to

Keyboard shortcuts

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