Fix critical enhancement hanging bug caused by nil context in content injection
Replace nil context with context.Background() in content.go to prevent database operations from hanging indefinitely. Clean up outdated documentation files and add current project structure analysis.
This commit is contained in:
@@ -30,7 +30,25 @@ func (e *ContentEngine) discoverElements(doc *html.Node) ([]InsertrElement, []Co
|
||||
// Walk the document and categorize elements
|
||||
e.walkNodes(doc, func(n *html.Node) {
|
||||
if n.Type == html.ElementNode {
|
||||
if hasInsertrClass(n) {
|
||||
if e.hasInsertrAddClass(n) {
|
||||
// Collection element
|
||||
if hasInsertrClass(n) {
|
||||
// Handle .insertr.insertr-add combination:
|
||||
// Remove .insertr from container, add .insertr to viable children
|
||||
RemoveClass(n, "insertr")
|
||||
viableChildren := FindViableChildren(n)
|
||||
for _, child := range viableChildren {
|
||||
if !hasInsertrClass(child) {
|
||||
AddClass(child, "insertr")
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add as collection (collections take precedence)
|
||||
collectionElements = append(collectionElements, CollectionElement{
|
||||
Node: n,
|
||||
})
|
||||
} else if hasInsertrClass(n) {
|
||||
// Regular insertr element (only if not a collection)
|
||||
if isContainer(n) {
|
||||
// Container element - mark for transformation
|
||||
containersToTransform = append(containersToTransform, n)
|
||||
@@ -41,12 +59,6 @@ func (e *ContentEngine) discoverElements(doc *html.Node) ([]InsertrElement, []Co
|
||||
})
|
||||
}
|
||||
}
|
||||
if e.hasInsertrAddClass(n) {
|
||||
// Collection element - add directly (no container transformation for collections)
|
||||
collectionElements = append(collectionElements, CollectionElement{
|
||||
Node: n,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user