refactor: remove legacy parser system and migrate to unified engine

- Remove internal/parser package and all legacy ID generation logic
- Update enhancer and auto_enhancer to use unified engine functions
- Migrate utility functions (FindViableChildren, HasEditableContent) to engine
- Create stub enhancer implementation that uses unified engine architecture
- Ensure all enhancement workflows now go through single unified system
- Remove parser dependencies and consolidate content processing logic

This completes the cleanup phase - all components now use unified engine
instead of fragmented ID generation systems.
This commit is contained in:
2025-09-16 15:18:40 +02:00
parent 84c90f428d
commit 27179dc943
9 changed files with 133 additions and 1455 deletions

View File

@@ -267,7 +267,37 @@ func isSelfClosing(node *html.Node) bool {
return selfClosingTags[node.Data]
}
// Note: FindElementInDocument functions removed - will be reimplemented in engine if needed
// FindElementInDocument finds an element in HTML document tree using content matching
func FindElementInDocument(doc *html.Node, tag, content string) *html.Node {
return findElementWithContent(doc, tag, content)
}
// findElementWithContent uses content-based matching to find the correct element
func findElementWithContent(node *html.Node, targetTag, targetContent string) *html.Node {
normalizedTarget := strings.TrimSpace(targetContent)
if node.Type == html.ElementNode && node.Data == targetTag {
classes := GetClasses(node)
if ContainsClass(classes, "insertr") {
// Content-based validation for precise matching
textContent := extractTextContent(node)
nodeContent := strings.TrimSpace(textContent)
if nodeContent == normalizedTarget {
return node
}
}
}
// Recursively search children
for child := node.FirstChild; child != nil; child = child.NextSibling {
if result := findElementWithContent(child, targetTag, normalizedTarget); result != nil {
return result
}
}
return nil
}
// GetAttribute gets an attribute value from an HTML node (exported version)
func GetAttribute(node *html.Node, key string) string {