diff --git a/assets/images/docs.png b/assets/images/docs.png
index 3c6fe660..298f1fd7 100644
Binary files a/assets/images/docs.png and b/assets/images/docs.png differ
diff --git a/assets/images/docs@2x.png b/assets/images/docs@2x.png
index 546e2227..f34938b4 100644
Binary files a/assets/images/docs@2x.png and b/assets/images/docs@2x.png differ
diff --git a/assets/stylesheets/pages/_rethinkdb.scss b/assets/stylesheets/pages/_rethinkdb.scss
index 841a984c..0a64abd4 100644
--- a/assets/stylesheets/pages/_rethinkdb.scss
+++ b/assets/stylesheets/pages/_rethinkdb.scss
@@ -1,6 +1,7 @@
._rethinkdb {
- > h2 { @extend %block-heading; }
- code { @extend %label; }
+ @extend %simple;
+
+ .infobox-alert { @extend %note-orange; }
.api_command_illustration {
float: right;
diff --git a/lib/docs/filters/rethinkdb/clean_html.rb b/lib/docs/filters/rethinkdb/clean_html.rb
index 0d6e2eaf..4f3db145 100644
--- a/lib/docs/filters/rethinkdb/clean_html.rb
+++ b/lib/docs/filters/rethinkdb/clean_html.rb
@@ -2,16 +2,13 @@ module Docs
class Rethinkdb
class CleanHtmlFilter < Filter
def call
- if root_page?
- doc.inner_html = '
ReQL command reference
'
- return doc
- end
+ @doc = at_css('.docs-article')
css('header .title').each do |node|
node.parent.replace(node)
end
- css('.lang-selector').remove
+ css('.lang-selector', '.platform-buttons img', 'hr', '#in-this-article').remove
css('.command-syntax').each do |node|
node.name = 'pre'
@@ -22,19 +19,33 @@ module Docs
node.content = node.content
end
- css('.highlight', '> section', '.highlighter-rouge').each do |node|
+ css('.highlight', 'section', 'div.highlighter-rouge', 'a > p', 'li > h1').each do |node|
node.before(node.children).remove
end
+ css('h2, h3, h4').each do |node|
+ node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
+ end
+
css('h1').each do |node|
next if node['class'].to_s.include?('title')
node.name = 'h2'
end
+ css('td h2').each do |node|
+ node.name = 'h5'
+ end
+
css('pre').each do |node|
node['data-language'] = current_url.path[/\A\/api\/(\w+)\//, 1]
end
+ css('.infobox').each do |node|
+ node.name = 'blockquote'
+ end
+
+ css('> .infobox:last-child:contains("Contribute:")').remove
+
doc
end
end
diff --git a/lib/docs/filters/rethinkdb/entries.rb b/lib/docs/filters/rethinkdb/entries.rb
index 16186bc3..5e49386b 100644
--- a/lib/docs/filters/rethinkdb/entries.rb
+++ b/lib/docs/filters/rethinkdb/entries.rb
@@ -2,20 +2,34 @@ module Docs
class Rethinkdb
class EntriesFilter < Docs::EntriesFilter
def get_name
- at_css('.title').content.remove('ReQL command:').split(', ').first
+ if subpath.start_with?('api')
+ at_css('.title').content.remove('ReQL command:').split(', ').first
+ else
+ at_css('.docs-nav .active').content
+ end
end
def get_type
- link = at_css('a[href^="https://github.com/rethinkdb/docs/blob/master/api/"]')
- dir = link['href'][/api\/\w+\/([^\/]+)/, 1]
- dir.titleize.gsub('Rql', 'ReQL').gsub('And', 'and')
+ if subpath.start_with?('api')
+ link = at_css('a[href^="https://github.com/rethinkdb/docs/blob/master/api/"]')
+ dir = link['href'][/api\/\w+\/([^\/]+)/, 1]
+ return 'Reference' if dir == 'index.md'
+ dir.titleize.gsub('Rql', 'ReQL').gsub('And', 'and')
+ else
+ at_css('.docs-nav .expanded').previous_element.content.prepend('Guides: ')
+ end
end
def additional_entries
+ return [] unless subpath.start_with?('api')
at_css('.title').content.split(', ')[1..-1].map do |name|
[name]
end
end
+
+ def include_default_entry?
+ at_css('.docs-article p').try(:content) != 'Choose your language:'
+ end
end
end
end
diff --git a/lib/docs/scrapers/rethinkdb.rb b/lib/docs/scrapers/rethinkdb.rb
index 5b5baac9..023bbe77 100644
--- a/lib/docs/scrapers/rethinkdb.rb
+++ b/lib/docs/scrapers/rethinkdb.rb
@@ -2,7 +2,9 @@ module Docs
class Rethinkdb < UrlScraper
self.name = 'RethinkDB'
self.type = 'rethinkdb'
- self.release = '2.3.2'
+ self.base_url = 'https://rethinkdb.com/'
+ self.release = '2.3.5'
+ self.root_path = 'docs/'
self.links = {
home: 'https://rethinkdb.com/',
code: 'https://github.com/rethinkdb/rethinkdb'
@@ -10,44 +12,57 @@ module Docs
html_filters.push 'rethinkdb/entries', 'rethinkdb/clean_html'
- options[:trailing_slash] = false
- options[:container] = '.docs-article'
+ options[:trailing_slash] = true
+ options[:container] = '.documentation'
+
+ options[:only_patterns] = [/\Adocs/]
+ options[:skip_patterns] = [/docs\/install(\-drivers)?\/./]
+ options[:skip] = %w(
+ docs/build/
+ docs/tutorials/elections/
+ docs/tutorials/superheroes/)
+
+ MULTILANG_DOCS = %w(
+ changefeeds
+ cookbook
+ dates-and-times
+ geo-support
+ guide
+ nested-fields
+ publish-subscribe
+ rabbitmq
+ secondary-indexes
+ sql-to-reql
+ storing-binary)
options[:attribution] = <<-HTML
© RethinkDB contributors
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
HTML
- version 'JavaScript' do
- self.base_url = 'https://rethinkdb.com/api/javascript/'
-
- options[:fix_urls] = ->(url) do
- url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/javascript/'
- end
- end
-
- version 'Ruby' do
- self.base_url = 'https://rethinkdb.com/api/ruby/'
-
- options[:fix_urls] = ->(url) do
- url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/ruby/'
- end
- end
+ %w(JavaScript Ruby Python Java).each do |name|
+ path = name.downcase
+ instance_eval <<-CODE
+ version '#{name}' do
+ self.initial_paths = %w(api/#{path}/)
- version 'Python' do
- self.base_url = 'https://rethinkdb.com/api/python/'
+ options[:only_patterns] += [/\\Aapi\\/#{path}\\//]
- options[:fix_urls] = ->(url) do
- url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/python/'
- end
+ options[:fix_urls] = ->(url) do
+ url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})\\z}, 'rethinkdb.com/docs/\\1/#{path}/'
+ url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})/(?!#{path}/).*}, 'rethinkdb.com/docs/\\1/#{path}/'
+ url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/#{path}/'
+ url
+ end
+ end
+ CODE
end
- version 'Java' do
- self.base_url = 'https://rethinkdb.com/api/java/'
+ private
- options[:fix_urls] = ->(url) do
- url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/java/'
- end
+ def process_response?(response)
+ return false unless super
+ response.body !~ /http-equiv="refresh"/i
end
end
end
diff --git a/public/icons/docs/rethinkdb/16.png b/public/icons/docs/rethinkdb/16.png
index 836e5bc5..4e7573d2 100644
Binary files a/public/icons/docs/rethinkdb/16.png and b/public/icons/docs/rethinkdb/16.png differ
diff --git a/public/icons/docs/rethinkdb/16@2x.png b/public/icons/docs/rethinkdb/16@2x.png
index 31c72916..a68fbad3 100644
Binary files a/public/icons/docs/rethinkdb/16@2x.png and b/public/icons/docs/rethinkdb/16@2x.png differ