| @@ -1,14 +1,23 @@ |
| 1 | module Docs | 1 | module Docs |
| 2 | class Go < UrlScraper | 2 | class Go < UrlScraper |
| 3 | self.type = 'go' | 3 | self.type = 'go' |
| 4 | self.release = '1.16' | 4 | self.release = '1.17.2' |
| 5 | self.base_url = 'https://golang.org/pkg/' | 5 | self.base_url = 'https://golang.org/pkg/' |
| 6 | self.links = { | 6 | self.links = { |
| 7 | home: 'https://golang.org/', | 7 | home: 'https://golang.org/', |
| 8 | code: 'https://go.googlesource.com/go' | 8 | code: 'https://go.googlesource.com/go' |
| 9 | } | 9 | } |
| 10 | | 10 | |
| | 11 | # Run godoc locally, since https://golang.org/pkg/ redirects to https://pkg.go.dev/std with rate limiting / scraping protection. |
| | 12 | |
| | 13 | # curl -LO https://golang.org/dl/go1.17.2.windows-amd64.zip |
| | 14 | # go install golang.org/x/tools/cmd/godoc@latest |
| | 15 | # go/bin/godoc -zip=go1.17.2.windows-amd64.zip -goroot=/go |
| | 16 | self.base_url = 'http://localhost:6060/pkg/' |
| | 17 | |
| | 18 | html_filters.push 'clean_local_urls' |
| 11 | html_filters.push 'go/clean_html', 'go/entries' | 19 | html_filters.push 'go/clean_html', 'go/entries' |
| | 20 | text_filters.replace 'attribution', 'go/attribution' |
| 12 | | 21 | |
| 13 | options[:trailing_slash] = true | 22 | options[:trailing_slash] = true |
| 14 | options[:container] = '#page .container' | 23 | options[:container] = '#page .container' |
| @@ -16,7 +25,7 @@ module Docs · 1 unmodified line |
| 16 | options[:skip_patterns] = [/\/\//] | 25 | options[:skip_patterns] = [/\/\//] |
| 17 | | 26 | |
| 18 | options[:fix_urls] = ->(url) do | 27 | options[:fix_urls] = ->(url) do |
| 19 | url.sub 'https://golang.org/pkg//', 'https://golang.org/pkg/' | 28 | url.sub '/pkg//', '/pkg/' |
| 20 | end | 29 | end |
| 21 | | 30 | |
| 22 | options[:attribution] = <<-HTML | 31 | options[:attribution] = <<-HTML |