r.rb 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. module Docs
  2. class R < FileScraper
  3. self.name = 'R'
  4. self.slug = 'r'
  5. self.type = 'simple'
  6. self.release = '4.1.0'
  7. self.links = {
  8. home: 'https://www.r-project.org/',
  9. code: 'https://svn.r-project.org/R/'
  10. }
  11. self.root_path = 'doc/html/packages.html'
  12. html_filters.push 'r/entries', 'r/clean_html'
  13. options[:skip_links] = false
  14. options[:attribution] = <<-HTML
  15. Copyright (&copy;) 1999–2012 R Foundation for Statistical Computing.<br>
  16. Licensed under the <a href="https://www.gnu.org/copyleft/gpl.html">GNU General Public License</a>.
  17. HTML
  18. # Never want those
  19. options[:skip_patterns] = [
  20. /\/DESCRIPTION$/,
  21. /\/NEWS(\.[^\/]*)?$/,
  22. /\/demo$/,
  23. /\.pdf$/
  24. ]
  25. ## We want to fix links like so − but only if the targets don’t exist,
  26. ## as these target packages or keywords that do not have their own file,
  27. ## but exist on another page, and we properly record it.
  28. #
  29. #options[:fix_urls] = ->(url) do
  30. # url.sub!(%r'/library/([^/]+)/doc/index.html$') { |m| "/r-#{$1.parameterize.downcase}/" }
  31. # url.sub!(%r'/library/([^/]+)/html/([^/]+).html$') { |m| "/library/#{$1.parameterize.downcase}/html/#{$2.parameterize.downcase}" }
  32. #end
  33. options[:skip] = %w(
  34. doc/html/packages-head-utf8.html
  35. doc/html/SearchOn.html
  36. doc/html/Search.html
  37. doc/html/UserManuals.html
  38. doc/html/faq.html
  39. doc/manual/R-FAQ.html
  40. doc/manual/R-admin.html
  41. doc/manual/R-exts.html
  42. doc/manual/R-ints.html
  43. doc/manual/R-lang.html
  44. )
  45. end
  46. end