c.rb 1006 B

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