devdocs/lib/docs/scrapers/cpp.rb

38 lines
1.1 KiB
Ruby
Raw Normal View History

2014-03-30 21:09:49 +02:00
module Docs
class Cpp < FileScraper
self.name = 'C++'
self.slug = 'cpp'
self.type = 'c'
2015-09-12 17:41:36 +02:00
self.dir = '/Users/Thibaut/DevDocs/Docs/C/cpp'
2014-03-30 21:09:49 +02:00
self.base_url = 'http://en.cppreference.com/w/cpp/'
self.root_path = 'header.html'
html_filters.insert_before 'clean_html', 'c/fix_code'
html_filters.push 'cpp/entries', 'c/clean_html', 'title'
text_filters.push 'cpp/fix_urls'
options[:container] = '#content'
options[:title] = false
options[:root_title] = 'C++ Programming Language'
options[:skip] = %w(
language/extending_std.html
language/history.html
regex/ecmascript.html
regex/regex_token_iterator/operator_cmp.html
)
2015-09-12 17:41:36 +02:00
options[:skip_patterns] = [/experimental/]
2014-03-30 21:09:49 +02:00
options[:only_patterns] = [/\.html\z/]
2014-11-17 00:00:54 +01:00
options[:fix_urls] = ->(url) do
url.sub! %r{\A.+/http%3A/}, 'http://'
url.sub! 'http://en.cppreference.com/upload.cppreference.com', 'http://upload.cppreference.com'
2014-11-17 00:00:54 +01:00
url
end
2014-03-30 21:09:49 +02:00
options[:attribution] = <<-HTML
&copy; cppreference.com<br>
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
HTML
end
end