c.rb 1.0 KB

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