d3.rb 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. module Docs
  2. class D3 < UrlScraper
  3. self.name = 'D3.js'
  4. self.slug = 'd3'
  5. self.type = 'd3'
  6. self.links = {
  7. home: 'https://d3js.org/',
  8. code: 'https://github.com/d3/d3'
  9. }
  10. options[:container] = '.markdown-body'
  11. options[:attribution] = <<-HTML
  12. &copy; 2010&ndash;2016 Michael Bostock<br>
  13. Licensed under the BSD License.
  14. HTML
  15. version '4' do
  16. self.release = '4.2.6'
  17. self.base_url = 'https://github.com/d3/'
  18. self.root_path = 'd3/blob/master/API.md'
  19. html_filters.push 'd3/clean_html', 'd3/entries_v4'
  20. options[:only_patterns] = [/\Ad3[\-\w]+\z/, /\Ad3\/blob\/master\/changes\.md\z/i]
  21. options[:skip_patterns] = [/3\.x-api-reference/]
  22. options[:fix_urls] = ->(url) do
  23. url.sub! %r{/blob/master/readme.md}i, ''
  24. url
  25. end
  26. end
  27. version '3' do
  28. self.release = '3.5.17'
  29. self.base_url = 'https://github.com/d3/d3-3.x-api-reference/blob/master/'
  30. self.root_path = 'API-Reference.md'
  31. html_filters.push 'd3/clean_html', 'd3/entries_v3', 'title'
  32. options[:root_title] = 'D3.js'
  33. options[:only_patterns] = [/\.md\z/]
  34. end
  35. end
  36. end