mirror of
https://github.com/avelino/awesome-go.git
synced 2024-11-07 16:33:40 +00:00
notes
This commit is contained in:
parent
bb94bde97e
commit
994209cce9
9
main.go
9
main.go
@ -192,6 +192,8 @@ func changeLinksInIndex(html string, query *goquery.Document, objs map[string]*O
|
|||||||
query.Find("body #content ul li ul li a").Each(func(_ int, s *goquery.Selection) {
|
query.Find("body #content ul li ul li a").Each(func(_ int, s *goquery.Selection) {
|
||||||
href, hrefExists := s.Attr("href")
|
href, hrefExists := s.Attr("href")
|
||||||
if !hrefExists {
|
if !hrefExists {
|
||||||
|
// FIXME: looks like is an error. Tag `a` in our case always
|
||||||
|
// should have `href` attr.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,10 +203,15 @@ func changeLinksInIndex(html string, query *goquery.Document, objs map[string]*O
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: parse url
|
||||||
uri := strings.SplitAfter(href, "#")
|
uri := strings.SplitAfter(href, "#")
|
||||||
if len(uri) >= 2 && uri[1] != "contents" {
|
if len(uri) >= 2 && uri[1] != "contents" {
|
||||||
|
// FIXME: use s.SetAttr
|
||||||
html = strings.ReplaceAll(
|
html = strings.ReplaceAll(
|
||||||
html, fmt.Sprintf(`href="%s"`, href), fmt.Sprintf(`href="%s"`, uri[1]))
|
html,
|
||||||
|
fmt.Sprintf(`href="%s"`, href),
|
||||||
|
fmt.Sprintf(`href="%s"`, uri[1]),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user