feat: renderer

This commit is contained in:
2025-08-19 17:20:24 +02:00
parent 6db87db325
commit 210b31aef8
38 changed files with 727 additions and 299 deletions

View File

@@ -70,8 +70,6 @@ func parseShortTemplate(input string) (Block, error) {
optionSplit := strings.SplitSeq(split[1], ",")
for option := range optionSplit {
switch strings.TrimSpace(option) {
case "required":
block.Required = true
case "number":
block.Codec = CodecNumber
}
@@ -84,17 +82,17 @@ func parseShortTemplate(input string) (Block, error) {
type yamlBlock struct {
Path string `yaml:"path"`
Codec string `yaml:"codec"`
Required bool `yaml:"required,omitempty"`
Value any `yaml:"value,omitempty"`
Fields []yamlField `yaml:"fields"`
ListTemplate string `yaml:"listTemplate,omitempty"`
Hidden bool `yaml:"hidden,omitempty"`
}
type yamlField struct {
Path string `yaml:"path"`
Value any `yaml:"value,omitempty"`
Codec string `yaml:"codec"`
Required bool `yaml:"required"`
Path string `yaml:"path"`
Value any `yaml:"value,omitempty"`
Codec string `yaml:"codec"`
Hidden bool `yaml:"hidden,omitempty"`
}
func parseYamlTemplate(input string) (block Block, err error) {
@@ -141,8 +139,8 @@ func parseYamlTemplate(input string) (block Block, err error) {
fields = append(fields, BlockField{
Path: field.Path,
CodecType: fieldCodec,
Required: field.Required,
Value: field.Value,
Hidden: field.Hidden,
})
}