Update Go documentation (1.17.2)

pull/1653/head
Simon Legner 3 years ago
parent 9f50c2cf49
commit 9e880425e2

@ -3,7 +3,7 @@
#short-nav, table.dir { margin-left: -1rem; } #short-nav, table.dir { margin-left: -1rem; }
a.source { a.source, span[title^="Added in Go"] {
float: right; float: right;
font-size: .9em; font-size: .9em;
} }

@ -0,0 +1,12 @@
# frozen_string_literal: true
module Docs
class Go
class AttributionFilter < Docs::AttributionFilter
def attribution_link
url = current_url.to_s.sub! 'localhost:6060', 'golang.org'
%(<a href="#{url}" class="_attribution-link">#{url}</a>)
end
end
end
end

@ -1,14 +1,23 @@
module Docs module Docs
class Go < UrlScraper class Go < UrlScraper
self.type = 'go' self.type = 'go'
self.release = '1.16' self.release = '1.17.2'
self.base_url = 'https://golang.org/pkg/' self.base_url = 'https://golang.org/pkg/'
self.links = { self.links = {
home: 'https://golang.org/', home: 'https://golang.org/',
code: 'https://go.googlesource.com/go' code: 'https://go.googlesource.com/go'
} }
# Run godoc locally, since https://golang.org/pkg/ redirects to https://pkg.go.dev/std with rate limiting / scraping protection.
# curl -LO https://golang.org/dl/go1.17.2.windows-amd64.zip
# go install golang.org/x/tools/cmd/godoc@latest
# go/bin/godoc -zip=go1.17.2.windows-amd64.zip -goroot=/go
self.base_url = 'http://localhost:6060/pkg/'
html_filters.push 'clean_local_urls'
html_filters.push 'go/clean_html', 'go/entries' html_filters.push 'go/clean_html', 'go/entries'
text_filters.replace 'attribution', 'go/attribution'
options[:trailing_slash] = true options[:trailing_slash] = true
options[:container] = '#page .container' options[:container] = '#page .container'
@ -16,7 +25,7 @@ module Docs
options[:skip_patterns] = [/\/\//] options[:skip_patterns] = [/\/\//]
options[:fix_urls] = ->(url) do options[:fix_urls] = ->(url) do
url.sub 'https://golang.org/pkg//', 'https://golang.org/pkg/' url.sub '/pkg//', '/pkg/'
end end
options[:attribution] = <<-HTML options[:attribution] = <<-HTML

Loading…
Cancel
Save