go.rb 593 B

12345678910111213141516171819202122
  1. module Docs
  2. class Go < UrlScraper
  3. self.type = 'go'
  4. self.version = '1.2.1'
  5. self.base_url = 'http://golang.org/pkg/'
  6. html_filters.push 'go/clean_html', 'go/entries'
  7. options[:container] = '#page .container'
  8. options[:attribution] = <<-HTML
  9. &copy; Google, Inc.<br>
  10. Licensed under the Creative Commons Attribution License 3.0.
  11. HTML
  12. private
  13. def parse(html) # Hook here because Nokogori removes whitespace from textareas
  14. super html.gsub %r{<textarea\ class="code"[^>]*>([\W\w]+?)</textarea>}, '<pre class="code">\1</pre>'
  15. end
  16. end
  17. end