Browse Source

Check images

renovate/configure
Yota Toyama 8 years ago
parent
commit
3b83424073
  1. 2
      examples/markdown.feature
  2. 12
      main.go

2
examples/markdown.feature

@ -92,4 +92,4 @@ Feature: Markdown
linkcheck -v foo.md 2>&1 | wc -l
"""
When I successfully run `sh foo.sh`
Then the stdout should contain exactly "2"
Then the stdout should contain exactly "4"

12
main.go

@ -49,13 +49,23 @@ func extractURLs(n *html.Node) []string {
n := ns[i]
ns = ns[:i]
if n.Type == html.ElementNode && n.Data == "a" {
if n.Type == html.ElementNode {
switch n.Data {
case "a":
for _, a := range n.Attr {
if a.Key == "href" && isURL(a.Val) {
ss[a.Val] = true
break
}
}
case "img":
for _, a := range n.Attr {
if a.Key == "src" && isURL(a.Val) {
ss[a.Val] = true
break
}
}
}
}
for n := n.FirstChild; n != nil; n = n.NextSibling {

Loading…
Cancel
Save