MCPcopy Index your code
hub / github.com/apache/answer / ClearText

Function ClearText

pkg/htmltext/htmltext.go:53–65  ·  view source on GitHub ↗

ClearText clear HTML, get the clear text

(html string)

Source from the content-addressed store, hash-verified

51
52// ClearText clear HTML, get the clear text
53func ClearText(html string) string {
54 if html == "" {
55 return html
56 }
57
58 html = reCode.ReplaceAllString(html, reCodeReplace)
59 html = reLink.ReplaceAllString(html, reLinkReplace)
60
61 text := spaceReplacer.Replace(strip.StripTags(html))
62
63 // replace multiple spaces to one space
64 return strings.TrimSpace(reSpace.ReplaceAllString(text, reSpaceReplace))
65}
66
67func UrlTitle(title string) (text string) {
68 title = convertChinese(title)

Callers 3

FetchRangedExcerptFunction · 0.85
FetchMatchedExcerptFunction · 0.85
TestClearTextFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestClearTextFunction · 0.68