drupal.rb 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. module Docs
  2. class Drupal < UrlScraper
  3. self.type = 'drupal'
  4. self.version = '7.38'
  5. self.base_url = 'https://api.drupal.org/api/drupal/'
  6. self.initial_paths = %w(groups groups?page=1)
  7. self.links = {
  8. home: 'https://www.drupal.org/'
  9. }
  10. html_filters.push 'drupal/entries', 'drupal/clean_html', 'title'
  11. options[:decode_and_clean_paths] = true
  12. options[:container] = '#page-inner'
  13. options[:title] = false
  14. options[:root_title] = 'Drupal'
  15. options[:only_patterns] = [
  16. /\/class\/[^\/]+/,
  17. /\/group\/[^\/]+/,
  18. /\/function\/[^\/]+/]
  19. options[:skip_link] = ->(link) { link['href'] =~ /[\?&]order/ }
  20. options[:skip_patterns] = [
  21. /\/group\/updates\-7/,
  22. /\/group\/updates\-6/,
  23. /_update_[0-9]{4}/, # Skip update functions
  24. /\/[4-6](\.[0-9])*$/, # Skip previous versions
  25. /\/[8-9](\.[0-9])*$/, # Skip future versions
  26. /\/class\/hierarchy\//, # Skip class hierarchy listings
  27. /\/function\/calls\//, # Skip function calls listings
  28. /\/function\/invokes\//, # Skip function invokations listings
  29. /\/function\/overrides\//, # Skip function overrides listings
  30. /\/function\/references\//, # Skip function references listings
  31. /\/function\/implementations\//, # Skip hook implementation listings
  32. /\/function\/theme_references\//, # Skip hook references listings
  33. /\.test\/function\// # Skip test files
  34. ]
  35. options[:fix_urls] = ->(url) do
  36. url.remove! %r{/7$}
  37. url
  38. end
  39. options[:attribution] = <<-HTML
  40. &copy; 2001&ndash;2015 by the original authors<br>
  41. Licensed under the GNU General Public License, version 2 and later.<br>
  42. Drupal is a registered trademark of Dries Buytaert.
  43. HTML
  44. end
  45. end