Add debug for menuGroup/menuSection structure detection

This commit is contained in:
John Mizerek 2026-02-12 20:01:43 -08:00
parent bed088d0ff
commit 794d2ceee5

View file

@ -265,13 +265,15 @@
</cfloop> </cfloop>
<cfset response["DEBUG_H4_TAGS"] = h4Texts> <cfset response["DEBUG_H4_TAGS"] = h4Texts>
<!--- Debug: show raw HTML snippet around first h3 tag ---> <!--- Debug: find menuGroup and menuSection divs --->
<cfset h3Pos = findNoCase("<h3", combinedHtml)> <cfset menuGroupMatches = reMatchNoCase("<div[^>]*class=""[^""]*menuGroup[^""]*""[^>]*>", combinedHtml)>
<cfif h3Pos GT 0> <cfset menuSectionMatches = reMatchNoCase("<section[^>]*class=""[^""]*menuSection[^""]*""[^>]*>", combinedHtml)>
<cfset snippetStart = max(1, h3Pos - 200)> <cfset response["DEBUG_MENU_GROUPS"] = arrayLen(menuGroupMatches)>
<cfset snippetEnd = min(len(combinedHtml), h3Pos + 500)> <cfset response["DEBUG_MENU_SECTIONS"] = arrayLen(menuSectionMatches)>
<cfset response["DEBUG_HTML_SNIPPET"] = mid(combinedHtml, snippetStart, snippetEnd - snippetStart)>
</cfif> <!--- Extract all span/div text that might be subcategory headers --->
<cfset subcatHeaders = reMatchNoCase("<(span|div)[^>]*class=""[^""]*header[^""]*""[^>]*>([^<]+)<", combinedHtml)>
<cfset response["DEBUG_SUBCAT_HEADERS"] = subcatHeaders>
<cfset arrayAppend(response.steps, "Found " & arrayLen(h3Texts) & " h3 and " & arrayLen(h4Texts) & " h4 tags")> <cfset arrayAppend(response.steps, "Found " & arrayLen(h3Texts) & " h3 and " & arrayLen(h4Texts) & " h4 tags")>
<!--- System prompt for URL analysis ---> <!--- System prompt for URL analysis --->