r.rb 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. /\/doc\/index\.html$/,
  23. /\/demo$/,
  24. /\.pdf$/
  25. ]
  26. ## We want to fix links like so − but only if the targets don’t exist,
  27. ## as these target packages or keywords that do not have their own file,
  28. ## but exist on another page, and we properly record it.
  29. #
  30. #options[:fix_urls] = ->(url) do
  31. # url.sub!(%r'/library/([^/]+)/doc/index.html$') { |m| "/r-#{$1.parameterize.downcase}/" }
  32. # url.sub!(%r'/library/([^/]+)/html/([^/]+).html$') { |m| "/library/#{$1.parameterize.downcase}/html/#{$2.parameterize.downcase}" }
  33. #end
  34. options[:skip] = %w(
  35. doc/html/packages-head-utf8.html
  36. doc/html/SearchOn.html
  37. doc/html/Search.html
  38. doc/html/UserManuals.html
  39. doc/html/faq.html
  40. doc/manual/R-FAQ.html
  41. doc/manual/R-admin.html
  42. doc/manual/R-exts.html
  43. doc/manual/R-ints.html
  44. doc/manual/R-lang.html
  45. )
  46. end
  47. end