ClearText clear HTML, get the clear text
(html string)
| 51 | |
| 52 | // ClearText clear HTML, get the clear text |
| 53 | func 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 | |
| 67 | func UrlTitle(title string) (text string) { |
| 68 | title = convertChinese(title) |
no outgoing calls