Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type DedentRuleConfig
- type MapFileEndNode
- type MapFileNode
- type MapfileDirective
- type MapfileRuleConfig
- type MaprangeDirective
- type MaprangeRuleConfig
- type Node
- type Processor
- type ProcessorConfig
- type RangeImportRuleConfig
- type ReindentRuleConfig
- type Rule
- type RuleOptions
Constants ¶
View Source
const DefaultIndentLevel = 2
Variables ¶
View Source
var DefaultDedentSpaceRegEx = regexp.MustCompile(`^([\s]+)`)
View Source
var DefaultMapfileEndRegEx = regexp.MustCompile(`mapfile.end`)
View Source
var DefaultMapfileStartRegEx = regexp.MustCompile(`mapfile:([^\s]+)`)
View Source
var DefaultMaprangeEndRegEx = regexp.MustCompile(`maprange.end`)
View Source
var DefaultMaprangeStartRegEx = regexp.MustCompile(`maprange:([^\s]+)`)
View Source
var DefaultRangeImportEndRegEx = regexp.MustCompile(`range.end`)
View Source
var DefaultRangeImportStartRegEx = regexp.MustCompile(`range:(?P<Cue>[^\s]+)`)
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Mapfile *MapfileDirective `yaml:"mapfile"` Maprange *MaprangeDirective `yaml:"maprange"` }
func (*Config) ToProcessorConfig ¶
func (cfg *Config) ToProcessorConfig(ctx context.Context) (_ *ProcessorConfig, err error)
type DedentRuleConfig ¶
type MapFileEndNode ¶
type MapFileEndNode struct {
Node
}
type MapFileNode ¶
type MapfileDirective ¶
type MapfileDirective struct { StartRegExp string `yaml:"startRegExp"` EndRegExp string `yaml:"endRegExp"` DisableRewriteIndent bool `yaml:"disableRewriteIndent"` IndentWidth int `yaml:"indentWidth"` DefaultSkip int `yaml:"defaultSkip"` }
func (*MapfileDirective) LogValue ¶
func (d *MapfileDirective) LogValue() slog.Value
type MapfileRuleConfig ¶
type MaprangeDirective ¶
type MaprangeDirective struct { StartRegExp string `yaml:"startRegExp"` EndRegExp string `yaml:"endRegExp"` DisableDedent bool `yaml:"disableDedent"` DisableRewriteIndent bool `yaml:"disableRewriteIndent"` IndentWidth int `yaml:"indentWidth"` DefaultSkip int `yaml:"defaultSkip"` }
func (*MaprangeDirective) LogValue ¶
func (d *MaprangeDirective) LogValue() slog.Value
type MaprangeRuleConfig ¶
type Processor ¶
type Processor interface { Parse(ctx context.Context, filePath string, r io.Reader) ([]Node, error) ProcessFile(ctx context.Context, filePath string) (string, error) WithRules(ctx context.Context, rules []Rule) (Processor, error) }
func NewProcessor ¶
func NewProcessor(cfg *ProcessorConfig) (Processor, error)
type ProcessorConfig ¶
type RangeImportRuleConfig ¶
type ReindentRuleConfig ¶
type ReindentRuleConfig struct {
IndentLevel int
}
type Rule ¶
func NewDedentRule ¶
func NewDedentRule(cfg *DedentRuleConfig) (Rule, error)
func NewMapfileRule ¶
func NewMapfileRule(cfg *MapfileRuleConfig) (Rule, error)
func NewMaprangeRule ¶
func NewMaprangeRule(cfg *MaprangeRuleConfig) (Rule, error)
func NewRangeImportRule ¶
func NewRangeImportRule(cfg *RangeImportRuleConfig) (Rule, error)
func NewReindentRule ¶
func NewReindentRule(cfg *ReindentRuleConfig) (Rule, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.