MCPcopy Create free account
hub / github.com/53AI/53AIHub / normalizeWebFetchText

Function normalizeWebFetchText

api/service/tools/web_fetch.go:295–309  ·  view source on GitHub ↗
(raw string)

Source from the content-addressed store, hash-verified

293}
294
295func normalizeWebFetchText(raw string) string {
296 raw = strings.ReplaceAll(raw, "\r\n", "\n")
297 raw = strings.ReplaceAll(raw, "\r", "\n")
298
299 var out bytes.Buffer
300 for _, line := range strings.Split(raw, "\n") {
301 line = strings.TrimSpace(spaceCollapseRe.ReplaceAllString(line, " "))
302 if line == "" {
303 continue
304 }
305 out.WriteString(line)
306 out.WriteByte('\n')
307 }
308 return strings.TrimSpace(out.String())
309}
310
311func buildWebFetchDialContext(resolver webFetchResolver, dialer webFetchDialer) webFetchDialer {
312 return func(ctx context.Context, network, address string) (net.Conn, error) {

Callers 2

executeWebFetchFunction · 0.85
extractTextFromHTMLFunction · 0.85

Calls 2

WriteStringMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected