beginning to implement the HTML Checker itself - incomplete

This commit is contained in:
2025-10-31 23:48:46 -06:00
parent 8a2185e912
commit f6ed77923c
4 changed files with 313 additions and 45 deletions
-43
View File
@@ -12,7 +12,6 @@ package htmlcheck
import (
_ "embed"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v3"
)
@@ -36,48 +35,6 @@ type HTMLCheckerConfig struct {
DisallowTags []string `yaml:"disallowTags"`
}
func (cfg *HTMLCheckerConfig) rezOutputFilters() []outputFilter {
rc := make([]outputFilter, 0, len(cfg.OutputFilters))
for i := range cfg.OutputFilters {
f, ok := outputFilterRegistry[cfg.OutputFilters[i]]
if ok {
rc = append(rc, f)
} else {
log.Errorf("filter %s is not found", cfg.OutputFilters[i])
}
}
return rc
}
func rezRewriters(desired []string) []rewriter {
rc := make([]rewriter, 0, len(desired))
for i := range desired {
r, ok := rewriterRegistry[desired[i]]
if ok {
rc = append(rc, r)
} else {
log.Errorf("rewriter %s is not found", desired[i])
}
}
return rc
}
func (cfg *HTMLCheckerConfig) rezStringRewriters() []rewriter {
return rezRewriters(cfg.StringRewriters)
}
func (cfg *HTMLCheckerConfig) rezWordRewriters() []rewriter {
return rezRewriters(cfg.WordRewriters)
}
func (cfg *HTMLCheckerConfig) rezTagRewriters() []rewriter {
return rezRewriters(cfg.TagRewriters)
}
func (cfg *HTMLCheckerConfig) rezParenRewriters() []rewriter {
return rezRewriters(cfg.ParenRewriters)
}
// HTMLCheckerConfigFile represents all the configs as they exist in the file.
type HTMLCheckerConfigFile struct {
Configs []HTMLCheckerConfig `yaml:"configs"`