config

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config provides types and functions for configuring the core Touch packages.

Index

Constants

This section is empty.

Variables

View Source
var Default = defaultConfig()

Default is the default Config.

Functions

This section is empty.

Types

type Aggregate

type Aggregate struct {
	Type     string   // which aggregator (aggregator name)
	Elements []string // allowed elements to aggregate from
}

Aggregate holds aggregator options.

type Aggregates

type Aggregates map[string]Aggregate

Aggregates is a map of aggregate names to Aggregates.

type Config

type Config struct {
	Templates  Templates
	Elements   Elements
	Aggregates Aggregates
}

Config holds abstracted options that can be used to configure the core Touch packages.

func ShallowMerge

func ShallowMerge(dst, src *Config) *Config

ShallowMerge merges src into dst but can only add or override whole objects. It does not support more granularity.

func (Config) ParseTemplates

func (c Config) ParseTemplates(t *template.Template, format string) (*template.Template, error)

ParseTemplates parses config templates that match the given format as template bodies for the given template.

type Element

type Element struct {
	Disabled  bool      // disabled=as if the element wasn't present
	Type      string    // node type or transformer name (e.g. walled, list)
	Delimiter string    // element delimiter
	Matcher   string    // prefixed element matcher name (e.g. url)
	Element   string    // transformer main element (list element)
	Target    string    // transformer target element (sticky target)
	Option    string    // extra option (primarily for one-off options)
	Templates Templates // map of formats to template strings
}

Element is an abstraction of parser.Element and transformer options.

type Elements

type Elements map[string]Element

Elements is a map of element names to Elements.

func (Elements) ParserElements

func (es Elements) ParserElements() parser.Elements

ParserElements returns the elements with a valid node type converted to parser.Elements.

type Templates

type Templates map[string]string

Templates is a map of formats to template strings.

Jump to

Keyboard shortcuts

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