feat: refactor some shit
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user