func handleBlockquote(doc *goquery.Document) *goquery.Document { if tagEle := doc.Find("blockquote"); len(tagEle.Nodes) > 0 { tagEle.Each(func(i int, selection *goquery.Selection) { cont := getInnerHtml(selection) cont = strings.Replace(cont, "\r", "", -1) cont = strings.Replace(cont, "\
(doc *goquery.Document)
| 219 | |
| 220 | //[ok]handle tag <a> |
| 221 | func handleA(doc *goquery.Document) *goquery.Document { |
| 222 | doc.Find("a").Each(func(i int, selection *goquery.Selection) { |
| 223 | if href, ok := selection.Attr("href"); ok { |
| 224 | if cont, err := selection.Html(); err == nil { |
| 225 | md := fmt.Sprintf(`[%v](%v)`, cont, href) |
| 226 | selection.BeforeHtml(md) |
| 227 | selection.Remove() |
| 228 | } |
| 229 | } |
| 230 | }) |
| 231 | return doc |
| 232 | } |
| 233 | |
| 234 | //[ok]handle tag ul、ol、li |
| 235 | //处理步骤: |