cpp.rb 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. module Docs
  2. class Cpp < FileScraper
  3. self.name = 'C++'
  4. self.slug = 'cpp'
  5. self.type = 'c'
  6. self.dir = '/Users/Thibaut/DevDocs/Docs/cpp'
  7. self.base_url = 'http://en.cppreference.com/w/cpp/'
  8. self.root_path = 'header.html'
  9. html_filters.insert_before 'clean_html', 'c/fix_code'
  10. html_filters.push 'cpp/entries', 'c/clean_html', 'title'
  11. text_filters.push 'cpp/fix_urls'
  12. options[:decode_and_clean_paths] = true
  13. options[:container] = '#content'
  14. options[:title] = false
  15. options[:root_title] = 'C++ Programming Language'
  16. options[:skip] = %w(
  17. language/extending_std.html
  18. language/history.html
  19. regex/ecmascript.html
  20. regex/regex_token_iterator/operator_cmp.html
  21. )
  22. options[:skip_patterns] = [/experimental/]
  23. options[:only_patterns] = [/\.html\z/]
  24. options[:fix_urls] = ->(url) do
  25. url.sub! %r{\A.+/http%3A/}, 'http://'
  26. url.sub! 'http://en.cppreference.com/upload.cppreference.com', 'http://upload.cppreference.com'
  27. url
  28. end
  29. options[:attribution] = <<-HTML
  30. &copy; cppreference.com<br>
  31. Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
  32. HTML
  33. private
  34. def file_path_for(*)
  35. URI.unescape(super)
  36. end
  37. end
  38. end