drupal.rb 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. module Docs
  2. class Drupal < UrlScraper
  3. self.type = 'drupal'
  4. self.base_url = 'https://api.drupal.org/api/drupal/'
  5. self.links = {
  6. home: 'https://www.drupal.org/',
  7. code: 'http://cgit.drupalcode.org/drupal'
  8. }
  9. html_filters.push 'drupal/entries', 'drupal/clean_html', 'title'
  10. options[:decode_and_clean_paths] = true
  11. options[:container] = '#page-inner'
  12. options[:title] = false
  13. options[:root_title] = 'Drupal'
  14. options[:skip_link] = ->(link) { link['href'] =~ /[\?&]order/ }
  15. options[:skip_patterns] = [
  16. /\/group\/updates\-\d/,
  17. /_update_[0-9]{4}/, # Skip update functions
  18. /\/class\/hierarchy\//, # Skip class hierarchy listings
  19. /\/function\/calls\//, # Skip function calls listings
  20. /\/function\/invokes\//, # Skip function invokations listings
  21. /\/function\/overrides\//, # Skip function overrides listings
  22. /\/function\/references\//, # Skip function references listings
  23. /\/function\/implementations\//, # Skip hook implementation listings
  24. /\/function\/theme_references\//, # Skip hook references listings
  25. /\.test\//, # Skip test files
  26. /_test\//, # Skip test files
  27. /\.test\.module\//, # Skip test files
  28. /_test\.module\//, # Skip test files
  29. /_test_/, # Skip test files
  30. /_test\./, # Skip test files
  31. /tests/,
  32. /testing/,
  33. /upgrade/,
  34. /DRUPAL_ROOT/,
  35. /simpletest/,
  36. /constant\/constants/,
  37. /interface\/implements/,
  38. /interface\/hierarchy/,
  39. /theme_invokes/
  40. ]
  41. options[:attribution] = <<-HTML
  42. &copy; 2001&ndash;2016 by the original authors<br>
  43. Licensed under the GNU General Public License, version 2 and later.<br>
  44. Drupal is a registered trademark of Dries Buytaert.
  45. HTML
  46. version '7' do
  47. self.release = '7.50'
  48. self.root_path = '7.x'
  49. self.initial_paths = %w(groups/7.x groups/7.x?page=1)
  50. options[:only_patterns] = [
  51. /\/class\/[^\/]+\/7\.x\z/,
  52. /\/group\/[^\/]+\/7\.x\z/,
  53. /\/function\/[^\/]+\/7\.x\z/,
  54. /\/constant\/[^\/]+\/7\.x\z/,
  55. /\/interface\/[^\/]+\/7\.x\z/,
  56. /\/property\/[^\/]+\/7\.x\z/,
  57. /\/global\/[^\/]+\/7\.x\z/,
  58. /modules.*\/7\.x\z/,
  59. /includes.*\/7\.x\z/,
  60. /\A[\w\-\.]+\.php\/7\.x\z/
  61. ]
  62. end
  63. end
  64. end