mirror of
https://github.com/avelino/awesome-go.git
synced 2024-11-13 11:14:37 -05:00
notes
This commit is contained in:
parent
bb94bde97e
commit
994209cce9
1 changed files with 8 additions and 1 deletions
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) {
|
||||
href, hrefExists := s.Attr("href")
|
||||
if !hrefExists {
|
||||
// FIXME: looks like is an error. Tag `a` in our case always
|
||||
// should have `href` attr.
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -201,10 +203,15 @@ func changeLinksInIndex(html string, query *goquery.Document, objs map[string]*O
|
|||
return
|
||||
}
|
||||
|
||||
// FIXME: parse url
|
||||
uri := strings.SplitAfter(href, "#")
|
||||
if len(uri) >= 2 && uri[1] != "contents" {
|
||||
// FIXME: use s.SetAttr
|
||||
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 a new issue