feat: refactor some shit

This commit is contained in:
Max Richter
2025-08-17 00:46:45 +02:00
parent 43644c4f40
commit cc8f967f07
20 changed files with 459 additions and 209 deletions

View File

@@ -1,17 +1,15 @@
// Package parser provides functions for parsing Markdown templates into
// structured JSON objects that conform to a JSON Schema.
package parser
func ParseFile(markdownContent string) (map[string]any, error) {
func Parse(blocks []MatchBlock) map[string]any {
// _schema, err := registry.GetTemplate("Recipe")
// if err != nil {
// return nil, fmt.Errorf("could not get schema: %w", err)
// }
result := make(map[string]any)
// Idea is to split the template into blocks, either "matching" blocks which are simple strings.
// Or "data" blocks which match the content. Then i want to soft match the "matching" blocks and "data" blocks to the template.
// The "matching" blocks should soft match with a levenshtein distance
for _, b := range blocks {
input := b.GetContent()
return map[string]any{}, nil
key, value, _ := b.Block.Parse(input)
result[key] = value
}
return result
}