1
0

npm.rb 866 B

12345678910111213141516171819202122232425262728293031323334353637
  1. module Docs
  2. class Npm < UrlScraper
  3. self.name = 'npm'
  4. self.type = 'npm'
  5. self.release = '3.10.2'
  6. self.base_url = 'https://docs.npmjs.com/'
  7. self.links = {
  8. home: 'https://www.npmjs.com/',
  9. code: 'https://github.com/npm/npm'
  10. }
  11. html_filters.push 'npm/entries', 'npm/clean_html', 'title'
  12. options[:container] = ->(filter) { filter.root_page? ? '.toc' : nil }
  13. options[:title] = false
  14. options[:root_title] = 'npm'
  15. options[:skip] = %w(all misc/index)
  16. options[:skip_patterns] = [
  17. /\Aenterprise/,
  18. /\Acompany/,
  19. /\Apolicies/
  20. ]
  21. options[:attribution] = <<-HTML
  22. &copy; npm, Inc. and Contributors<br>
  23. Licensed under the npm License.<br>
  24. npm is a trademark of npm, Inc.
  25. HTML
  26. private
  27. def request_options
  28. super.merge accept_encoding: 'gzip'
  29. end
  30. end
  31. end