Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultLoadYaml(file string) []byte
- func EnsureUniqueTitles(yrs []*YamlResource) error
- func GetAnchor(spaceDir string) string
- func GlobYaml(glob string) string
- func IsYamlFile(file string) bool
- func PrettyPrint(target RenderTarget, page *Page, w *os.File)
- func PrettyPrintYaml(node *yaml.Node, w io.Writer)
- type Ancestor
- type Asset
- type ChangeType
- type Encoder
- type Hook
- type HookConfig
- type HookProcessor
- type HookSet
- type IAsset
- type JqCommand
- type KindAndTitle
- type Labels
- type ListFiles
- type Ls
- type LsCache
- type Page
- func (parent *Page) AppendChild(p *Page) *Page
- func (p *Page) GetAncestorId() string
- func (p *Page) GetChangeType() ChangeType
- func (p *Page) GetChildByTitle(title string) *Page
- func (p *Page) GetChildren() []*Page
- func (p *Page) GetContent() string
- func (p *Page) GetId() string
- func (p *Page) GetIncrementedVersion() int
- func (p *Page) GetKeyArray() []string
- func (p *Page) GetLabels() []string
- func (p *Page) GetParent() *Page
- func (p *Page) GetRemoteId() string
- func (p *Page) GetRemoteSha256Version() int
- func (p *Page) GetRemoteVersion() int
- func (p *Page) GetSha256Property() Property
- func (p *Page) GetTitle() string
- func (p *Page) IsRoot() bool
- func (p *Page) IsUpdate() bool
- func (p *Page) LabelsDiffer() bool
- func (p *Page) Sha256Differs() bool
- type PageContent
- type PageTree
- func (pt *PageTree) AddPage(yr *YamlResource)
- func (pt *PageTree) AddRemotes(remotes []*RemoteResource)
- func (pt *PageTree) GetAnchor() string
- func (pt *PageTree) GetChanges() [][]PageUpdate
- func (pt *PageTree) GetLevels() [][]string
- func (pt *PageTree) GetPage(key string) *Page
- func (pt *PageTree) GetPageFromTitlePath(titles []string) *Page
- func (pt *PageTree) GetPages() []*Page
- func (pt *PageTree) HasAnchor() bool
- func (pt *PageTree) SetAnchor(id string)
- type PageUpdate
- type Property
- type RemoteResource
- type RemoteSha256
- type RenderTarget
- type RenderTools
- type Template
- type TemplateProcessor
- type YamlResource
- type YamlResourceLoader
- type YqHooks
Constants ¶
View Source
const ( YAML = 1 << iota JSON MST )
Variables ¶
Functions ¶
func DefaultLoadYaml ¶
func EnsureUniqueTitles ¶
func EnsureUniqueTitles(yrs []*YamlResource) error
func IsYamlFile ¶
func PrettyPrint ¶
func PrettyPrint(target RenderTarget, page *Page, w *os.File)
func PrettyPrintYaml ¶
Types ¶
type Asset ¶
type Asset struct {
// contains filtered or unexported fields
}
func (Asset) ReadString ¶
type Hook ¶
type Hook struct { Asset IAsset Config *HookConfig }
type HookConfig ¶
type HookConfig struct { Target string `yaml:"target"` Priority int `yaml:"priority"` ListFiles ListFiles `yaml:"listFiles"` Defaults yaml.Node `yaml:"defaults"` Overrides yaml.Node `yaml:"overrides"` Merges yaml.Node `yaml:"merges"` YqWhile string `yaml:"yqWhile"` Yq []string `yaml:"yq"` Jq []string `yaml:"jq"` Header string `yaml:"header"` }
type HookProcessor ¶
type HookProcessor struct {
// contains filtered or unexported fields
}
func NewHookProcessor ¶
func NewHookProcessor(hooksDir string, precompile bool) *HookProcessor
func (*HookProcessor) Get ¶
func (hp *HookProcessor) Get(hookName string) *Hook
func (*HookProcessor) GetAll ¶
func (hp *HookProcessor) GetAll() []*Hook
func (*HookProcessor) GetHookSet ¶
func (hp *HookProcessor) GetHookSet(kind string) HookSet
func (*HookProcessor) GetHooks ¶
func (hp *HookProcessor) GetHooks(kind string) []*Hook
type IAsset ¶
type IAsset interface { GetName() string GetPath() string IsBuiltin() bool ReadString() string ReadBytes() []byte }
func GetBuiltinHooks ¶
func GetBuiltinHooks() []IAsset
func GetBuiltinTemplates ¶
func GetBuiltinTemplates() []IAsset
type KindAndTitle ¶
type Page ¶
type Page struct { Key string Resource *YamlResource Content PageContent Remote *RemoteResource Parent *Page // childrenByTitle map[string]*Page Children []*Page }
func NewPage ¶
func NewPage(key string, yr *YamlResource) *Page
func (*Page) AppendChild ¶
func (*Page) GetAncestorId ¶
func (*Page) GetChangeType ¶
func (p *Page) GetChangeType() ChangeType
func (*Page) GetChildByTitle ¶
func (*Page) GetChildren ¶
func (*Page) GetContent ¶
func (*Page) GetIncrementedVersion ¶
func (*Page) GetKeyArray ¶
func (*Page) GetRemoteId ¶
func (*Page) GetRemoteSha256Version ¶
func (*Page) GetRemoteVersion ¶
func (*Page) GetSha256Property ¶
func (*Page) LabelsDiffer ¶
func (*Page) Sha256Differs ¶
type PageContent ¶
type PageTree ¶
type PageTree struct {
// contains filtered or unexported fields
}
func NewPageTree ¶
func NewPageTree(yr []*YamlResource, anchor string) *PageTree
func (*PageTree) AddPage ¶
func (pt *PageTree) AddPage(yr *YamlResource)
func (*PageTree) AddRemotes ¶
func (pt *PageTree) AddRemotes(remotes []*RemoteResource)
func (*PageTree) GetChanges ¶
func (pt *PageTree) GetChanges() [][]PageUpdate
func (*PageTree) GetPageFromTitlePath ¶
type PageUpdate ¶
type PageUpdate struct { Operation ChangeType Page *Page }
type Property ¶
type Property struct {
// contains filtered or unexported fields
}
func NewProperty ¶
func (Property) GetIncrementedVersion ¶
type RemoteResource ¶
type RemoteResource struct { Id string Title string Labels []string Link string Version int Ancestors []Ancestor Sha256 RemoteSha256 }
func (*RemoteResource) GetTitlePath ¶
func (rr *RemoteResource) GetTitlePath(anchorId string) []string
type RemoteSha256 ¶
type RenderTarget ¶
type RenderTarget uint32
type RenderTools ¶
type RenderTools struct {
// contains filtered or unexported fields
}
func NewRenderTools ¶
func NewRenderTools(dirProps utils.DirectoryProperties, precompileJqHooks bool) *RenderTools
func (*RenderTools) RenderAll ¶
func (rt *RenderTools) RenderAll(pt *PageTree)
func (*RenderTools) RenderTo ¶
func (rt *RenderTools) RenderTo(target RenderTarget, p *Page)
type TemplateProcessor ¶
type TemplateProcessor struct {
// contains filtered or unexported fields
}
func NewTemplateProcessor ¶
func NewTemplateProcessor(templatesDir string) *TemplateProcessor
func (TemplateProcessor) GetAll ¶
func (tp TemplateProcessor) GetAll() []Template
type YamlResource ¶
func LoadSingleYamlResource ¶
func LoadSingleYamlResource(file string) *YamlResource
func LoadYamlResources ¶
func LoadYamlResources(dir string) []*YamlResource
func NewYamlResource ¶
func NewYamlResource(path string, node *yaml.Node) *YamlResource
func (*YamlResource) GetLabels ¶
func (yr *YamlResource) GetLabels() []string
func (*YamlResource) GetParentPath ¶
func (yr *YamlResource) GetParentPath() string
func (*YamlResource) ToObject ¶
func (yr *YamlResource) ToObject() map[string]interface{}
func (*YamlResource) ToOrderedMap ¶
func (yr *YamlResource) ToOrderedMap() orderedjson.Map
func (*YamlResource) UpdateJson ¶
func (yr *YamlResource) UpdateJson()
func (*YamlResource) UpdateKindAndTitle ¶
func (yr *YamlResource) UpdateKindAndTitle()
this is ugly, but it works for now
type YamlResourceLoader ¶
type YamlResourceLoader struct { Walk func(root string, fn filepath.WalkFunc) error LoadYaml func(file string) []byte }
func DefaultYamlResourceLoader ¶
func DefaultYamlResourceLoader() YamlResourceLoader
func (YamlResourceLoader) LoadYamlResource ¶
func (yrl YamlResourceLoader) LoadYamlResource(spaceRootDir, relFilePath string) *YamlResource
Click to show internal directories.
Click to hide internal directories.